/src/gnutls/lib/x509/x509_int.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2003-2012 Free Software Foundation, Inc. |
3 | | * Copyright (C) 2017 Red Hat, Inc. |
4 | | * |
5 | | * Author: Nikos Mavrogiannopoulos |
6 | | * |
7 | | * This file is part of GnuTLS. |
8 | | * |
9 | | * The GnuTLS is free software; you can redistribute it and/or |
10 | | * modify it under the terms of the GNU Lesser General Public License |
11 | | * as published by the Free Software Foundation; either version 2.1 of |
12 | | * the License, or (at your option) any later version. |
13 | | * |
14 | | * This library is distributed in the hope that it will be useful, but |
15 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | | * Lesser General Public License for more details. |
18 | | * |
19 | | * You should have received a copy of the GNU Lesser General Public License |
20 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
21 | | * |
22 | | */ |
23 | | |
24 | | #ifndef GNUTLS_LIB_X509_X509_INT_H |
25 | | #define GNUTLS_LIB_X509_X509_INT_H |
26 | | |
27 | | #include <gnutls/x509.h> |
28 | | #include <gnutls/x509-ext.h> |
29 | | #include <gnutls/abstract.h> |
30 | | |
31 | | #include <libtasn1.h> |
32 | | |
33 | | #define MAX_CRQ_EXTENSIONS_SIZE 8 * 1024 |
34 | | #define MAX_OID_SIZE 128 |
35 | | #define MAX_KEY_ID_SIZE 128 |
36 | | #define MAX_SALT_SIZE 256 |
37 | | #define MAX_NAME_SIZE (3 * ASN1_MAX_NAME_SIZE) |
38 | | |
39 | | #define HASH_OID_SHA1 "1.3.14.3.2.26" |
40 | | #define HASH_OID_MD5 "1.2.840.113549.2.5" |
41 | | #define HASH_OID_MD2 "1.2.840.113549.2.2" |
42 | | #define HASH_OID_RMD160 "1.3.36.3.2.1" |
43 | | #define HASH_OID_SHA224 "2.16.840.1.101.3.4.2.4" |
44 | | #define HASH_OID_SHA256 "2.16.840.1.101.3.4.2.1" |
45 | | #define HASH_OID_SHA384 "2.16.840.1.101.3.4.2.2" |
46 | | #define HASH_OID_SHA512 "2.16.840.1.101.3.4.2.3" |
47 | | #define HASH_OID_SHA3_224 "2.16.840.1.101.3.4.2.7" |
48 | | #define HASH_OID_SHA3_256 "2.16.840.1.101.3.4.2.8" |
49 | | #define HASH_OID_SHA3_384 "2.16.840.1.101.3.4.2.9" |
50 | | #define HASH_OID_SHA3_512 "2.16.840.1.101.3.4.2.10" |
51 | | #define HASH_OID_SHAKE_128 "2.16.840.1.101.3.4.2.11" |
52 | | #define HASH_OID_SHAKE_256 "2.16.840.1.101.3.4.2.12" |
53 | | #define HASH_OID_GOST_R_3411_94 "1.2.643.2.2.9" |
54 | 0 | #define HASH_OID_STREEBOG_256 "1.2.643.7.1.1.2.2" |
55 | 0 | #define HASH_OID_STREEBOG_512 "1.2.643.7.1.1.2.3" |
56 | | |
57 | 0 | #define HASH_OID_GOST_R_3411_94_CRYPTOPRO_PARAMS "1.2.643.2.2.30.1" |
58 | | |
59 | | /* from rfc8479 */ |
60 | 0 | #define OID_ATTR_PROV_SEED "1.3.6.1.4.1.2312.18.8.1" |
61 | | |
62 | | struct gnutls_x509_crl_iter { |
63 | | /* This is used to optimize reads by gnutls_x509_crl_iter_crt_serial() */ |
64 | | asn1_node rcache; |
65 | | unsigned rcache_idx; |
66 | | }; |
67 | | |
68 | | typedef struct gnutls_x509_crl_int { |
69 | | asn1_node crl; |
70 | | |
71 | | unsigned expanded; |
72 | | /* This is used to optimize reads by gnutls_x509_crl_get_crt_serial2() */ |
73 | | asn1_node rcache; |
74 | | unsigned rcache_idx; |
75 | | int use_extensions; |
76 | | |
77 | | gnutls_datum_t der; |
78 | | gnutls_datum_t raw_issuer_dn; |
79 | | } gnutls_x509_crl_int; |
80 | | |
81 | | typedef struct gnutls_x509_dn_st { |
82 | | asn1_node asn; |
83 | | } gnutls_x509_dn_st; |
84 | | |
85 | | typedef struct gnutls_x509_crt_int { |
86 | | asn1_node cert; |
87 | | int use_extensions; |
88 | | unsigned expanded; /* a certificate has been expanded */ |
89 | | unsigned modified; /* the cached values below may no longer be valid */ |
90 | | unsigned flags; |
91 | | |
92 | | struct pin_info_st pin; |
93 | | |
94 | | /* These two cached values allow fast calls to |
95 | | * get_raw_*_dn(). */ |
96 | | gnutls_datum_t raw_dn; |
97 | | gnutls_datum_t raw_issuer_dn; |
98 | | gnutls_datum_t raw_spki; |
99 | | |
100 | | gnutls_datum_t der; |
101 | | |
102 | | /* this cached value allows fast access to alt names */ |
103 | | gnutls_subject_alt_names_t san; |
104 | | gnutls_subject_alt_names_t ian; |
105 | | |
106 | | /* backwards compatibility for gnutls_x509_crt_get_subject() |
107 | | * and gnutls_x509_crt_get_issuer() */ |
108 | | gnutls_x509_dn_st dn; |
109 | | gnutls_x509_dn_st idn; |
110 | | } gnutls_x509_crt_int; |
111 | | |
112 | 0 | #define MODIFIED(crt) crt->modified = 1 |
113 | | |
114 | | typedef struct gnutls_x509_crq_int { |
115 | | asn1_node crq; |
116 | | } gnutls_x509_crq_int; |
117 | | |
118 | | typedef struct gnutls_pkcs7_attrs_st { |
119 | | char *oid; |
120 | | gnutls_datum_t data; |
121 | | struct gnutls_pkcs7_attrs_st *next; |
122 | | } gnutls_pkcs7_attrs_st; |
123 | | |
124 | | typedef struct gnutls_pkcs7_int { |
125 | | asn1_node pkcs7; |
126 | | |
127 | | char encap_data_oid[MAX_OID_SIZE]; |
128 | | |
129 | | gnutls_datum_t der_signed_data; |
130 | | asn1_node signed_data; |
131 | | unsigned expanded; |
132 | | } gnutls_pkcs7_int; |
133 | | |
134 | | struct pbkdf2_params { |
135 | | uint8_t salt[MAX_SALT_SIZE]; |
136 | | int salt_size; |
137 | | unsigned iter_count; |
138 | | unsigned key_size; |
139 | | gnutls_mac_algorithm_t mac; |
140 | | }; |
141 | | |
142 | | typedef struct gnutls_x509_privkey_int { |
143 | | /* the size of params depends on the public |
144 | | * key algorithm |
145 | | */ |
146 | | gnutls_pk_params_st params; |
147 | | |
148 | | unsigned expanded; |
149 | | unsigned flags; |
150 | | |
151 | | asn1_node key; |
152 | | struct pin_info_st pin; |
153 | | } gnutls_x509_privkey_int; |
154 | | |
155 | | int _gnutls_x509_crt_cpy(gnutls_x509_crt_t dest, gnutls_x509_crt_t src); |
156 | | |
157 | | int _gnutls_x509_compare_raw_dn(const gnutls_datum_t *dn1, |
158 | | const gnutls_datum_t *dn2); |
159 | | |
160 | | int _gnutls_x509_crl_cpy(gnutls_x509_crl_t dest, gnutls_x509_crl_t src); |
161 | | int _gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl_t crl, |
162 | | gnutls_datum_t *dn); |
163 | | |
164 | | /* sign.c */ |
165 | | int _gnutls_x509_get_tbs(asn1_node cert, const char *tbs_name, |
166 | | gnutls_datum_t *tbs); |
167 | | int _gnutls_x509_pkix_sign(asn1_node src, const char *src_name, |
168 | | gnutls_digest_algorithm_t, unsigned int flags, |
169 | | gnutls_x509_crt_t issuer, |
170 | | gnutls_privkey_t issuer_key); |
171 | | int _gnutls_x509_crt_get_spki_params(gnutls_x509_crt_t issuer, |
172 | | const gnutls_x509_spki_t key_params, |
173 | | gnutls_x509_spki_t params); |
174 | | |
175 | 0 | #define map_errs_to_zero(x) ((x) < 0 ? 0 : (x)) |
176 | | |
177 | | /* dn.c */ |
178 | | #define OID_X520_COUNTRY_NAME "2.5.4.6" |
179 | | #define OID_X520_ORGANIZATION_NAME "2.5.4.10" |
180 | | #define OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11" |
181 | 0 | #define OID_X520_COMMON_NAME "2.5.4.3" |
182 | | #define OID_X520_LOCALITY_NAME "2.5.4.7" |
183 | | #define OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8" |
184 | | #define OID_LDAP_DC "0.9.2342.19200300.100.1.25" |
185 | | #define OID_LDAP_UID "0.9.2342.19200300.100.1.1" |
186 | | #define OID_PKCS9_EMAIL "1.2.840.113549.1.9.1" |
187 | | |
188 | | int _gnutls_x509_parse_dn(asn1_node asn1_struct, const char *asn1_rdn_name, |
189 | | char *buf, size_t *sizeof_buf, unsigned flags); |
190 | | |
191 | | int _gnutls_x509_get_dn(asn1_node asn1_struct, const char *asn1_rdn_name, |
192 | | gnutls_datum_t *dn, unsigned flags); |
193 | | |
194 | | int _gnutls_x509_parse_dn_oid(asn1_node asn1_struct, const char *asn1_rdn_name, |
195 | | const char *given_oid, int indx, |
196 | | unsigned int raw_flag, gnutls_datum_t *out); |
197 | | |
198 | | int _gnutls_x509_set_dn_oid(asn1_node asn1_struct, const char *asn1_rdn_name, |
199 | | const char *oid, int raw_flag, const char *name, |
200 | | int sizeof_name); |
201 | | |
202 | | int _gnutls_x509_get_dn_oid(asn1_node asn1_struct, const char *asn1_rdn_name, |
203 | | int indx, void *_oid, size_t *sizeof_oid); |
204 | | |
205 | | int _gnutls_encode_othername_data(unsigned flags, const void *data, |
206 | | unsigned data_size, gnutls_datum_t *output); |
207 | | |
208 | | int _gnutls_parse_general_name(asn1_node src, const char *src_name, int seq, |
209 | | void *name, size_t *name_size, |
210 | | unsigned int *ret_type, int othername_oid); |
211 | | |
212 | | int _gnutls_parse_general_name2(asn1_node src, const char *src_name, int seq, |
213 | | gnutls_datum_t *dname, unsigned int *ret_type, |
214 | | int othername_oid); |
215 | | |
216 | | int _gnutls_write_new_general_name(asn1_node ext, const char *ext_name, |
217 | | gnutls_x509_subject_alt_name_t type, |
218 | | const void *data, unsigned int data_size); |
219 | | |
220 | | int _gnutls_write_new_othername(asn1_node ext, const char *ext_name, |
221 | | const char *oid, const void *data, |
222 | | unsigned int data_size); |
223 | | |
224 | | /* dsa.c */ |
225 | | |
226 | | /* verify.c */ |
227 | | int gnutls_x509_crt_is_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer); |
228 | | |
229 | | int _gnutls_x509_verify_algorithm(gnutls_digest_algorithm_t *hash, |
230 | | const gnutls_datum_t *signature, |
231 | | gnutls_pk_algorithm_t pk, |
232 | | gnutls_pk_params_st *issuer_params); |
233 | | |
234 | | /* privkey.h */ |
235 | | void _gnutls_x509_privkey_reinit(gnutls_x509_privkey_t key); |
236 | | |
237 | | asn1_node _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t *raw_key, |
238 | | gnutls_x509_privkey_t pkey); |
239 | | int _gnutls_privkey_decode_ecc_key(asn1_node *pkey_asn, |
240 | | const gnutls_datum_t *raw_key, |
241 | | gnutls_x509_privkey_t pkey, |
242 | | gnutls_ecc_curve_t curve); |
243 | | |
244 | | int _gnutls_privkey_decode_eddsa_key(asn1_node *pkey_asn, |
245 | | const gnutls_datum_t *raw_key, |
246 | | gnutls_x509_privkey_t pkey, |
247 | | gnutls_ecc_curve_t curve); |
248 | | |
249 | | int _gnutls_x509_read_ecc_params(uint8_t *der, int dersize, |
250 | | unsigned int *curve); |
251 | | |
252 | | int _gnutls_x509_read_gost_params(uint8_t *der, int dersize, |
253 | | gnutls_pk_params_st *params, |
254 | | gnutls_pk_algorithm_t algo); |
255 | | |
256 | | int _gnutls_asn1_encode_privkey(asn1_node *c2, gnutls_pk_params_st *params); |
257 | | |
258 | | int _gnutls_x509_privkey_get_spki_params(gnutls_x509_privkey_t key, |
259 | | gnutls_x509_spki_st *params); |
260 | | |
261 | | int _gnutls_x509_read_rsa_pss_params(uint8_t *der, int dersize, |
262 | | gnutls_x509_spki_st *params); |
263 | | int _gnutls_x509_write_rsa_pss_params(const gnutls_x509_spki_st *params, |
264 | | gnutls_datum_t *der); |
265 | | |
266 | | int _gnutls_x509_read_rsa_oaep_params(uint8_t *der, int dersize, |
267 | | gnutls_x509_spki_st *params); |
268 | | int _gnutls_x509_write_rsa_oaep_params(const gnutls_x509_spki_st *params, |
269 | | gnutls_datum_t *der); |
270 | | |
271 | | /* extensions.c */ |
272 | | int _gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl, int indx, |
273 | | void *oid, size_t *sizeof_oid); |
274 | | |
275 | | int _gnutls_x509_crl_set_extension(gnutls_x509_crl_t crl, const char *ext_id, |
276 | | const gnutls_datum_t *ext_data, |
277 | | unsigned int critical); |
278 | | |
279 | | int _gnutls_x509_crl_get_extension(gnutls_x509_crl_t crl, |
280 | | const char *extension_id, int indx, |
281 | | gnutls_datum_t *data, |
282 | | unsigned int *critical); |
283 | | |
284 | | int _gnutls_x509_crt_get_extension(gnutls_x509_crt_t cert, |
285 | | const char *extension_id, int indx, |
286 | | gnutls_datum_t *data, |
287 | | unsigned int *critical); |
288 | | |
289 | | int _gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, int indx, |
290 | | void *ret, size_t *ret_size); |
291 | | int _gnutls_x509_crt_set_extension(gnutls_x509_crt_t cert, |
292 | | const char *extension_id, |
293 | | const gnutls_datum_t *ext_data, |
294 | | unsigned int critical); |
295 | | |
296 | | int _gnutls_x509_ext_extract_number(uint8_t *number, size_t *nr_size, |
297 | | uint8_t *extnValue, int extnValueLen); |
298 | | int _gnutls_x509_ext_gen_number(const uint8_t *number, size_t nr_size, |
299 | | gnutls_datum_t *der_ext); |
300 | | |
301 | | int _gnutls_write_general_name(asn1_node ext, const char *ext_name, |
302 | | gnutls_x509_subject_alt_name_t type, |
303 | | const void *data, unsigned int data_size); |
304 | | |
305 | | int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name_t type, |
306 | | const char *othername_oid, |
307 | | const void *data, |
308 | | unsigned int data_size, |
309 | | const gnutls_datum_t *prev_der_ext, |
310 | | gnutls_datum_t *der_ext); |
311 | | int _gnutls_x509_ext_gen_auth_key_id(const void *id, size_t id_size, |
312 | | gnutls_datum_t *der_data); |
313 | | |
314 | | /* mpi.c */ |
315 | | int _gnutls_x509_crq_get_mpis(gnutls_x509_crq_t cert, gnutls_pk_params_st *); |
316 | | |
317 | | int _gnutls_x509_crt_get_mpis(gnutls_x509_crt_t cert, |
318 | | gnutls_pk_params_st *params); |
319 | | |
320 | | int _gnutls_x509_read_pubkey_params(gnutls_pk_algorithm_t, uint8_t *der, |
321 | | int dersize, gnutls_pk_params_st *params); |
322 | | int _gnutls_x509_check_pubkey_params(gnutls_pk_params_st *params); |
323 | | |
324 | | int _gnutls_x509_read_pubkey(gnutls_pk_algorithm_t, uint8_t *der, int dersize, |
325 | | gnutls_pk_params_st *params); |
326 | | |
327 | | int _gnutls_x509_read_pubkey_signature_params(gnutls_pk_algorithm_t algo, |
328 | | uint8_t *der, int dersize, |
329 | | gnutls_pk_params_st *params); |
330 | | |
331 | | int _gnutls_x509_write_ecc_params(const gnutls_ecc_curve_t curve, |
332 | | gnutls_datum_t *der); |
333 | | int _gnutls_x509_write_ecc_pubkey(const gnutls_pk_params_st *params, |
334 | | gnutls_datum_t *der); |
335 | | |
336 | | int _gnutls_x509_write_eddsa_pubkey(const gnutls_pk_params_st *params, |
337 | | gnutls_datum_t *der); |
338 | | |
339 | | int _gnutls_x509_write_pubkey_params(const gnutls_pk_params_st *params, |
340 | | gnutls_datum_t *der); |
341 | | int _gnutls_x509_write_pubkey(const gnutls_pk_params_st *params, |
342 | | gnutls_datum_t *der); |
343 | | |
344 | | int _gnutls_x509_read_uint(asn1_node node, const char *value, |
345 | | unsigned int *ret); |
346 | | |
347 | | int _gnutls_x509_read_der_int(uint8_t *der, int dersize, bigint_t *out); |
348 | | int _gnutls_x509_read_der_uint(uint8_t *der, int dersize, unsigned int *out); |
349 | | |
350 | | int _gnutls_x509_read_int(asn1_node node, const char *value, bigint_t *ret_mpi); |
351 | | int _gnutls_x509_write_int(asn1_node node, const char *value, bigint_t mpi, |
352 | | int lz); |
353 | | |
354 | | int _gnutls_x509_write_uint32(asn1_node node, const char *value, uint32_t num); |
355 | | |
356 | | int _gnutls_x509_read_key_int(asn1_node node, const char *value, |
357 | | bigint_t *ret_mpi); |
358 | | int _gnutls_x509_write_key_int(asn1_node node, const char *value, bigint_t mpi, |
359 | | int lz); |
360 | | |
361 | | int _gnutls_x509_read_key_int_le(asn1_node node, const char *value, |
362 | | bigint_t *ret_mpi); |
363 | | int _gnutls_x509_write_key_int_le(asn1_node node, const char *value, |
364 | | bigint_t mpi); |
365 | | |
366 | | int _gnutls_x509_read_pkalgo_params(asn1_node src, const char *src_name, |
367 | | gnutls_x509_spki_st *params, |
368 | | unsigned is_sig); |
369 | | int _gnutls_x509_write_sign_params(asn1_node dst, const char *dst_name, |
370 | | const gnutls_sign_entry_st *se, |
371 | | gnutls_x509_spki_st *params); |
372 | | |
373 | | #define _gnutls_x509_read_sign_params(src, name, params) \ |
374 | 0 | _gnutls_x509_read_pkalgo_params(src, name, params, 1) |
375 | | #define _gnutls_x509_read_spki_params(src, name, params) \ |
376 | 0 | _gnutls_x509_read_pkalgo_params(src, name, params, 0) |
377 | | int _gnutls_x509_write_spki_params(asn1_node dst, const char *dst_name, |
378 | | gnutls_x509_spki_st *params); |
379 | | |
380 | | inline static int _gnutls_x509_crt_read_spki_params(gnutls_x509_crt_t crt, |
381 | | gnutls_x509_spki_st *params) |
382 | 0 | { |
383 | 0 | return _gnutls_x509_read_spki_params(crt->cert, |
384 | 0 | "tbsCertificate." |
385 | 0 | "subjectPublicKeyInfo." |
386 | 0 | "algorithm", |
387 | 0 | params); |
388 | 0 | } Unexecuted instantiation: handshake-tls13.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: handshake.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: auth.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: session_pack.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: cert-cred.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: fingerprint.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: profiles.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: state.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: cert-cred-x509.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: privkey.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pcert.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pubkey.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: dh-session.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: cert-session.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: handshake-checks.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: ocsp-api.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: certificate_request.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: certificate_verify.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: tls13-sig.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: hello_retry.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: session_ticket.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: certificate.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: post_handshake.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: common.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: crl.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: crq.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: dn.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: extensions.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: hostname-verify.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: key_decode.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: key_encode.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: mpi.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: ocsp.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: output.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pkcs12.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pkcs12_bag.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pkcs12_encr.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pkcs7-crypt.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: privkey_openssl.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: privkey_pkcs8.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: privkey_pkcs8_pbes1.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: prov-seed.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: sign.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: spki.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: time.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: tls_features.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: verify-high.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: verify-high2.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: verify.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: virt-san.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: x509.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: x509_dn.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: x509_ext.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: x509_write.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: key_share.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: status_request.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: supported_groups.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: cert.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: cert_types.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: ciphers.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: ciphersuites.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: ecc.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: groups.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: kx.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: mac.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: protocols.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: publickey.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: secparams.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: pk.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: dh.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: tls-sig.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: attributes.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: email-verify.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: krb5.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: name_constraints.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: dhe.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: ecdhe.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: rsa.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: rsa_psk.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: vko_gost.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: vko.c:_gnutls_x509_crt_read_spki_params |
389 | | |
390 | | inline static int _gnutls_x509_crq_read_spki_params(gnutls_x509_crq_t crt, |
391 | | gnutls_x509_spki_st *params) |
392 | 0 | { |
393 | 0 | return _gnutls_x509_read_spki_params(crt->crq, |
394 | 0 | "certificationRequestInfo." |
395 | 0 | "subjectPKInfo." |
396 | 0 | "algorithm", |
397 | 0 | params); |
398 | 0 | } Unexecuted instantiation: handshake-tls13.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: handshake.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: auth.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: session_pack.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: cert-cred.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: fingerprint.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: profiles.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: state.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: cert-cred-x509.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: privkey.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pcert.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pubkey.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: dh-session.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: cert-session.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: handshake-checks.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: ocsp-api.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: certificate_request.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: certificate_verify.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: tls13-sig.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: hello_retry.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: session_ticket.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: certificate.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: post_handshake.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: common.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: crl.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: crq.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: dn.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: extensions.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: hostname-verify.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: key_decode.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: key_encode.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: mpi.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: ocsp.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: output.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pkcs12.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pkcs12_bag.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pkcs12_encr.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pkcs7-crypt.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: privkey_openssl.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: privkey_pkcs8.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: privkey_pkcs8_pbes1.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: prov-seed.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: sign.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: spki.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: time.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: tls_features.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: verify-high.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: verify-high2.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: verify.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: virt-san.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: x509.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: x509_dn.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: x509_ext.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: x509_write.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: key_share.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: status_request.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: supported_groups.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: cert.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: cert_types.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: ciphers.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: ciphersuites.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: ecc.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: groups.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: kx.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: mac.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: protocols.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: publickey.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: secparams.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: pk.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: dh.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: tls-sig.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: attributes.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: email-verify.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: krb5.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: name_constraints.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: dhe.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: ecdhe.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: rsa.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: rsa_psk.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: vko_gost.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: vko.c:_gnutls_x509_crq_read_spki_params |
399 | | |
400 | | /* pkcs7-crypto.c */ |
401 | | int _gnutls_pbes2_string_to_key(unsigned int pass_len, const char *password, |
402 | | const struct pbkdf2_params *kdf_params, |
403 | | int key_size, uint8_t *key); |
404 | | int _gnutls_read_pbkdf2_params(asn1_node pasn, const gnutls_datum_t *der, |
405 | | struct pbkdf2_params *params); |
406 | | int _gnutls_write_pbkdf2_params(asn1_node pasn, |
407 | | const struct pbkdf2_params *kdf_params); |
408 | | int _gnutls_pbmac1(gnutls_mac_algorithm_t mac, const gnutls_datum_t *key, |
409 | | const struct pbkdf2_params *params, |
410 | | const gnutls_datum_t *data, uint8_t *output); |
411 | | int _gnutls_read_pbmac1_params(const uint8_t *data, int data_size, |
412 | | struct pbkdf2_params *kdf_params, |
413 | | gnutls_mac_algorithm_t *mac); |
414 | | int _gnutls_write_pbmac1_params(asn1_node pkcs12, |
415 | | const struct pbkdf2_params *kdf_params, |
416 | | gnutls_mac_algorithm_t algo, const char *where); |
417 | | |
418 | | /* pkcs12.h */ |
419 | | #include <gnutls/pkcs12.h> |
420 | | |
421 | | typedef struct gnutls_pkcs12_int { |
422 | | asn1_node pkcs12; |
423 | | unsigned expanded; |
424 | | } gnutls_pkcs12_int; |
425 | | |
426 | 0 | #define MAX_BAG_ELEMENTS 32 |
427 | | |
428 | | struct bag_element { |
429 | | gnutls_datum_t data; |
430 | | gnutls_pkcs12_bag_type_t type; |
431 | | gnutls_datum_t local_key_id; |
432 | | char *friendly_name; |
433 | | }; |
434 | | |
435 | | typedef struct gnutls_pkcs12_bag_int { |
436 | | struct bag_element element[MAX_BAG_ELEMENTS]; |
437 | | unsigned bag_elements; |
438 | | } gnutls_pkcs12_bag_int; |
439 | | |
440 | 0 | #define BAG_PKCS8_KEY "1.2.840.113549.1.12.10.1.1" |
441 | 0 | #define BAG_PKCS8_ENCRYPTED_KEY "1.2.840.113549.1.12.10.1.2" |
442 | 0 | #define BAG_CERTIFICATE "1.2.840.113549.1.12.10.1.3" |
443 | 0 | #define BAG_CRL "1.2.840.113549.1.12.10.1.4" |
444 | 0 | #define BAG_SECRET "1.2.840.113549.1.12.10.1.5" |
445 | | |
446 | | /* Bag attributes |
447 | | */ |
448 | 0 | #define FRIENDLY_NAME_OID "1.2.840.113549.1.9.20" |
449 | 0 | #define KEY_ID_OID "1.2.840.113549.1.9.21" |
450 | | |
451 | | int _gnutls_pkcs12_string_to_key(const mac_entry_st *me, unsigned int id, |
452 | | const uint8_t *salt, unsigned int salt_size, |
453 | | unsigned int iter, const char *pw, |
454 | | unsigned int req_keylen, uint8_t *keybuf); |
455 | | |
456 | | int _pkcs12_decode_safe_contents(const gnutls_datum_t *content, |
457 | | gnutls_pkcs12_bag_t bag); |
458 | | |
459 | | int _pkcs12_encode_safe_contents(gnutls_pkcs12_bag_t bag, asn1_node *content, |
460 | | int *enc); |
461 | | |
462 | | int _pkcs12_decode_crt_bag(gnutls_pkcs12_bag_type_t type, |
463 | | const gnutls_datum_t *in, gnutls_datum_t *out); |
464 | | int _pkcs12_encode_crt_bag(gnutls_pkcs12_bag_type_t type, |
465 | | const gnutls_datum_t *raw, gnutls_datum_t *out); |
466 | | |
467 | | /* crq */ |
468 | | int _gnutls_x509_crq_set_extension(gnutls_x509_crq_t crq, const char *ext_id, |
469 | | const gnutls_datum_t *ext_data, |
470 | | unsigned int critical); |
471 | | |
472 | | int gnutls_x509_crt_verify_data3(gnutls_x509_crt_t crt, |
473 | | gnutls_sign_algorithm_t algo, |
474 | | gnutls_typed_vdata_st *vdata, |
475 | | unsigned int vdata_size, |
476 | | const gnutls_datum_t *data, |
477 | | const gnutls_datum_t *signature, |
478 | | unsigned int flags); |
479 | | |
480 | | int _gnutls_trust_list_get_issuer(gnutls_x509_trust_list_t list, |
481 | | gnutls_x509_crt_t cert, |
482 | | gnutls_x509_crt_t *issuer, |
483 | | unsigned int flags); |
484 | | |
485 | | unsigned int _gnutls_verify_crt_status( |
486 | | gnutls_x509_trust_list_t tlist, |
487 | | const gnutls_x509_crt_t *certificate_list, int clist_size, |
488 | | const gnutls_x509_crt_t *trusted_cas, int tcas_size, unsigned int flags, |
489 | | const char *purpose, gnutls_verify_output_function func); |
490 | | |
491 | | #ifdef ENABLE_PKCS11 |
492 | | unsigned int _gnutls_pkcs11_verify_crt_status( |
493 | | gnutls_x509_trust_list_t tlist, const char *url, |
494 | | const gnutls_x509_crt_t *certificate_list, unsigned clist_size, |
495 | | const char *purpose, unsigned int flags, |
496 | | gnutls_verify_output_function func); |
497 | | #endif |
498 | | |
499 | | int _gnutls_check_cert_sanity(gnutls_x509_crt_t cert); |
500 | | |
501 | | int _gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert, |
502 | | const gnutls_x509_crl_t *crl_list, |
503 | | int crl_list_length, |
504 | | gnutls_verify_output_function func); |
505 | | |
506 | | bool _gnutls_x509_name_constraints_is_empty(gnutls_x509_name_constraints_t nc, |
507 | | unsigned type); |
508 | | int _gnutls_x509_name_constraints_extract(asn1_node c2, |
509 | | const char *permitted_name, |
510 | | const char *excluded_name, |
511 | | gnutls_x509_name_constraints_t nc); |
512 | | void _gnutls_x509_name_constraints_clear(gnutls_x509_name_constraints_t nc); |
513 | | int _gnutls_x509_name_constraints_merge(gnutls_x509_name_constraints_t nc, |
514 | | gnutls_x509_name_constraints_t nc2); |
515 | | |
516 | | void _gnutls_x509_policies_erase(gnutls_x509_policies_t policies, |
517 | | unsigned int seq); |
518 | | |
519 | | struct gnutls_x509_tlsfeatures_st { |
520 | | uint16_t feature[MAX_EXT_TYPES]; |
521 | | unsigned int size; |
522 | | }; |
523 | | |
524 | | unsigned _gnutls_is_broken_sig_allowed(const gnutls_sign_entry_st *se, |
525 | | unsigned int flags); |
526 | | |
527 | | #endif /* GNUTLS_LIB_X509_X509_INT_H */ |