Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2000-2012 Free Software Foundation, Inc. |
3 | | * |
4 | | * Author: Nikos Mavrogiannopoulos |
5 | | * |
6 | | * This file is part of GnuTLS. |
7 | | * |
8 | | * The GnuTLS is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU Lesser General Public License |
10 | | * as published by the Free Software Foundation; either version 2.1 of |
11 | | * the License, or (at your option) any later version. |
12 | | * |
13 | | * This library is distributed in the hope that it will be useful, but |
14 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | * Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
20 | | * |
21 | | */ |
22 | | |
23 | | #ifndef GNUTLS_LIB_MPI_H |
24 | | # define GNUTLS_LIB_MPI_H |
25 | | |
26 | | # include "gnutls_int.h" |
27 | | |
28 | | # include <crypto-backend.h> |
29 | | |
30 | | extern int crypto_bigint_prio; |
31 | | extern gnutls_crypto_bigint_st _gnutls_mpi_ops; |
32 | | |
33 | | bigint_t _gnutls_mpi_random_modp(bigint_t, bigint_t p, |
34 | | gnutls_rnd_level_t level); |
35 | | |
36 | 0 | # define _gnutls_mpi_init _gnutls_mpi_ops.bigint_init |
37 | | # define _gnutls_mpi_init_multi _gnutls_mpi_ops.bigint_init_multi |
38 | | # define _gnutls_mpi_clear _gnutls_mpi_ops.bigint_clear |
39 | | # define _gnutls_mpi_cmp _gnutls_mpi_ops.bigint_cmp |
40 | 0 | # define _gnutls_mpi_cmp_ui _gnutls_mpi_ops.bigint_cmp_ui |
41 | | # define _gnutls_mpi_mod _gnutls_mpi_ops.bigint_mod |
42 | | # define _gnutls_mpi_modm _gnutls_mpi_ops.bigint_modm |
43 | | # define _gnutls_mpi_set _gnutls_mpi_ops.bigint_set |
44 | 0 | # define _gnutls_mpi_set_ui _gnutls_mpi_ops.bigint_set_ui |
45 | 0 | # define _gnutls_mpi_get_nbits _gnutls_mpi_ops.bigint_get_nbits |
46 | 0 | # define _gnutls_mpi_powm _gnutls_mpi_ops.bigint_powm |
47 | 0 | # define _gnutls_mpi_addm _gnutls_mpi_ops.bigint_addm |
48 | | # define _gnutls_mpi_subm _gnutls_mpi_ops.bigint_subm |
49 | | # define _gnutls_mpi_mulm _gnutls_mpi_ops.bigint_mulm |
50 | | # define _gnutls_mpi_add _gnutls_mpi_ops.bigint_add |
51 | | # define _gnutls_mpi_sub _gnutls_mpi_ops.bigint_sub |
52 | | # define _gnutls_mpi_mul _gnutls_mpi_ops.bigint_mul |
53 | | # define _gnutls_mpi_div _gnutls_mpi_ops.bigint_div |
54 | 0 | # define _gnutls_mpi_add_ui _gnutls_mpi_ops.bigint_add_ui |
55 | | # define _gnutls_mpi_sub_ui _gnutls_mpi_ops.bigint_sub_ui |
56 | | # define _gnutls_mpi_mul_ui _gnutls_mpi_ops.bigint_mul_ui |
57 | | # define _gnutls_prime_check _gnutls_mpi_ops.bigint_prime_check |
58 | 0 | # define _gnutls_mpi_print(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_USG) |
59 | | # define _gnutls_mpi_print_lz(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_STD) |
60 | 0 | # define _gnutls_mpi_print_le(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_ULE) |
61 | | # define _gnutls_mpi_copy _gnutls_mpi_ops.bigint_copy |
62 | | # define _gnutls_mpi_scan(r, b, s) _gnutls_mpi_ops.bigint_scan(r, b, s, GNUTLS_MPI_FORMAT_USG) |
63 | | # define _gnutls_mpi_scan_le(r, b, s) _gnutls_mpi_ops.bigint_scan(r, b, s, GNUTLS_MPI_FORMAT_ULE) |
64 | | |
65 | | inline static |
66 | | void _gnutls_mpi_release(bigint_t * x) |
67 | 0 | { |
68 | 0 | if (*x == NULL) |
69 | 0 | return; |
70 | | |
71 | 0 | _gnutls_mpi_ops.bigint_release(*x); |
72 | 0 | *x = NULL; |
73 | 0 | } Unexecuted instantiation: common.c:_gnutls_mpi_release Unexecuted instantiation: crl.c:_gnutls_mpi_release Unexecuted instantiation: crq.c:_gnutls_mpi_release Unexecuted instantiation: dn.c:_gnutls_mpi_release Unexecuted instantiation: extensions.c:_gnutls_mpi_release Unexecuted instantiation: hostname-verify.c:_gnutls_mpi_release Unexecuted instantiation: key_decode.c:_gnutls_mpi_release Unexecuted instantiation: key_encode.c:_gnutls_mpi_release Unexecuted instantiation: ocsp.c:_gnutls_mpi_release Unexecuted instantiation: output.c:_gnutls_mpi_release Unexecuted instantiation: pkcs12.c:_gnutls_mpi_release Unexecuted instantiation: pkcs12_bag.c:_gnutls_mpi_release Unexecuted instantiation: pkcs12_encr.c:_gnutls_mpi_release Unexecuted instantiation: pkcs7-crypt.c:_gnutls_mpi_release Unexecuted instantiation: privkey_openssl.c:_gnutls_mpi_release Unexecuted instantiation: privkey_pkcs8.c:_gnutls_mpi_release Unexecuted instantiation: privkey_pkcs8_pbes1.c:_gnutls_mpi_release Unexecuted instantiation: prov-seed.c:_gnutls_mpi_release Unexecuted instantiation: sign.c:_gnutls_mpi_release Unexecuted instantiation: time.c:_gnutls_mpi_release Unexecuted instantiation: tls_features.c:_gnutls_mpi_release Unexecuted instantiation: verify-high.c:_gnutls_mpi_release Unexecuted instantiation: verify-high2.c:_gnutls_mpi_release Unexecuted instantiation: verify.c:_gnutls_mpi_release Unexecuted instantiation: virt-san.c:_gnutls_mpi_release Unexecuted instantiation: x509.c:_gnutls_mpi_release Unexecuted instantiation: x509_dn.c:_gnutls_mpi_release Unexecuted instantiation: x509_ext.c:_gnutls_mpi_release Unexecuted instantiation: x509_write.c:_gnutls_mpi_release Unexecuted instantiation: attributes.c:_gnutls_mpi_release Unexecuted instantiation: email-verify.c:_gnutls_mpi_release Unexecuted instantiation: ip.c:_gnutls_mpi_release Unexecuted instantiation: krb5.c:_gnutls_mpi_release Unexecuted instantiation: name_constraints.c:_gnutls_mpi_release |
74 | | |
75 | | int _gnutls_mpi_init_scan(bigint_t * ret_mpi, const void *buffer, |
76 | | size_t nbytes); |
77 | | int _gnutls_mpi_init_scan_nz(bigint_t * ret_mpi, const void *buffer, |
78 | | size_t nbytes); |
79 | | int _gnutls_mpi_init_scan_le(bigint_t * ret_mpi, const void *buffer, |
80 | | size_t nbytes); |
81 | | |
82 | | int _gnutls_mpi_dprint_le(const bigint_t a, gnutls_datum_t * dest); |
83 | | int _gnutls_mpi_dprint_lz(const bigint_t a, gnutls_datum_t * dest); |
84 | | int _gnutls_mpi_dprint(const bigint_t a, gnutls_datum_t * dest); |
85 | | int _gnutls_mpi_dprint_size(const bigint_t a, gnutls_datum_t * dest, |
86 | | size_t size); |
87 | | int _gnutls_mpi_bprint_size(const bigint_t a, uint8_t * buf, size_t size); |
88 | | |
89 | | typedef int (*mpi_dprint_func)(const bigint_t a, gnutls_datum_t * dest); |
90 | | |
91 | | # define _gnutls_mpi_generate_group( gg, bits) _gnutls_mpi_ops.bigint_generate_group( gg, bits) |
92 | | |
93 | | #endif /* GNUTLS_LIB_MPI_H */ |