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_PK_H  | 
24  |  | #define GNUTLS_LIB_PK_H  | 
25  |  |  | 
26  |  | extern int crypto_pk_prio;  | 
27  |  | extern gnutls_crypto_pk_st _gnutls_pk_ops;  | 
28  |  |  | 
29  |  | #define _gnutls_pk_encrypt(algo, ciphertext, plaintext, params) \  | 
30  | 0  |   _gnutls_pk_ops.encrypt(algo, ciphertext, plaintext, params)  | 
31  |  | #define _gnutls_pk_decrypt(algo, ciphertext, plaintext, params) \  | 
32  | 0  |   _gnutls_pk_ops.decrypt(algo, ciphertext, plaintext, params)  | 
33  |  | #define _gnutls_pk_decrypt2(algo, ciphertext, plaintext, size, params) \  | 
34  | 0  |   _gnutls_pk_ops.decrypt2(algo, ciphertext, plaintext, size, params)  | 
35  |  | #define _gnutls_pk_sign(algo, sig, data, params, sign_params) \  | 
36  | 0  |   _gnutls_pk_ops.sign(algo, sig, data, params, sign_params)  | 
37  |  | #define _gnutls_pk_verify(algo, data, sig, params, sign_params) \  | 
38  | 0  |   _gnutls_pk_ops.verify(algo, data, sig, params, sign_params)  | 
39  |  | #define _gnutls_pk_verify_priv_params(algo, params) \  | 
40  | 0  |   _gnutls_pk_ops.verify_priv_params(algo, params)  | 
41  |  | #define _gnutls_pk_verify_pub_params(algo, params) \  | 
42  | 0  |   _gnutls_pk_ops.verify_pub_params(algo, params)  | 
43  |  | #define _gnutls_pk_derive(algo, out, pub, priv) \  | 
44  | 0  |   _gnutls_pk_ops.derive(algo, out, pub, priv, NULL, 0)  | 
45  |  | #define _gnutls_pk_derive_nonce(algo, out, pub, priv, nonce) \  | 
46  | 0  |   _gnutls_pk_ops.derive(algo, out, pub, priv, nonce, 0)  | 
47  |  | #define _gnutls_pk_derive_tls13(algo, out, pub, priv) \  | 
48  | 0  |   _gnutls_pk_ops.derive(algo, out, pub, priv, NULL, PK_DERIVE_TLS13)  | 
49  |  | #define _gnutls_pk_encaps(algo, ciphertext, shared_secret, pub) \  | 
50  | 0  |   _gnutls_pk_ops.encaps(algo, ciphertext, shared_secret, pub)  | 
51  |  | #define _gnutls_pk_decaps(algo, shared_secret, ciphertext, priv) \  | 
52  | 0  |   _gnutls_pk_ops.decaps(algo, shared_secret, ciphertext, priv)  | 
53  |  | #define _gnutls_pk_generate_keys(algo, bits, params, temporal) \  | 
54  | 0  |   _gnutls_pk_ops.generate_keys(algo, bits, params, temporal)  | 
55  |  | #define _gnutls_pk_generate_params(algo, bits, priv) \  | 
56  | 0  |   _gnutls_pk_ops.generate_params(algo, bits, priv)  | 
57  |  | #define _gnutls_pk_hash_algorithm(pk, sig, params, hash) \  | 
58  |  |   _gnutls_pk_ops.hash_algorithm(pk, sig, params, hash)  | 
59  | 0  | #define _gnutls_pk_curve_exists(curve) _gnutls_pk_ops.curve_exists(curve)  | 
60  | 0  | #define _gnutls_pk_exists(algo) _gnutls_pk_ops.pk_exists(algo)  | 
61  |  | #define _gnutls_pk_sign_exists(algo) _gnutls_pk_ops.sign_exists(algo)  | 
62  |  |  | 
63  |  | inline static int _gnutls_pk_fixup(gnutls_pk_algorithm_t algo,  | 
64  |  |            gnutls_direction_t direction,  | 
65  |  |            gnutls_pk_params_st *params)  | 
66  | 0  | { | 
67  | 0  |   if (_gnutls_pk_ops.pk_fixup_private_params)  | 
68  | 0  |     return _gnutls_pk_ops.pk_fixup_private_params(algo, direction,  | 
69  | 0  |                     params);  | 
70  | 0  |   return 0;  | 
71  | 0  | } Unexecuted instantiation: cert-cred-x509.c:_gnutls_pk_fixup Unexecuted instantiation: privkey.c:_gnutls_pk_fixup Unexecuted instantiation: pubkey.c:_gnutls_pk_fixup Unexecuted instantiation: crypto-backend.c:_gnutls_pk_fixup Unexecuted instantiation: keys-dummy.c:_gnutls_pk_fixup Unexecuted instantiation: crq.c:_gnutls_pk_fixup Unexecuted instantiation: key_decode.c:_gnutls_pk_fixup Unexecuted instantiation: key_encode.c:_gnutls_pk_fixup Unexecuted instantiation: ocsp.c:_gnutls_pk_fixup Unexecuted instantiation: pkcs7-crypt.c:_gnutls_pk_fixup Unexecuted instantiation: privkey_pkcs8.c:_gnutls_pk_fixup Unexecuted instantiation: sign.c:_gnutls_pk_fixup Unexecuted instantiation: tls_features.c:_gnutls_pk_fixup Unexecuted instantiation: verify.c:_gnutls_pk_fixup Unexecuted instantiation: x509.c:_gnutls_pk_fixup Unexecuted instantiation: x509_write.c:_gnutls_pk_fixup Unexecuted instantiation: key_share.c:_gnutls_pk_fixup Unexecuted instantiation: cert.c:_gnutls_pk_fixup Unexecuted instantiation: dh_common.c:_gnutls_pk_fixup Unexecuted instantiation: ecc.c:_gnutls_pk_fixup Unexecuted instantiation: groups.c:_gnutls_pk_fixup Unexecuted instantiation: publickey.c:_gnutls_pk_fixup Unexecuted instantiation: pk.c:_gnutls_pk_fixup Unexecuted instantiation: dh.c:_gnutls_pk_fixup Unexecuted instantiation: tls-sig.c:_gnutls_pk_fixup Unexecuted instantiation: ecdhe.c:_gnutls_pk_fixup Unexecuted instantiation: rsa.c:_gnutls_pk_fixup Unexecuted instantiation: rsa_psk.c:_gnutls_pk_fixup Unexecuted instantiation: vko_gost.c:_gnutls_pk_fixup Unexecuted instantiation: vko.c:_gnutls_pk_fixup  | 
72  |  |  | 
73  |  | int _gnutls_pk_params_copy(gnutls_pk_params_st *dst,  | 
74  |  |          const gnutls_pk_params_st *src);  | 
75  |  |  | 
76  |  | /* The internal PK interface */  | 
77  |  | int _gnutls_encode_ber_rs(gnutls_datum_t *sig_value, bigint_t r, bigint_t s);  | 
78  |  | int _gnutls_encode_ber_rs_raw(gnutls_datum_t *sig_value,  | 
79  |  |             const gnutls_datum_t *r, const gnutls_datum_t *s);  | 
80  |  |  | 
81  |  | int _gnutls_decode_ber_rs(const gnutls_datum_t *sig_value, bigint_t *r,  | 
82  |  |         bigint_t *s);  | 
83  |  |  | 
84  |  | int _gnutls_decode_ber_rs_raw(const gnutls_datum_t *sig_value,  | 
85  |  |             gnutls_datum_t *r, gnutls_datum_t *s);  | 
86  |  |  | 
87  |  | int _gnutls_encode_gost_rs(gnutls_datum_t *sig_value, bigint_t r, bigint_t s,  | 
88  |  |          size_t intsize);  | 
89  |  |  | 
90  |  | int _gnutls_decode_gost_rs(const gnutls_datum_t *sig_value, bigint_t *r,  | 
91  |  |          bigint_t *s);  | 
92  |  |  | 
93  |  | gnutls_digest_algorithm_t _gnutls_gost_digest(gnutls_pk_algorithm_t pk);  | 
94  |  | gnutls_pk_algorithm_t _gnutls_digest_gost(gnutls_digest_algorithm_t digest);  | 
95  |  | gnutls_gost_paramset_t _gnutls_gost_paramset_default(gnutls_pk_algorithm_t pk);  | 
96  |  |  | 
97  |  | int encode_ber_digest_info(const mac_entry_st *e, const gnutls_datum_t *digest,  | 
98  |  |          gnutls_datum_t *output);  | 
99  |  |  | 
100  |  | #define decode_ber_digest_info gnutls_decode_ber_digest_info  | 
101  |  |  | 
102  |  | int _gnutls_params_get_rsa_raw(const gnutls_pk_params_st *params,  | 
103  |  |              gnutls_datum_t *m, gnutls_datum_t *e,  | 
104  |  |              gnutls_datum_t *d, gnutls_datum_t *p,  | 
105  |  |              gnutls_datum_t *q, gnutls_datum_t *u,  | 
106  |  |              gnutls_datum_t *e1, gnutls_datum_t *e2,  | 
107  |  |              unsigned int flags);  | 
108  |  |  | 
109  |  | int _gnutls_params_get_dsa_raw(const gnutls_pk_params_st *params,  | 
110  |  |              gnutls_datum_t *p, gnutls_datum_t *q,  | 
111  |  |              gnutls_datum_t *g, gnutls_datum_t *y,  | 
112  |  |              gnutls_datum_t *x, unsigned int flags);  | 
113  |  |  | 
114  |  | int _gnutls_params_get_ecc_raw(const gnutls_pk_params_st *params,  | 
115  |  |              gnutls_ecc_curve_t *curve, gnutls_datum_t *x,  | 
116  |  |              gnutls_datum_t *y, gnutls_datum_t *k,  | 
117  |  |              unsigned int flags);  | 
118  |  |  | 
119  |  | int _gnutls_params_get_gost_raw(const gnutls_pk_params_st *params,  | 
120  |  |         gnutls_ecc_curve_t *curve,  | 
121  |  |         gnutls_digest_algorithm_t *digest,  | 
122  |  |         gnutls_gost_paramset_t *paramset,  | 
123  |  |         gnutls_datum_t *x, gnutls_datum_t *y,  | 
124  |  |         gnutls_datum_t *k, unsigned int flags);  | 
125  |  |  | 
126  |  | int pk_prepare_hash(gnutls_pk_algorithm_t pk, const mac_entry_st *hash,  | 
127  |  |         gnutls_datum_t *output);  | 
128  |  | int pk_hash_data(gnutls_pk_algorithm_t pk, const mac_entry_st *hash,  | 
129  |  |      gnutls_pk_params_st *params, const gnutls_datum_t *data,  | 
130  |  |      gnutls_datum_t *digest);  | 
131  |  |  | 
132  |  | int _gnutls_find_rsa_pss_salt_size(unsigned bits, const mac_entry_st *me,  | 
133  |  |            unsigned salt_size);  | 
134  |  |  | 
135  |  | #endif /* GNUTLS_LIB_PK_H */  |