Coverage Report

Created: 2023-03-26 08:33

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