/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, |
169 | | unsigned int flags, |
170 | | gnutls_x509_crt_t issuer, |
171 | | gnutls_privkey_t issuer_key); |
172 | | int _gnutls_x509_crt_get_spki_params(gnutls_x509_crt_t issuer, |
173 | | const gnutls_x509_spki_st * key_params, |
174 | | gnutls_x509_spki_st * params); |
175 | | |
176 | 0 | # define map_errs_to_zero(x) ((x)<0?0:(x)) |
177 | | |
178 | | /* dn.c */ |
179 | | # define OID_X520_COUNTRY_NAME "2.5.4.6" |
180 | | # define OID_X520_ORGANIZATION_NAME "2.5.4.10" |
181 | | # define OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11" |
182 | 0 | # define OID_X520_COMMON_NAME "2.5.4.3" |
183 | | # define OID_X520_LOCALITY_NAME "2.5.4.7" |
184 | | # define OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8" |
185 | | # define OID_LDAP_DC "0.9.2342.19200300.100.1.25" |
186 | | # define OID_LDAP_UID "0.9.2342.19200300.100.1.1" |
187 | | # define OID_PKCS9_EMAIL "1.2.840.113549.1.9.1" |
188 | | |
189 | | int _gnutls_x509_parse_dn(asn1_node asn1_struct, |
190 | | const char *asn1_rdn_name, char *buf, |
191 | | size_t *sizeof_buf, unsigned flags); |
192 | | |
193 | | int |
194 | | _gnutls_x509_get_dn(asn1_node asn1_struct, |
195 | | const char *asn1_rdn_name, gnutls_datum_t * dn, |
196 | | unsigned flags); |
197 | | |
198 | | int |
199 | | _gnutls_x509_parse_dn_oid(asn1_node asn1_struct, |
200 | | const char *asn1_rdn_name, |
201 | | const char *given_oid, int indx, |
202 | | unsigned int raw_flag, gnutls_datum_t * out); |
203 | | |
204 | | int _gnutls_x509_set_dn_oid(asn1_node asn1_struct, |
205 | | const char *asn1_rdn_name, const char *oid, |
206 | | int raw_flag, const char *name, int sizeof_name); |
207 | | |
208 | | int _gnutls_x509_get_dn_oid(asn1_node asn1_struct, |
209 | | const char *asn1_rdn_name, |
210 | | int indx, void *_oid, size_t *sizeof_oid); |
211 | | |
212 | | int _gnutls_encode_othername_data(unsigned flags, const void *data, |
213 | | unsigned data_size, gnutls_datum_t * output); |
214 | | |
215 | | int _gnutls_parse_general_name(asn1_node src, const char *src_name, |
216 | | int seq, void *name, size_t *name_size, |
217 | | unsigned int *ret_type, int othername_oid); |
218 | | |
219 | | int |
220 | | _gnutls_parse_general_name2(asn1_node src, const char *src_name, |
221 | | int seq, gnutls_datum_t * dname, |
222 | | unsigned int *ret_type, int othername_oid); |
223 | | |
224 | | int |
225 | | _gnutls_write_new_general_name(asn1_node ext, const char *ext_name, |
226 | | gnutls_x509_subject_alt_name_t type, |
227 | | const void *data, unsigned int data_size); |
228 | | |
229 | | int |
230 | | _gnutls_write_new_othername(asn1_node ext, const char *ext_name, |
231 | | const char *oid, |
232 | | const void *data, unsigned int data_size); |
233 | | |
234 | | /* dsa.c */ |
235 | | |
236 | | /* verify.c */ |
237 | | int gnutls_x509_crt_is_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer); |
238 | | |
239 | | int |
240 | | _gnutls_x509_verify_algorithm(gnutls_digest_algorithm_t * hash, |
241 | | const gnutls_datum_t * signature, |
242 | | gnutls_pk_algorithm_t pk, |
243 | | gnutls_pk_params_st * issuer_params); |
244 | | |
245 | | /* privkey.h */ |
246 | | void _gnutls_x509_privkey_reinit(gnutls_x509_privkey_t key); |
247 | | |
248 | | asn1_node _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * |
249 | | raw_key, |
250 | | gnutls_x509_privkey_t pkey); |
251 | | int _gnutls_privkey_decode_ecc_key(asn1_node * pkey_asn, const gnutls_datum_t * |
252 | | raw_key, |
253 | | gnutls_x509_privkey_t pkey, |
254 | | gnutls_ecc_curve_t curve); |
255 | | |
256 | | int _gnutls_privkey_decode_eddsa_key(asn1_node * pkey_asn, |
257 | | const gnutls_datum_t * raw_key, |
258 | | gnutls_x509_privkey_t pkey, |
259 | | gnutls_ecc_curve_t curve); |
260 | | |
261 | | int |
262 | | _gnutls_x509_read_ecc_params(uint8_t * der, int dersize, unsigned int *curve); |
263 | | |
264 | | int |
265 | | _gnutls_x509_read_gost_params(uint8_t * der, int dersize, |
266 | | gnutls_pk_params_st * params, |
267 | | gnutls_pk_algorithm_t algo); |
268 | | |
269 | | int _gnutls_asn1_encode_privkey(asn1_node * c2, gnutls_pk_params_st * params); |
270 | | |
271 | | void _gnutls_x509_privkey_get_spki_params(gnutls_x509_privkey_t key, |
272 | | gnutls_x509_spki_st * params); |
273 | | |
274 | | int _gnutls_x509_read_rsa_pss_params(uint8_t * der, int dersize, |
275 | | gnutls_x509_spki_st * params); |
276 | | int _gnutls_x509_write_rsa_pss_params(const gnutls_x509_spki_st * params, |
277 | | gnutls_datum_t * der); |
278 | | |
279 | | /* extensions.c */ |
280 | | int _gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl, |
281 | | int indx, void *oid, size_t *sizeof_oid); |
282 | | |
283 | | int _gnutls_x509_crl_set_extension(gnutls_x509_crl_t crl, |
284 | | const char *ext_id, |
285 | | const gnutls_datum_t * ext_data, |
286 | | unsigned int critical); |
287 | | |
288 | | int |
289 | | _gnutls_x509_crl_get_extension(gnutls_x509_crl_t crl, |
290 | | const char *extension_id, int indx, |
291 | | gnutls_datum_t * data, unsigned int *critical); |
292 | | |
293 | | int |
294 | | _gnutls_x509_crt_get_extension(gnutls_x509_crt_t cert, |
295 | | const char *extension_id, int indx, |
296 | | gnutls_datum_t * data, unsigned int *critical); |
297 | | |
298 | | int _gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, |
299 | | int indx, void *ret, size_t *ret_size); |
300 | | int _gnutls_x509_crt_set_extension(gnutls_x509_crt_t cert, |
301 | | const char *extension_id, |
302 | | const gnutls_datum_t * ext_data, |
303 | | unsigned int critical); |
304 | | |
305 | | int |
306 | | _gnutls_x509_ext_extract_number(uint8_t * number, |
307 | | size_t *nr_size, |
308 | | uint8_t * extnValue, int extnValueLen); |
309 | | int |
310 | | _gnutls_x509_ext_gen_number(const uint8_t * number, size_t nr_size, |
311 | | gnutls_datum_t * der_ext); |
312 | | |
313 | | int |
314 | | _gnutls_write_general_name(asn1_node ext, const char *ext_name, |
315 | | gnutls_x509_subject_alt_name_t type, |
316 | | const void *data, unsigned int data_size); |
317 | | |
318 | | int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name_t |
319 | | type, |
320 | | const char *othername_oid, |
321 | | const void *data, |
322 | | unsigned int data_size, |
323 | | const gnutls_datum_t * prev_der_ext, |
324 | | gnutls_datum_t * der_ext); |
325 | | int _gnutls_x509_ext_gen_auth_key_id(const void *id, size_t id_size, |
326 | | gnutls_datum_t * der_data); |
327 | | |
328 | | /* mpi.c */ |
329 | | int _gnutls_x509_crq_get_mpis(gnutls_x509_crq_t cert, gnutls_pk_params_st *); |
330 | | |
331 | | int _gnutls_x509_crt_get_mpis(gnutls_x509_crt_t cert, |
332 | | gnutls_pk_params_st * params); |
333 | | |
334 | | int _gnutls_x509_read_pubkey_params(gnutls_pk_algorithm_t, uint8_t * der, |
335 | | int dersize, gnutls_pk_params_st * params); |
336 | | int _gnutls_x509_check_pubkey_params(gnutls_pk_params_st * params); |
337 | | |
338 | | int _gnutls_x509_read_pubkey(gnutls_pk_algorithm_t, uint8_t * der, |
339 | | int dersize, gnutls_pk_params_st * params); |
340 | | |
341 | | int _gnutls_x509_read_pubkey_signature_params(gnutls_pk_algorithm_t algo, |
342 | | uint8_t * der, int dersize, |
343 | | gnutls_pk_params_st * params); |
344 | | |
345 | | int _gnutls_x509_write_ecc_params(const gnutls_ecc_curve_t curve, |
346 | | gnutls_datum_t * der); |
347 | | int _gnutls_x509_write_ecc_pubkey(const gnutls_pk_params_st * params, |
348 | | gnutls_datum_t * der); |
349 | | |
350 | | int _gnutls_x509_write_eddsa_pubkey(const gnutls_pk_params_st * params, |
351 | | gnutls_datum_t * der); |
352 | | |
353 | | int |
354 | | _gnutls_x509_write_pubkey_params(const gnutls_pk_params_st * params, |
355 | | gnutls_datum_t * der); |
356 | | int _gnutls_x509_write_pubkey(const gnutls_pk_params_st * params, |
357 | | gnutls_datum_t * der); |
358 | | |
359 | | int _gnutls_x509_read_uint(asn1_node node, const char *value, |
360 | | unsigned int *ret); |
361 | | |
362 | | int _gnutls_x509_read_der_int(uint8_t * der, int dersize, bigint_t * out); |
363 | | int _gnutls_x509_read_der_uint(uint8_t * der, int dersize, unsigned int *out); |
364 | | |
365 | | int _gnutls_x509_read_int(asn1_node node, const char *value, |
366 | | bigint_t * ret_mpi); |
367 | | int _gnutls_x509_write_int(asn1_node node, const char *value, bigint_t mpi, |
368 | | int lz); |
369 | | |
370 | | int _gnutls_x509_write_uint32(asn1_node node, const char *value, uint32_t num); |
371 | | |
372 | | int _gnutls_x509_read_key_int(asn1_node node, const char *value, |
373 | | bigint_t * ret_mpi); |
374 | | int _gnutls_x509_write_key_int(asn1_node node, const char *value, bigint_t mpi, |
375 | | int lz); |
376 | | |
377 | | int _gnutls_x509_read_key_int_le(asn1_node node, const char *value, |
378 | | bigint_t * ret_mpi); |
379 | | int _gnutls_x509_write_key_int_le(asn1_node node, const char *value, |
380 | | bigint_t mpi); |
381 | | |
382 | | int _gnutls_x509_read_pkalgo_params(asn1_node src, const char *src_name, |
383 | | gnutls_x509_spki_st * params, |
384 | | unsigned is_sig); |
385 | | int _gnutls_x509_write_sign_params(asn1_node dst, const char *dst_name, |
386 | | const gnutls_sign_entry_st * se, |
387 | | gnutls_x509_spki_st * params); |
388 | | |
389 | 0 | # define _gnutls_x509_read_sign_params(src,name,params) _gnutls_x509_read_pkalgo_params(src,name,params,1) |
390 | 0 | # define _gnutls_x509_read_spki_params(src,name,params) _gnutls_x509_read_pkalgo_params(src,name,params,0) |
391 | | int _gnutls_x509_write_spki_params(asn1_node dst, const char *dst_name, |
392 | | gnutls_x509_spki_st * params); |
393 | | |
394 | | inline static int |
395 | | _gnutls_x509_crt_read_spki_params(gnutls_x509_crt_t crt, |
396 | | gnutls_x509_spki_st * params) |
397 | 0 | { |
398 | 0 | return _gnutls_x509_read_spki_params(crt->cert, |
399 | 0 | "tbsCertificate." |
400 | 0 | "subjectPublicKeyInfo." |
401 | 0 | "algorithm", params); |
402 | 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: 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: crl.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: crq.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: extensions.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: 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: tls_features.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: x509.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: x509_write.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: dh.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: fingerprint.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: name_constraints.c:_gnutls_x509_crt_read_spki_params Unexecuted instantiation: vko.c:_gnutls_x509_crt_read_spki_params |
403 | | |
404 | | inline static int |
405 | | _gnutls_x509_crq_read_spki_params(gnutls_x509_crq_t crt, |
406 | | gnutls_x509_spki_st * params) |
407 | 0 | { |
408 | 0 | return _gnutls_x509_read_spki_params(crt->crq, |
409 | 0 | "certificationRequestInfo." |
410 | 0 | "subjectPKInfo." |
411 | 0 | "algorithm", params); |
412 | 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: 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: crl.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: crq.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: extensions.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: 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: tls_features.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: x509.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: x509_write.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: dh.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: fingerprint.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: name_constraints.c:_gnutls_x509_crq_read_spki_params Unexecuted instantiation: vko.c:_gnutls_x509_crq_read_spki_params |
413 | | |
414 | | /* pkcs12.h */ |
415 | | # include <gnutls/pkcs12.h> |
416 | | |
417 | | typedef struct gnutls_pkcs12_int { |
418 | | asn1_node pkcs12; |
419 | | unsigned expanded; |
420 | | } gnutls_pkcs12_int; |
421 | | |
422 | 0 | # define MAX_BAG_ELEMENTS 32 |
423 | | |
424 | | struct bag_element { |
425 | | gnutls_datum_t data; |
426 | | gnutls_pkcs12_bag_type_t type; |
427 | | gnutls_datum_t local_key_id; |
428 | | char *friendly_name; |
429 | | }; |
430 | | |
431 | | typedef struct gnutls_pkcs12_bag_int { |
432 | | struct bag_element element[MAX_BAG_ELEMENTS]; |
433 | | unsigned bag_elements; |
434 | | } gnutls_pkcs12_bag_int; |
435 | | |
436 | 0 | # define BAG_PKCS8_KEY "1.2.840.113549.1.12.10.1.1" |
437 | 0 | # define BAG_PKCS8_ENCRYPTED_KEY "1.2.840.113549.1.12.10.1.2" |
438 | 0 | # define BAG_CERTIFICATE "1.2.840.113549.1.12.10.1.3" |
439 | 0 | # define BAG_CRL "1.2.840.113549.1.12.10.1.4" |
440 | 0 | # define BAG_SECRET "1.2.840.113549.1.12.10.1.5" |
441 | | |
442 | | /* Bag attributes |
443 | | */ |
444 | 0 | # define FRIENDLY_NAME_OID "1.2.840.113549.1.9.20" |
445 | 0 | # define KEY_ID_OID "1.2.840.113549.1.9.21" |
446 | | |
447 | | int |
448 | | _gnutls_pkcs12_string_to_key(const mac_entry_st * me, |
449 | | unsigned int id, const uint8_t * salt, |
450 | | unsigned int salt_size, unsigned int iter, |
451 | | const char *pw, unsigned int req_keylen, |
452 | | uint8_t * keybuf); |
453 | | |
454 | | int _pkcs12_decode_safe_contents(const gnutls_datum_t * content, |
455 | | gnutls_pkcs12_bag_t bag); |
456 | | |
457 | | int |
458 | | _pkcs12_encode_safe_contents(gnutls_pkcs12_bag_t bag, asn1_node * content, |
459 | | int *enc); |
460 | | |
461 | | int _pkcs12_decode_crt_bag(gnutls_pkcs12_bag_type_t type, |
462 | | const gnutls_datum_t * in, gnutls_datum_t * out); |
463 | | int _pkcs12_encode_crt_bag(gnutls_pkcs12_bag_type_t type, |
464 | | const gnutls_datum_t * raw, gnutls_datum_t * out); |
465 | | |
466 | | /* crq */ |
467 | | int _gnutls_x509_crq_set_extension(gnutls_x509_crq_t crq, |
468 | | const char *ext_id, |
469 | | const gnutls_datum_t * ext_data, |
470 | | unsigned int critical); |
471 | | |
472 | | int |
473 | | gnutls_x509_crt_verify_data3(gnutls_x509_crt_t crt, |
474 | | gnutls_sign_algorithm_t algo, |
475 | | gnutls_typed_vdata_st * vdata, |
476 | | unsigned int vdata_size, |
477 | | const gnutls_datum_t * data, |
478 | | const gnutls_datum_t * signature, |
479 | | unsigned int flags); |
480 | | |
481 | | int _gnutls_trust_list_get_issuer(gnutls_x509_trust_list_t list, |
482 | | gnutls_x509_crt_t cert, |
483 | | gnutls_x509_crt_t * issuer, |
484 | | unsigned int flags); |
485 | | |
486 | | unsigned int |
487 | | _gnutls_verify_crt_status(gnutls_x509_trust_list_t tlist, |
488 | | const gnutls_x509_crt_t * certificate_list, |
489 | | int clist_size, |
490 | | const gnutls_x509_crt_t * trusted_cas, |
491 | | int tcas_size, |
492 | | unsigned int flags, |
493 | | const char *purpose, |
494 | | gnutls_verify_output_function func); |
495 | | |
496 | | # ifdef ENABLE_PKCS11 |
497 | | unsigned int |
498 | | _gnutls_pkcs11_verify_crt_status(gnutls_x509_trust_list_t tlist, |
499 | | const char *url, |
500 | | const gnutls_x509_crt_t * certificate_list, |
501 | | unsigned clist_size, |
502 | | const char *purpose, |
503 | | unsigned int flags, |
504 | | gnutls_verify_output_function func); |
505 | | # endif |
506 | | |
507 | | int _gnutls_check_cert_sanity(gnutls_x509_crt_t cert); |
508 | | |
509 | | int |
510 | | _gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert, |
511 | | const gnutls_x509_crl_t * crl_list, |
512 | | int crl_list_length, |
513 | | gnutls_verify_output_function func); |
514 | | |
515 | | typedef struct gnutls_name_constraints_st { |
516 | | struct name_constraints_node_st *permitted; |
517 | | struct name_constraints_node_st *excluded; |
518 | | } gnutls_name_constraints_st; |
519 | | |
520 | | typedef struct name_constraints_node_st { |
521 | | unsigned type; |
522 | | gnutls_datum_t name; |
523 | | struct name_constraints_node_st *next; |
524 | | } name_constraints_node_st; |
525 | | |
526 | | int _gnutls_extract_name_constraints(asn1_node c2, const char *vstr, |
527 | | name_constraints_node_st ** _nc); |
528 | | void _gnutls_name_constraints_node_free(name_constraints_node_st * node); |
529 | | int _gnutls_x509_name_constraints_merge(gnutls_x509_name_constraints_t nc, |
530 | | gnutls_x509_name_constraints_t nc2); |
531 | | |
532 | | void _gnutls_x509_policies_erase(gnutls_x509_policies_t policies, |
533 | | unsigned int seq); |
534 | | |
535 | | struct gnutls_x509_tlsfeatures_st { |
536 | | uint16_t feature[MAX_EXT_TYPES]; |
537 | | unsigned int size; |
538 | | }; |
539 | | |
540 | | unsigned _gnutls_is_broken_sig_allowed(const gnutls_sign_entry_st * se, |
541 | | unsigned int flags); |
542 | | |
543 | | #endif /* GNUTLS_LIB_X509_X509_INT_H */ |