/src/openssl/crypto/x509/x509_vpm.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2004-2026 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #include <stdio.h> |
11 | | |
12 | | #include "internal/cryptlib.h" |
13 | | #include <openssl/crypto.h> |
14 | | #include <openssl/buffer.h> |
15 | | #include <openssl/x509.h> |
16 | | #include <openssl/x509v3.h> |
17 | | |
18 | | #include "crypto/ctype.h" |
19 | | #include "crypto/x509.h" |
20 | | |
21 | | #include "x509_local.h" |
22 | | |
23 | | typedef enum { |
24 | | OSSL_CHARSET_NONASCII, |
25 | | OSSL_CHARSET_ASCII, |
26 | | OSSL_CHARSET_ASCII_ALNUM, |
27 | | } ossl_charset_t; |
28 | | |
29 | | /* X509_VERIFY_PARAM functions */ |
30 | | |
31 | | #define SET_HOST 0 |
32 | | #define ADD_HOST 1 |
33 | | |
34 | | static X509_BUFFER *buffer_from_bytes(const uint8_t *bytes, size_t length) |
35 | 0 | { |
36 | 0 | X509_BUFFER *buf; |
37 | |
|
38 | 0 | if ((buf = OPENSSL_zalloc(sizeof(*buf))) != NULL |
39 | 0 | && (buf->data = OPENSSL_memdup(bytes, length)) != NULL) { |
40 | 0 | buf->len = length; |
41 | 0 | } else { |
42 | 0 | OPENSSL_free(buf); |
43 | 0 | buf = NULL; |
44 | 0 | } |
45 | 0 | return buf; |
46 | 0 | } |
47 | | |
48 | | /* |
49 | | * Copies |length| bytes from |bytes| to a new buffer, making the data |
50 | | * A C string. It is an error for the |bytes| to contain any \0 values |
51 | | * within |length|. |bytes| need not itself be \0 terminated, the data |
52 | | * in the buffer will be on success. |
53 | | */ |
54 | | static X509_BUFFER *buffer_from_string(const uint8_t *bytes, size_t length) |
55 | 0 | { |
56 | 0 | X509_BUFFER *buf, *ret = NULL; |
57 | 0 | uint8_t *data = NULL; |
58 | |
|
59 | 0 | if ((buf = OPENSSL_zalloc(sizeof(*buf))) == NULL) |
60 | 0 | goto err; |
61 | | |
62 | 0 | if ((data = (uint8_t *)OPENSSL_strndup((char *)bytes, length)) == NULL) |
63 | 0 | goto err; |
64 | | |
65 | 0 | if (strlen((char *)data) != length) |
66 | 0 | goto err; |
67 | | |
68 | 0 | ret = buf; |
69 | 0 | buf = NULL; |
70 | 0 | ret->data = data; |
71 | 0 | ret->len = length; |
72 | 0 | data = NULL; |
73 | |
|
74 | 0 | err: |
75 | 0 | OPENSSL_free(buf); |
76 | 0 | OPENSSL_free(data); |
77 | |
|
78 | 0 | return ret; |
79 | 0 | } |
80 | | |
81 | | static X509_BUFFER *buffer_copy_bytes(const X509_BUFFER *b) |
82 | 0 | { |
83 | 0 | return buffer_from_bytes(b->data, b->len); |
84 | 0 | } |
85 | | |
86 | | static X509_BUFFER *buffer_copy_string(const X509_BUFFER *b) |
87 | 0 | { |
88 | 0 | return buffer_from_string(b->data, b->len); |
89 | 0 | } |
90 | | |
91 | | static void buffer_free(X509_BUFFER *b) |
92 | 0 | { |
93 | 0 | if (b == NULL) |
94 | 0 | return; |
95 | 0 | OPENSSL_free((void *)b->data); |
96 | 0 | OPENSSL_free(b); |
97 | 0 | } |
98 | | |
99 | | static int replace_buffer_stack_bytes(STACK_OF(X509_BUFFER) **dest, |
100 | | STACK_OF(X509_BUFFER) *const *src) |
101 | 0 | { |
102 | 0 | sk_X509_BUFFER_pop_free(*dest, buffer_free); |
103 | 0 | *dest = NULL; |
104 | 0 | if (*src != NULL) { |
105 | 0 | *dest = sk_X509_BUFFER_deep_copy(*src, buffer_copy_bytes, buffer_free); |
106 | 0 | if (*dest == NULL) |
107 | 0 | return 0; |
108 | 0 | } |
109 | 0 | return 1; |
110 | 0 | } |
111 | | |
112 | | static int replace_buffer_stack_string(STACK_OF(X509_BUFFER) **dest, |
113 | | STACK_OF(X509_BUFFER) *const *src) |
114 | 0 | { |
115 | 0 | sk_X509_BUFFER_pop_free(*dest, buffer_free); |
116 | 0 | *dest = NULL; |
117 | 0 | if (*src != NULL) { |
118 | 0 | *dest = sk_X509_BUFFER_deep_copy(*src, buffer_copy_string, buffer_free); |
119 | 0 | if (*dest == NULL) |
120 | 0 | return 0; |
121 | 0 | } |
122 | 0 | return 1; |
123 | 0 | } |
124 | | |
125 | | static int buffer_cmp(const X509_BUFFER *const *a, const X509_BUFFER *const *b) |
126 | 0 | { |
127 | 0 | if ((*a)->len < (*b)->len) |
128 | 0 | return -1; |
129 | 0 | if ((*a)->len > (*b)->len) |
130 | 0 | return 1; |
131 | 0 | if ((*b)->len == 0) |
132 | 0 | return 0; |
133 | 0 | return memcmp((*a)->data, (*b)->data, (*b)->len); |
134 | 0 | } |
135 | | |
136 | | static void clear_buffer_stack(STACK_OF(X509_BUFFER) **buffer_stack) |
137 | 0 | { |
138 | 0 | sk_X509_BUFFER_pop_free(*buffer_stack, buffer_free); |
139 | 0 | *buffer_stack = NULL; |
140 | 0 | } |
141 | | |
142 | | static int add_bytes_to_buffer_stack(STACK_OF(X509_BUFFER) **buffer_stack, |
143 | | const uint8_t *name, size_t name_len) |
144 | 0 | { |
145 | 0 | STACK_OF(X509_BUFFER) *tmp_stack = NULL; |
146 | 0 | X509_BUFFER *copy = NULL; |
147 | 0 | int ret = 0; |
148 | |
|
149 | 0 | if ((copy = buffer_from_bytes(name, name_len)) == NULL) |
150 | 0 | goto err; |
151 | | |
152 | 0 | tmp_stack = *buffer_stack; |
153 | 0 | if (tmp_stack == NULL && (tmp_stack = sk_X509_BUFFER_new(buffer_cmp)) == NULL) |
154 | 0 | goto err; |
155 | | |
156 | 0 | if (!sk_X509_BUFFER_push(tmp_stack, copy)) |
157 | 0 | goto err; |
158 | | |
159 | 0 | ret = 1; |
160 | 0 | copy = NULL; |
161 | 0 | *buffer_stack = tmp_stack; |
162 | 0 | tmp_stack = NULL; |
163 | |
|
164 | 0 | err: |
165 | 0 | sk_X509_BUFFER_pop_free(tmp_stack, buffer_free); |
166 | 0 | buffer_free(copy); |
167 | |
|
168 | 0 | return ret; |
169 | 0 | } |
170 | | |
171 | | static int add_string_to_buffer_stack(STACK_OF(X509_BUFFER) **buffer_stack, |
172 | | const uint8_t *name, size_t name_len) |
173 | 0 | { |
174 | 0 | STACK_OF(X509_BUFFER) *tmp_stack = NULL; |
175 | 0 | X509_BUFFER *copy = NULL; |
176 | 0 | int ret = 0; |
177 | |
|
178 | 0 | if ((copy = buffer_from_string(name, name_len)) == NULL) |
179 | 0 | goto err; |
180 | | |
181 | 0 | tmp_stack = *buffer_stack; |
182 | 0 | if (tmp_stack == NULL && (tmp_stack = sk_X509_BUFFER_new(buffer_cmp)) == NULL) |
183 | 0 | goto err; |
184 | | |
185 | 0 | if (!sk_X509_BUFFER_push(tmp_stack, copy)) |
186 | 0 | goto err; |
187 | | |
188 | 0 | ret = 1; |
189 | 0 | copy = NULL; |
190 | 0 | *buffer_stack = tmp_stack; |
191 | 0 | tmp_stack = NULL; |
192 | |
|
193 | 0 | err: |
194 | 0 | sk_X509_BUFFER_pop_free(tmp_stack, buffer_free); |
195 | 0 | buffer_free(copy); |
196 | |
|
197 | 0 | return ret; |
198 | 0 | } |
199 | | |
200 | | static int validate_string_name(const char *name, size_t *name_len) |
201 | 0 | { |
202 | 0 | size_t len = *name_len; |
203 | |
|
204 | 0 | if (name == NULL || len == 0) |
205 | 0 | return 0; |
206 | | |
207 | | /* |
208 | | * Accept the trailing \0 byte if this is a C string. This is to |
209 | | * preserver behaviour that is traditional for the |
210 | | * set1_[host|email] functions. |
211 | | */ |
212 | 0 | if (name[len - 1] == '\0') |
213 | 0 | len--; |
214 | | |
215 | | /* Refuse the empty string */ |
216 | 0 | if (len == 0) |
217 | 0 | return 0; |
218 | | |
219 | | /* Refuse values with embedded \0 bytes other than at the end */ |
220 | 0 | if (memchr(name, '\0', len) != NULL) |
221 | 0 | return 0; |
222 | | |
223 | 0 | *name_len = len; |
224 | 0 | return 1; |
225 | 0 | } |
226 | | |
227 | | /* |
228 | | * Default input validation for verification parameter names. As these |
229 | | * could potentially come from untrusted input, doing basic input |
230 | | * validation makes sense, and ensures that subsequent parsing or |
231 | | * comparisons do not need to handle extreme out of range input. |
232 | | */ |
233 | | |
234 | | /* Default ip name input validation */ |
235 | | static int validate_ip_name(const uint8_t *name, size_t len) |
236 | 0 | { |
237 | 0 | if (name != NULL && (len == 4 || len == 16)) |
238 | 0 | return 1; |
239 | 0 | return 0; |
240 | 0 | } |
241 | | |
242 | | static ossl_charset_t ossl_name_charset(int c, ossl_charset_t charset) |
243 | 0 | { |
244 | 0 | if (ossl_isalnum(c)) |
245 | 0 | return 1; |
246 | 0 | if (ossl_isascii(c)) |
247 | 0 | return charset == OSSL_CHARSET_ASCII |
248 | 0 | || charset == OSSL_CHARSET_NONASCII; |
249 | 0 | return charset == OSSL_CHARSET_NONASCII; |
250 | 0 | } |
251 | | |
252 | | static int is_label_ok(int c, ossl_charset_t charset) |
253 | 0 | { |
254 | 0 | if (!ossl_name_charset(c, charset) && c != '_') |
255 | 0 | return 0; |
256 | 0 | else |
257 | 0 | return c != '.' && c != '-'; |
258 | 0 | } |
259 | | |
260 | | /* Default host name input validation */ |
261 | | static int validate_hostname_part(const char *name, size_t len, |
262 | | ossl_charset_t charset) |
263 | 0 | { |
264 | 0 | size_t i, part_len; |
265 | 0 | char c, prev; |
266 | |
|
267 | 0 | if (len < 2 || len > 256) |
268 | 0 | return 0; |
269 | | |
270 | 0 | part_len = 0; |
271 | 0 | prev = '\0'; |
272 | 0 | for (i = 0; i < len; i++) { |
273 | 0 | c = name[i]; |
274 | 0 | if (c == '.') { |
275 | | /* |
276 | | * Can not start a label with a . |
277 | | * unless it is the very first character. |
278 | | */ |
279 | 0 | if (part_len == 0 && i != 0) |
280 | 0 | return 0; |
281 | | /* Can not end a label with a - */ |
282 | 0 | if (prev == '-') |
283 | 0 | return 0; |
284 | 0 | part_len = 0; |
285 | 0 | } else { |
286 | | /* Can not start a label with a - */ |
287 | 0 | if (part_len == 0 && c == '-') { |
288 | 0 | return 0; |
289 | 0 | } |
290 | 0 | if (!is_label_ok(c, charset) && c != '-') |
291 | 0 | return 0; |
292 | 0 | part_len++; |
293 | 0 | } |
294 | 0 | if (part_len > 63) |
295 | 0 | return 0; |
296 | | |
297 | 0 | prev = c; |
298 | 0 | } |
299 | | /* Can not end with a . or a _ */ |
300 | 0 | if (prev == '.' || prev == '-') |
301 | 0 | return 0; |
302 | | |
303 | 0 | return 1; |
304 | 0 | } |
305 | | |
306 | | static int validate_local_part(const char *name, size_t len, |
307 | | ossl_charset_t *out_charset) |
308 | 0 | { |
309 | 0 | ossl_charset_t charset = OSSL_CHARSET_ASCII; |
310 | 0 | size_t i; |
311 | |
|
312 | 0 | for (i = 0; i < len; i++) { |
313 | 0 | if (name[i] == '\0') |
314 | 0 | return 0; |
315 | 0 | if (!ossl_isascii(name[i])) |
316 | 0 | charset = OSSL_CHARSET_NONASCII; |
317 | 0 | } |
318 | | |
319 | 0 | *out_charset = charset; |
320 | 0 | return 1; |
321 | 0 | } |
322 | | |
323 | | /* Default email name input validation */ |
324 | | static int validate_email_name(const char *name, size_t len, int rfc822) |
325 | 0 | { |
326 | 0 | size_t dns_len, local_len; |
327 | 0 | const char *at, *next, *dnsname; |
328 | 0 | ossl_charset_t local_charset; |
329 | | |
330 | | /* |
331 | | * 64 for local part, 1 for @, 255 for domain name |
332 | | */ |
333 | 0 | if (len > 320) |
334 | 0 | goto err; |
335 | | |
336 | | /* Reject it if there is no @ */ |
337 | 0 | if ((at = memchr(name, '@', len)) == NULL) |
338 | 0 | goto err; |
339 | | |
340 | | /* Go to the last @ */ |
341 | 0 | while ((next = memchr(at + 1, '@', len - (at - name + 1))) != NULL) |
342 | 0 | at = next; |
343 | | |
344 | | /* Ensure the local part is not oversize */ |
345 | 0 | local_len = at - name; |
346 | 0 | if (local_len > 64) |
347 | 0 | goto err; |
348 | | |
349 | 0 | if (!validate_local_part(name, local_len, &local_charset)) |
350 | 0 | goto err; |
351 | | |
352 | 0 | if (rfc822 && local_charset == OSSL_CHARSET_NONASCII) |
353 | 0 | goto err; |
354 | | |
355 | 0 | if (!rfc822 && local_charset == OSSL_CHARSET_ASCII) |
356 | 0 | goto err; |
357 | | |
358 | | /* What is after the @ must be valid as a dns name */ |
359 | 0 | dnsname = at + 1; |
360 | 0 | dns_len = len - local_len - 1; |
361 | |
|
362 | 0 | if (rfc822) |
363 | 0 | return validate_hostname_part(dnsname, dns_len, OSSL_CHARSET_ASCII_ALNUM); |
364 | | |
365 | 0 | return validate_hostname_part(dnsname, dns_len, OSSL_CHARSET_NONASCII); |
366 | | |
367 | 0 | err: |
368 | 0 | ERR_raise(ERR_LIB_X509, ERR_R_PASSED_INVALID_ARGUMENT); |
369 | 0 | return 0; |
370 | 0 | } |
371 | | |
372 | | X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) |
373 | 0 | { |
374 | 0 | X509_VERIFY_PARAM *param; |
375 | |
|
376 | 0 | param = OPENSSL_zalloc(sizeof(*param)); |
377 | 0 | if (param == NULL) |
378 | 0 | return NULL; |
379 | 0 | param->trust = X509_TRUST_DEFAULT; |
380 | | /* param->inh_flags = X509_VP_FLAG_DEFAULT; */ |
381 | 0 | param->depth = -1; |
382 | 0 | param->auth_level = -1; /* -1 means unset, 0 is explicit */ |
383 | 0 | return param; |
384 | 0 | } |
385 | | |
386 | | void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) |
387 | 0 | { |
388 | 0 | if (param == NULL) |
389 | 0 | return; |
390 | 0 | sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); |
391 | 0 | clear_buffer_stack(¶m->hosts); |
392 | 0 | clear_buffer_stack(¶m->ips); |
393 | 0 | clear_buffer_stack(¶m->rfc822s); |
394 | 0 | clear_buffer_stack(¶m->smtputf8s); |
395 | 0 | OPENSSL_free(param->peername); |
396 | 0 | OPENSSL_free(param); |
397 | 0 | } |
398 | | |
399 | | /*- |
400 | | * This function determines how parameters are "inherited" from one structure |
401 | | * to another. There are several different ways this can happen. |
402 | | * |
403 | | * 1. If a child structure needs to have its values initialized from a parent |
404 | | * they are simply copied across. For example SSL_CTX copied to SSL. |
405 | | * 2. If the structure should take on values only if they are currently unset. |
406 | | * For example the values in an SSL structure will take appropriate value |
407 | | * for SSL servers or clients but only if the application has not set new |
408 | | * ones. |
409 | | * |
410 | | * The "inh_flags" field determines how this function behaves. |
411 | | * |
412 | | * Normally any values which are set in the default are not copied from the |
413 | | * destination and verify flags are ORed together. |
414 | | * |
415 | | * If X509_VP_FLAG_DEFAULT is set then anything set in the source is copied |
416 | | * to the destination. Effectively the values in "to" become default values |
417 | | * which will be used only if nothing new is set in "from". |
418 | | * |
419 | | * If X509_VP_FLAG_OVERWRITE is set then all value are copied across whether |
420 | | * they are set or not. Flags is still Ored though. |
421 | | * |
422 | | * If X509_VP_FLAG_RESET_FLAGS is set then the flags value is copied instead |
423 | | * of ORed. |
424 | | * |
425 | | * If X509_VP_FLAG_LOCKED is set then no values are copied. |
426 | | * |
427 | | * If X509_VP_FLAG_ONCE is set then the current inh_flags setting is zeroed |
428 | | * after the next call. |
429 | | */ |
430 | | |
431 | | /* Macro to test if a field should be copied from src to dest */ |
432 | | |
433 | | #define test_x509_verify_param_copy(field, def) \ |
434 | 0 | (to_overwrite || (src->field != def && (to_default || dest->field == def))) |
435 | | |
436 | | /* Macro to test and copy a field if necessary */ |
437 | | |
438 | | #define x509_verify_param_copy(field, def) \ |
439 | 0 | if (test_x509_verify_param_copy(field, def)) \ |
440 | 0 | dest->field = src->field; |
441 | | |
442 | | int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest, |
443 | | const X509_VERIFY_PARAM *src) |
444 | 0 | { |
445 | 0 | unsigned long inh_flags; |
446 | 0 | int to_default, to_overwrite; |
447 | |
|
448 | 0 | if (src == NULL) |
449 | 0 | return 1; |
450 | 0 | inh_flags = dest->inh_flags | src->inh_flags; |
451 | |
|
452 | 0 | if ((inh_flags & X509_VP_FLAG_ONCE) != 0) |
453 | 0 | dest->inh_flags = 0; |
454 | |
|
455 | 0 | if ((inh_flags & X509_VP_FLAG_LOCKED) != 0) |
456 | 0 | return 1; |
457 | | |
458 | 0 | to_default = (inh_flags & X509_VP_FLAG_DEFAULT) != 0; |
459 | 0 | to_overwrite = (inh_flags & X509_VP_FLAG_OVERWRITE) != 0; |
460 | |
|
461 | 0 | x509_verify_param_copy(purpose, 0); |
462 | 0 | x509_verify_param_copy(trust, X509_TRUST_DEFAULT); |
463 | 0 | x509_verify_param_copy(depth, -1); |
464 | 0 | x509_verify_param_copy(auth_level, -1); |
465 | | |
466 | | /* If overwrite or check time not set, copy across */ |
467 | |
|
468 | 0 | if (to_overwrite || (dest->flags & X509_V_FLAG_USE_CHECK_TIME) == 0) { |
469 | 0 | dest->check_time = src->check_time; |
470 | 0 | dest->flags &= ~X509_V_FLAG_USE_CHECK_TIME; |
471 | | /* Don't need to copy flag: that is done below */ |
472 | 0 | } |
473 | |
|
474 | 0 | if ((inh_flags & X509_VP_FLAG_RESET_FLAGS) != 0) |
475 | 0 | dest->flags = 0; |
476 | |
|
477 | 0 | dest->flags |= src->flags; |
478 | |
|
479 | 0 | if (test_x509_verify_param_copy(policies, NULL)) { |
480 | 0 | if (!X509_VERIFY_PARAM_set1_policies(dest, src->policies)) |
481 | 0 | return 0; |
482 | 0 | } |
483 | | |
484 | 0 | x509_verify_param_copy(hostflags, 0); |
485 | |
|
486 | 0 | if (test_x509_verify_param_copy(hosts, NULL)) { |
487 | 0 | if (!replace_buffer_stack_string(&dest->hosts, &src->hosts)) |
488 | 0 | return 0; |
489 | 0 | } |
490 | 0 | x509_verify_param_copy(validate_host, NULL); |
491 | |
|
492 | 0 | if (test_x509_verify_param_copy(ips, NULL)) { |
493 | 0 | if (!replace_buffer_stack_bytes(&dest->ips, &src->ips)) |
494 | 0 | return 0; |
495 | 0 | } |
496 | 0 | x509_verify_param_copy(validate_ip, NULL); |
497 | |
|
498 | 0 | if (test_x509_verify_param_copy(rfc822s, NULL)) { |
499 | 0 | if (!replace_buffer_stack_string(&dest->rfc822s, &src->rfc822s)) |
500 | 0 | return 0; |
501 | 0 | } |
502 | 0 | x509_verify_param_copy(validate_rfc822, NULL); |
503 | |
|
504 | 0 | if (test_x509_verify_param_copy(smtputf8s, NULL)) { |
505 | 0 | if (!replace_buffer_stack_string(&dest->smtputf8s, &src->smtputf8s)) |
506 | 0 | return 0; |
507 | 0 | } |
508 | 0 | x509_verify_param_copy(validate_smtputf8, NULL); |
509 | |
|
510 | 0 | return 1; |
511 | 0 | } |
512 | | |
513 | | int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, |
514 | | const X509_VERIFY_PARAM *from) |
515 | 0 | { |
516 | 0 | unsigned long save_flags; |
517 | 0 | int ret; |
518 | |
|
519 | 0 | if (to == NULL) { |
520 | 0 | ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER); |
521 | 0 | return 0; |
522 | 0 | } |
523 | 0 | save_flags = to->inh_flags; |
524 | 0 | to->inh_flags |= X509_VP_FLAG_DEFAULT; |
525 | 0 | ret = X509_VERIFY_PARAM_inherit(to, from); |
526 | 0 | to->inh_flags = save_flags; |
527 | 0 | return ret; |
528 | 0 | } |
529 | | |
530 | | int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) |
531 | 0 | { |
532 | 0 | OPENSSL_free(param->name); |
533 | 0 | param->name = OPENSSL_strdup(name); |
534 | 0 | return param->name != NULL; |
535 | 0 | } |
536 | | |
537 | | int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags) |
538 | 0 | { |
539 | 0 | param->flags |= flags; |
540 | 0 | if ((flags & X509_V_FLAG_POLICY_MASK) != 0) |
541 | 0 | param->flags |= X509_V_FLAG_POLICY_CHECK; |
542 | 0 | return 1; |
543 | 0 | } |
544 | | |
545 | | int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, |
546 | | unsigned long flags) |
547 | 0 | { |
548 | 0 | param->flags &= ~flags; |
549 | 0 | return 1; |
550 | 0 | } |
551 | | |
552 | | unsigned long X509_VERIFY_PARAM_get_flags(const X509_VERIFY_PARAM *param) |
553 | 0 | { |
554 | 0 | return param->flags; |
555 | 0 | } |
556 | | |
557 | | uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param) |
558 | 0 | { |
559 | 0 | return param->inh_flags; |
560 | 0 | } |
561 | | |
562 | | int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, uint32_t flags) |
563 | 0 | { |
564 | 0 | param->inh_flags = flags; |
565 | 0 | return 1; |
566 | 0 | } |
567 | | |
568 | | /* resets to default (any) purpose if |purpose| == X509_PURPOSE_DEFAULT_ANY */ |
569 | | int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose) |
570 | 0 | { |
571 | 0 | return X509_PURPOSE_set(¶m->purpose, purpose); |
572 | 0 | } |
573 | | |
574 | | int X509_VERIFY_PARAM_get_purpose(const X509_VERIFY_PARAM *param) |
575 | 0 | { |
576 | 0 | return param->purpose; |
577 | 0 | } |
578 | | |
579 | | int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust) |
580 | 0 | { |
581 | 0 | return X509_TRUST_set(¶m->trust, trust); |
582 | 0 | } |
583 | | |
584 | | void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth) |
585 | 0 | { |
586 | 0 | param->depth = depth; |
587 | 0 | } |
588 | | |
589 | | void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level) |
590 | 0 | { |
591 | 0 | param->auth_level = auth_level; |
592 | 0 | } |
593 | | |
594 | | time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param) |
595 | 0 | { |
596 | | /* This will be in the time_t range, because the only setter uses time_t */ |
597 | 0 | return (time_t)param->check_time; |
598 | 0 | } |
599 | | |
600 | | void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t) |
601 | 0 | { |
602 | 0 | param->check_time = (int64_t)t; |
603 | 0 | param->flags |= X509_V_FLAG_USE_CHECK_TIME; |
604 | 0 | } |
605 | | |
606 | | void ossl_x509_verify_param_set_time_posix(X509_VERIFY_PARAM *param, int64_t t) |
607 | 0 | { |
608 | 0 | param->check_time = t; |
609 | 0 | param->flags |= X509_V_FLAG_USE_CHECK_TIME; |
610 | 0 | } |
611 | | |
612 | | int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, |
613 | | ASN1_OBJECT *policy) |
614 | 0 | { |
615 | 0 | if (param->policies == NULL) { |
616 | 0 | param->policies = sk_ASN1_OBJECT_new_null(); |
617 | 0 | if (param->policies == NULL) |
618 | 0 | return 0; |
619 | 0 | } |
620 | | |
621 | 0 | if (sk_ASN1_OBJECT_push(param->policies, policy) <= 0) |
622 | 0 | return 0; |
623 | 0 | return 1; |
624 | 0 | } |
625 | | |
626 | | int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, |
627 | | STACK_OF(ASN1_OBJECT) *policies) |
628 | 0 | { |
629 | 0 | int i; |
630 | 0 | ASN1_OBJECT *oid, *doid; |
631 | |
|
632 | 0 | if (param == NULL) { |
633 | 0 | ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER); |
634 | 0 | return 0; |
635 | 0 | } |
636 | 0 | sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); |
637 | |
|
638 | 0 | if (policies == NULL) { |
639 | 0 | param->policies = NULL; |
640 | 0 | return 1; |
641 | 0 | } |
642 | | |
643 | 0 | param->policies = sk_ASN1_OBJECT_new_null(); |
644 | 0 | if (param->policies == NULL) |
645 | 0 | return 0; |
646 | | |
647 | 0 | for (i = 0; i < sk_ASN1_OBJECT_num(policies); i++) { |
648 | 0 | oid = sk_ASN1_OBJECT_value(policies, i); |
649 | 0 | doid = OBJ_dup(oid); |
650 | 0 | if (doid == NULL) |
651 | 0 | return 0; |
652 | 0 | if (!sk_ASN1_OBJECT_push(param->policies, doid)) { |
653 | 0 | ASN1_OBJECT_free(doid); |
654 | 0 | return 0; |
655 | 0 | } |
656 | 0 | } |
657 | 0 | param->flags |= X509_V_FLAG_POLICY_CHECK; |
658 | 0 | return 1; |
659 | 0 | } |
660 | | |
661 | | char *X509_VERIFY_PARAM_get0_host(X509_VERIFY_PARAM *param, int idx) |
662 | 0 | { |
663 | 0 | X509_BUFFER *buf = sk_X509_BUFFER_value(param->hosts, idx); |
664 | |
|
665 | 0 | return (buf != NULL) ? (char *)buf->data : NULL; |
666 | 0 | } |
667 | | |
668 | | int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, |
669 | | const char *dnsname, size_t len) |
670 | 0 | { |
671 | 0 | clear_buffer_stack(¶m->hosts); |
672 | 0 | if (dnsname == NULL) |
673 | 0 | return 1; |
674 | 0 | if (len == 0) |
675 | 0 | len = strlen(dnsname); |
676 | 0 | if (len == 0) |
677 | 0 | return 1; |
678 | 0 | return X509_VERIFY_PARAM_add1_host(param, dnsname, len); |
679 | 0 | } |
680 | | |
681 | | int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, |
682 | | const char *dnsname, size_t len) |
683 | 0 | { |
684 | 0 | if (dnsname == NULL) |
685 | 0 | return 1; |
686 | 0 | if (len == 0) |
687 | 0 | len = strlen(dnsname); |
688 | 0 | if (len == 0) |
689 | 0 | return 1; |
690 | 0 | if (!validate_string_name(dnsname, &len)) |
691 | 0 | return 0; |
692 | 0 | if (param->validate_host != NULL) { |
693 | 0 | if (!param->validate_host(dnsname, len)) |
694 | 0 | return 0; |
695 | 0 | } else { |
696 | 0 | if (!validate_hostname_part(dnsname, len, OSSL_CHARSET_ASCII_ALNUM)) |
697 | 0 | return 0; |
698 | 0 | } |
699 | 0 | return add_string_to_buffer_stack(¶m->hosts, (const uint8_t *)dnsname, len); |
700 | 0 | } |
701 | | |
702 | | void X509_VERIFY_PARAM_set1_host_input_validation(X509_VERIFY_PARAM *param, |
703 | | int (*validate_host)(const char *name, size_t len)) |
704 | 0 | { |
705 | 0 | param->validate_host = validate_host; |
706 | 0 | } |
707 | | |
708 | | int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, |
709 | | const uint8_t *ip, size_t len) |
710 | 0 | { |
711 | 0 | clear_buffer_stack(¶m->ips); |
712 | 0 | if (ip == NULL) |
713 | 0 | return 1; |
714 | 0 | return X509_VERIFY_PARAM_add1_ip(param, ip, len); |
715 | 0 | } |
716 | | |
717 | | int X509_VERIFY_PARAM_add1_ip(X509_VERIFY_PARAM *param, |
718 | | const uint8_t *ip, size_t len) |
719 | 0 | { |
720 | 0 | if (param->validate_ip != NULL) { |
721 | 0 | if (!param->validate_ip(ip, len)) |
722 | 0 | return 0; |
723 | 0 | } else { |
724 | 0 | if (!validate_ip_name(ip, len)) |
725 | 0 | return 0; |
726 | 0 | } |
727 | 0 | return add_bytes_to_buffer_stack(¶m->ips, ip, len); |
728 | 0 | } |
729 | | |
730 | | void X509_VERIFY_PARAM_set1_ip_input_validation(X509_VERIFY_PARAM *param, |
731 | | int (*validate_ip)(const uint8_t *name, size_t len)) |
732 | 0 | { |
733 | 0 | param->validate_ip = validate_ip; |
734 | 0 | } |
735 | | |
736 | | char *X509_VERIFY_PARAM_get0_email(X509_VERIFY_PARAM *param) |
737 | 0 | { |
738 | 0 | X509_BUFFER *buf = sk_X509_BUFFER_value(param->rfc822s, 0); |
739 | |
|
740 | 0 | if ((buf = sk_X509_BUFFER_value(param->rfc822s, 0)) != NULL |
741 | 0 | || (buf = sk_X509_BUFFER_value(param->smtputf8s, 0)) != NULL) |
742 | 0 | return (char *)buf->data; |
743 | | |
744 | 0 | return NULL; |
745 | 0 | } |
746 | | |
747 | | int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, |
748 | | const char *email, size_t len) |
749 | 0 | { |
750 | 0 | int ret = 0; |
751 | |
|
752 | 0 | if (X509_VERIFY_PARAM_set1_smtputf8(param, email, len)) |
753 | 0 | ret = 1; |
754 | 0 | if (X509_VERIFY_PARAM_set1_rfc822(param, email, len)) |
755 | 0 | ret = 1; |
756 | |
|
757 | 0 | return ret; |
758 | 0 | } |
759 | | |
760 | | int X509_VERIFY_PARAM_set1_smtputf8(X509_VERIFY_PARAM *param, |
761 | | const char *email, size_t len) |
762 | 0 | { |
763 | 0 | clear_buffer_stack(¶m->smtputf8s); |
764 | 0 | if (email == NULL) |
765 | 0 | return 1; |
766 | 0 | return X509_VERIFY_PARAM_add1_smtputf8(param, email, len); |
767 | 0 | } |
768 | | |
769 | | int X509_VERIFY_PARAM_add1_smtputf8(X509_VERIFY_PARAM *param, |
770 | | const char *email, size_t len) |
771 | 0 | { |
772 | 0 | if (len == 0) |
773 | 0 | len = strlen(email); |
774 | 0 | if (!validate_string_name(email, &len)) |
775 | 0 | return 0; |
776 | 0 | if (param->validate_smtputf8 != NULL) { |
777 | 0 | if (!param->validate_smtputf8(email, len)) |
778 | 0 | return 0; |
779 | 0 | } else { |
780 | 0 | if (!validate_email_name(email, len, /*rfc822 =*/0)) |
781 | 0 | return 0; |
782 | 0 | } |
783 | | |
784 | 0 | return add_string_to_buffer_stack(¶m->smtputf8s, |
785 | 0 | (const uint8_t *)email, len); |
786 | 0 | } |
787 | | |
788 | | void X509_VERIFY_PARAM_set1_smtputf8_input_validation(X509_VERIFY_PARAM *param, |
789 | | int (*validate_smtputf8)(const char *name, size_t len)) |
790 | 0 | { |
791 | 0 | param->validate_smtputf8 = validate_smtputf8; |
792 | 0 | } |
793 | | |
794 | | int X509_VERIFY_PARAM_set1_rfc822(X509_VERIFY_PARAM *param, |
795 | | const char *email, size_t len) |
796 | 0 | { |
797 | 0 | clear_buffer_stack(¶m->rfc822s); |
798 | 0 | if (email == NULL) |
799 | 0 | return 1; |
800 | 0 | return X509_VERIFY_PARAM_add1_rfc822(param, email, len); |
801 | 0 | } |
802 | | |
803 | | int X509_VERIFY_PARAM_add1_rfc822(X509_VERIFY_PARAM *param, |
804 | | const char *email, size_t len) |
805 | 0 | { |
806 | 0 | if (len == 0) |
807 | 0 | len = strlen(email); |
808 | 0 | if (!validate_string_name(email, &len)) |
809 | 0 | return 0; |
810 | 0 | if (param->validate_rfc822 != NULL) { |
811 | 0 | if (!param->validate_rfc822(email, len)) |
812 | 0 | return 0; |
813 | 0 | } else { |
814 | 0 | if (!validate_email_name(email, len, /*rfc822 =*/1)) |
815 | 0 | return 0; |
816 | 0 | } |
817 | | |
818 | 0 | return add_string_to_buffer_stack(¶m->rfc822s, |
819 | 0 | (const uint8_t *)email, len); |
820 | 0 | } |
821 | | |
822 | | void X509_VERIFY_PARAM_set1_rfc822_input_validation(X509_VERIFY_PARAM *param, |
823 | | int (*validate_rfc822)(const char *name, size_t len)) |
824 | 0 | { |
825 | 0 | param->validate_rfc822 = validate_rfc822; |
826 | 0 | } |
827 | | |
828 | | void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, |
829 | | unsigned int flags) |
830 | 0 | { |
831 | 0 | param->hostflags = flags; |
832 | 0 | } |
833 | | |
834 | | unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param) |
835 | 0 | { |
836 | 0 | return param->hostflags; |
837 | 0 | } |
838 | | |
839 | | char *X509_VERIFY_PARAM_get0_peername(const X509_VERIFY_PARAM *param) |
840 | 0 | { |
841 | 0 | return param->peername; |
842 | 0 | } |
843 | | |
844 | | /* |
845 | | * Move peername from one param structure to another, freeing any name present |
846 | | * at the target. If the source is a NULL parameter structure, free and zero |
847 | | * the target peername. |
848 | | */ |
849 | | void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *to, |
850 | | X509_VERIFY_PARAM *from) |
851 | 0 | { |
852 | 0 | char *peername = (from != NULL) ? from->peername : NULL; |
853 | |
|
854 | 0 | if (to->peername != peername) { |
855 | 0 | OPENSSL_free(to->peername); |
856 | 0 | to->peername = peername; |
857 | 0 | } |
858 | 0 | if (from != NULL) |
859 | 0 | from->peername = NULL; |
860 | 0 | } |
861 | | |
862 | | static const unsigned char *int_X509_VERIFY_PARAM_get0_ip(X509_VERIFY_PARAM *param, size_t *plen, size_t idx) |
863 | 0 | { |
864 | 0 | X509_BUFFER *buf; |
865 | |
|
866 | 0 | if (idx > INT_MAX) |
867 | 0 | return NULL; |
868 | | |
869 | 0 | if (param == NULL || param->ips == NULL) { |
870 | 0 | ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER); |
871 | 0 | return NULL; |
872 | 0 | } |
873 | | |
874 | 0 | buf = sk_X509_BUFFER_value(param->ips, (int)idx); |
875 | |
|
876 | 0 | if (buf != NULL) { |
877 | 0 | if (plen != NULL) |
878 | 0 | *plen = buf->len; |
879 | 0 | return (unsigned char *)buf->data; |
880 | 0 | } |
881 | 0 | return NULL; |
882 | 0 | } |
883 | | |
884 | | char *X509_VERIFY_PARAM_get1_ip_asc(X509_VERIFY_PARAM *param) |
885 | 0 | { |
886 | 0 | size_t iplen; |
887 | 0 | const unsigned char *ip = int_X509_VERIFY_PARAM_get0_ip(param, &iplen, 0); |
888 | |
|
889 | 0 | return ip == NULL ? NULL : ossl_ipaddr_to_asc(ip, (int)iplen); |
890 | 0 | } |
891 | | |
892 | | int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc) |
893 | 0 | { |
894 | 0 | unsigned char ipout[16]; |
895 | 0 | size_t iplen; |
896 | |
|
897 | 0 | if (ipasc == NULL) |
898 | 0 | return X509_VERIFY_PARAM_set1_ip(param, NULL, 0); |
899 | 0 | if ((iplen = (size_t)ossl_a2i_ipadd(ipout, ipasc)) == 0) |
900 | 0 | return 0; |
901 | 0 | return X509_VERIFY_PARAM_set1_ip(param, ipout, iplen); |
902 | 0 | } |
903 | | |
904 | | int X509_VERIFY_PARAM_add1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc) |
905 | 0 | { |
906 | 0 | unsigned char ipout[16]; |
907 | 0 | size_t iplen; |
908 | |
|
909 | 0 | if ((iplen = (size_t)ossl_a2i_ipadd(ipout, ipasc)) == 0) |
910 | 0 | return 0; |
911 | 0 | return X509_VERIFY_PARAM_add1_ip(param, ipout, iplen); |
912 | 0 | } |
913 | | |
914 | | int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param) |
915 | 0 | { |
916 | 0 | return param->depth; |
917 | 0 | } |
918 | | |
919 | | int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param) |
920 | 0 | { |
921 | 0 | return param->auth_level; |
922 | 0 | } |
923 | | |
924 | | const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param) |
925 | 0 | { |
926 | 0 | return param->name; |
927 | 0 | } |
928 | | |
929 | | /* |
930 | | * Default verify parameters: these are used for various applications and can |
931 | | * be overridden by the user specified table. NB: the 'name' field *must* be |
932 | | * in alphabetical order because it will be searched using OBJ_search. |
933 | | */ |
934 | | |
935 | | static const X509_VERIFY_PARAM default_table[] = { |
936 | | { |
937 | | .name = "code_sign", /* Code sign parameters */ |
938 | | .purpose = X509_PURPOSE_CODE_SIGN, |
939 | | .trust = X509_TRUST_OBJECT_SIGN, |
940 | | .depth = -1, |
941 | | .auth_level = -1, |
942 | | }, |
943 | | { |
944 | | .name = "default", /* X509 default parameters */ |
945 | | .flags = X509_V_FLAG_TRUSTED_FIRST, |
946 | | .depth = 100, |
947 | | .auth_level = -1, |
948 | | }, |
949 | | { |
950 | | .name = "pkcs7", /* S/MIME sign parameters */ |
951 | | .purpose = X509_PURPOSE_SMIME_SIGN, |
952 | | .trust = X509_TRUST_EMAIL, |
953 | | .depth = -1, |
954 | | .auth_level = -1, |
955 | | }, |
956 | | { |
957 | | .name = "smime_encrypt", /* S/MIME encryption parameters */ |
958 | | .purpose = X509_PURPOSE_SMIME_ENCRYPT, |
959 | | .trust = X509_TRUST_EMAIL, |
960 | | .depth = -1, |
961 | | .auth_level = -1, |
962 | | }, |
963 | | { |
964 | | .name = "smime_sign", /* S/MIME signature parameters */ |
965 | | .purpose = X509_PURPOSE_SMIME_SIGN, |
966 | | .trust = X509_TRUST_EMAIL, |
967 | | .depth = -1, |
968 | | .auth_level = -1, |
969 | | }, |
970 | | { |
971 | | .name = "ssl_client", /* SSL/TLS client parameters */ |
972 | | .purpose = X509_PURPOSE_SSL_CLIENT, |
973 | | .trust = X509_TRUST_SSL_CLIENT, |
974 | | .depth = -1, |
975 | | .auth_level = -1, |
976 | | }, |
977 | | { |
978 | | .name = "ssl_server", /* SSL/TLS server parameters */ |
979 | | .purpose = X509_PURPOSE_SSL_SERVER, |
980 | | .trust = X509_TRUST_SSL_SERVER, |
981 | | .depth = -1, |
982 | | .auth_level = -1, |
983 | | } |
984 | | }; |
985 | | |
986 | | static STACK_OF(X509_VERIFY_PARAM) *param_table = NULL; |
987 | | |
988 | | static int table_cmp(const X509_VERIFY_PARAM *a, const X509_VERIFY_PARAM *b) |
989 | 0 | { |
990 | 0 | return strcmp(a->name, b->name); |
991 | 0 | } |
992 | | |
993 | | DECLARE_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM, table); |
994 | | IMPLEMENT_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM, table); |
995 | | |
996 | | static int param_cmp(const X509_VERIFY_PARAM *const *a, |
997 | | const X509_VERIFY_PARAM *const *b) |
998 | 0 | { |
999 | 0 | return strcmp((*a)->name, (*b)->name); |
1000 | 0 | } |
1001 | | |
1002 | | int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param) |
1003 | 0 | { |
1004 | 0 | int idx; |
1005 | 0 | X509_VERIFY_PARAM *ptmp; |
1006 | |
|
1007 | 0 | if (param_table == NULL) { |
1008 | 0 | param_table = sk_X509_VERIFY_PARAM_new(param_cmp); |
1009 | 0 | if (param_table == NULL) |
1010 | 0 | return 0; |
1011 | 0 | } else { |
1012 | 0 | idx = sk_X509_VERIFY_PARAM_find(param_table, param); |
1013 | 0 | if (idx >= 0) { |
1014 | 0 | ptmp = sk_X509_VERIFY_PARAM_delete(param_table, idx); |
1015 | 0 | X509_VERIFY_PARAM_free(ptmp); |
1016 | 0 | } |
1017 | 0 | } |
1018 | | |
1019 | 0 | if (sk_X509_VERIFY_PARAM_push(param_table, param) <= 0) |
1020 | 0 | return 0; |
1021 | 0 | return 1; |
1022 | 0 | } |
1023 | | |
1024 | | int X509_VERIFY_PARAM_get_count(void) |
1025 | 0 | { |
1026 | 0 | int num = OSSL_NELEM(default_table); |
1027 | |
|
1028 | 0 | if (param_table != NULL) |
1029 | 0 | num += sk_X509_VERIFY_PARAM_num(param_table); |
1030 | 0 | return num; |
1031 | 0 | } |
1032 | | |
1033 | | const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id) |
1034 | 0 | { |
1035 | 0 | int num = OSSL_NELEM(default_table); |
1036 | |
|
1037 | 0 | if (id < 0) { |
1038 | 0 | ERR_raise(ERR_LIB_X509, ERR_R_PASSED_INVALID_ARGUMENT); |
1039 | 0 | return NULL; |
1040 | 0 | } |
1041 | | |
1042 | 0 | if (id < num) |
1043 | 0 | return default_table + id; |
1044 | 0 | return sk_X509_VERIFY_PARAM_value(param_table, id - num); |
1045 | 0 | } |
1046 | | |
1047 | | const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name) |
1048 | 0 | { |
1049 | 0 | int idx; |
1050 | 0 | X509_VERIFY_PARAM pm; |
1051 | |
|
1052 | 0 | pm.name = (char *)name; |
1053 | 0 | if (param_table != NULL) { |
1054 | | /* Ideally, this would be done under a lock */ |
1055 | 0 | sk_X509_VERIFY_PARAM_sort(param_table); |
1056 | 0 | idx = sk_X509_VERIFY_PARAM_find(param_table, &pm); |
1057 | 0 | if (idx >= 0) |
1058 | 0 | return sk_X509_VERIFY_PARAM_value(param_table, idx); |
1059 | 0 | } |
1060 | 0 | return OBJ_bsearch_table(&pm, default_table, OSSL_NELEM(default_table)); |
1061 | 0 | } |
1062 | | |
1063 | | void X509_VERIFY_PARAM_table_cleanup(void) |
1064 | 0 | { |
1065 | 0 | sk_X509_VERIFY_PARAM_pop_free(param_table, X509_VERIFY_PARAM_free); |
1066 | | param_table = NULL; |
1067 | 0 | } |