You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

673 line
20 KiB

  1. /*
  2. * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
  3. * 2004.
  4. */
  5. /* ====================================================================
  6. * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. All advertising materials mentioning features or use of this
  21. * software must display the following acknowledgment:
  22. * "This product includes software developed by the OpenSSL Project
  23. * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  24. *
  25. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  26. * endorse or promote products derived from this software without
  27. * prior written permission. For written permission, please contact
  28. * licensing@OpenSSL.org.
  29. *
  30. * 5. Products derived from this software may not be called "OpenSSL"
  31. * nor may "OpenSSL" appear in their names without prior written
  32. * permission of the OpenSSL Project.
  33. *
  34. * 6. Redistributions of any form whatsoever must retain the following
  35. * acknowledgment:
  36. * "This product includes software developed by the OpenSSL Project
  37. * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  38. *
  39. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  40. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  41. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  42. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  43. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  44. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  45. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  46. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  48. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  49. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  50. * OF THE POSSIBILITY OF SUCH DAMAGE.
  51. * ====================================================================
  52. *
  53. * This product includes cryptographic software written by Eric Young
  54. * (eay@cryptsoft.com). This product includes software written by Tim
  55. * Hudson (tjh@cryptsoft.com). */
  56. #include <string.h>
  57. #include <openssl/buf.h>
  58. #include <openssl/mem.h>
  59. #include <openssl/obj.h>
  60. #include <openssl/stack.h>
  61. #include <openssl/x509.h>
  62. #include <openssl/x509v3.h>
  63. #include "vpm_int.h"
  64. #include "../internal.h"
  65. /* X509_VERIFY_PARAM functions */
  66. #define SET_HOST 0
  67. #define ADD_HOST 1
  68. static char *str_copy(char *s)
  69. {
  70. return OPENSSL_strdup(s);
  71. }
  72. static void str_free(char *s)
  73. {
  74. OPENSSL_free(s);
  75. }
  76. #define string_stack_free(sk) sk_OPENSSL_STRING_pop_free(sk, str_free)
  77. static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
  78. const char *name, size_t namelen)
  79. {
  80. char *copy;
  81. if (name == NULL || namelen == 0) {
  82. // Unlike OpenSSL, we reject trying to set or add an empty name.
  83. return 0;
  84. }
  85. /*
  86. * Refuse names with embedded NUL bytes.
  87. * XXX: Do we need to push an error onto the error stack?
  88. */
  89. if (name && OPENSSL_memchr(name, '\0', namelen))
  90. return 0;
  91. if (mode == SET_HOST && id->hosts) {
  92. string_stack_free(id->hosts);
  93. id->hosts = NULL;
  94. }
  95. copy = BUF_strndup(name, namelen);
  96. if (copy == NULL)
  97. return 0;
  98. if (id->hosts == NULL &&
  99. (id->hosts = sk_OPENSSL_STRING_new_null()) == NULL) {
  100. OPENSSL_free(copy);
  101. return 0;
  102. }
  103. if (!sk_OPENSSL_STRING_push(id->hosts, copy)) {
  104. OPENSSL_free(copy);
  105. if (sk_OPENSSL_STRING_num(id->hosts) == 0) {
  106. sk_OPENSSL_STRING_free(id->hosts);
  107. id->hosts = NULL;
  108. }
  109. return 0;
  110. }
  111. return 1;
  112. }
  113. static void x509_verify_param_zero(X509_VERIFY_PARAM *param)
  114. {
  115. X509_VERIFY_PARAM_ID *paramid;
  116. if (!param)
  117. return;
  118. param->name = NULL;
  119. param->purpose = 0;
  120. param->trust = 0;
  121. /*
  122. * param->inh_flags = X509_VP_FLAG_DEFAULT;
  123. */
  124. param->inh_flags = 0;
  125. param->flags = 0;
  126. param->depth = -1;
  127. if (param->policies) {
  128. sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
  129. param->policies = NULL;
  130. }
  131. paramid = param->id;
  132. if (paramid->hosts) {
  133. string_stack_free(paramid->hosts);
  134. paramid->hosts = NULL;
  135. }
  136. if (paramid->peername) {
  137. OPENSSL_free(paramid->peername);
  138. paramid->peername = NULL;
  139. }
  140. if (paramid->email) {
  141. OPENSSL_free(paramid->email);
  142. paramid->email = NULL;
  143. paramid->emaillen = 0;
  144. }
  145. if (paramid->ip) {
  146. OPENSSL_free(paramid->ip);
  147. paramid->ip = NULL;
  148. paramid->iplen = 0;
  149. }
  150. paramid->poison = 0;
  151. }
  152. X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
  153. {
  154. X509_VERIFY_PARAM *param;
  155. X509_VERIFY_PARAM_ID *paramid;
  156. param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
  157. if (!param)
  158. return NULL;
  159. paramid = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM_ID));
  160. if (!paramid) {
  161. OPENSSL_free(param);
  162. return NULL;
  163. }
  164. OPENSSL_memset(param, 0, sizeof(X509_VERIFY_PARAM));
  165. OPENSSL_memset(paramid, 0, sizeof(X509_VERIFY_PARAM_ID));
  166. param->id = paramid;
  167. x509_verify_param_zero(param);
  168. return param;
  169. }
  170. void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
  171. {
  172. if (param == NULL)
  173. return;
  174. x509_verify_param_zero(param);
  175. OPENSSL_free(param->id);
  176. OPENSSL_free(param);
  177. }
  178. /*-
  179. * This function determines how parameters are "inherited" from one structure
  180. * to another. There are several different ways this can happen.
  181. *
  182. * 1. If a child structure needs to have its values initialized from a parent
  183. * they are simply copied across. For example SSL_CTX copied to SSL.
  184. * 2. If the structure should take on values only if they are currently unset.
  185. * For example the values in an SSL structure will take appropriate value
  186. * for SSL servers or clients but only if the application has not set new
  187. * ones.
  188. *
  189. * The "inh_flags" field determines how this function behaves.
  190. *
  191. * Normally any values which are set in the default are not copied from the
  192. * destination and verify flags are ORed together.
  193. *
  194. * If X509_VP_FLAG_DEFAULT is set then anything set in the source is copied
  195. * to the destination. Effectively the values in "to" become default values
  196. * which will be used only if nothing new is set in "from".
  197. *
  198. * If X509_VP_FLAG_OVERWRITE is set then all value are copied across whether
  199. * they are set or not. Flags is still Ored though.
  200. *
  201. * If X509_VP_FLAG_RESET_FLAGS is set then the flags value is copied instead
  202. * of ORed.
  203. *
  204. * If X509_VP_FLAG_LOCKED is set then no values are copied.
  205. *
  206. * If X509_VP_FLAG_ONCE is set then the current inh_flags setting is zeroed
  207. * after the next call.
  208. */
  209. /* Macro to test if a field should be copied from src to dest */
  210. #define test_x509_verify_param_copy(field, def) \
  211. (to_overwrite || \
  212. ((src->field != (def)) && (to_default || (dest->field == (def)))))
  213. /* As above but for ID fields */
  214. #define test_x509_verify_param_copy_id(idf, def) \
  215. test_x509_verify_param_copy(id->idf, def)
  216. /* Macro to test and copy a field if necessary */
  217. #define x509_verify_param_copy(field, def) \
  218. if (test_x509_verify_param_copy(field, def)) \
  219. dest->field = src->field
  220. int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
  221. const X509_VERIFY_PARAM *src)
  222. {
  223. unsigned long inh_flags;
  224. int to_default, to_overwrite;
  225. X509_VERIFY_PARAM_ID *id;
  226. if (!src)
  227. return 1;
  228. id = src->id;
  229. inh_flags = dest->inh_flags | src->inh_flags;
  230. if (inh_flags & X509_VP_FLAG_ONCE)
  231. dest->inh_flags = 0;
  232. if (inh_flags & X509_VP_FLAG_LOCKED)
  233. return 1;
  234. if (inh_flags & X509_VP_FLAG_DEFAULT)
  235. to_default = 1;
  236. else
  237. to_default = 0;
  238. if (inh_flags & X509_VP_FLAG_OVERWRITE)
  239. to_overwrite = 1;
  240. else
  241. to_overwrite = 0;
  242. x509_verify_param_copy(purpose, 0);
  243. x509_verify_param_copy(trust, 0);
  244. x509_verify_param_copy(depth, -1);
  245. /* If overwrite or check time not set, copy across */
  246. if (to_overwrite || !(dest->flags & X509_V_FLAG_USE_CHECK_TIME)) {
  247. dest->check_time = src->check_time;
  248. dest->flags &= ~X509_V_FLAG_USE_CHECK_TIME;
  249. /* Don't need to copy flag: that is done below */
  250. }
  251. if (inh_flags & X509_VP_FLAG_RESET_FLAGS)
  252. dest->flags = 0;
  253. dest->flags |= src->flags;
  254. if (test_x509_verify_param_copy(policies, NULL)) {
  255. if (!X509_VERIFY_PARAM_set1_policies(dest, src->policies))
  256. return 0;
  257. }
  258. /* Copy the host flags if and only if we're copying the host list */
  259. if (test_x509_verify_param_copy_id(hosts, NULL)) {
  260. if (dest->id->hosts) {
  261. string_stack_free(dest->id->hosts);
  262. dest->id->hosts = NULL;
  263. }
  264. if (id->hosts) {
  265. dest->id->hosts =
  266. sk_OPENSSL_STRING_deep_copy(id->hosts, str_copy, str_free);
  267. if (dest->id->hosts == NULL)
  268. return 0;
  269. dest->id->hostflags = id->hostflags;
  270. }
  271. }
  272. if (test_x509_verify_param_copy_id(email, NULL)) {
  273. if (!X509_VERIFY_PARAM_set1_email(dest, id->email, id->emaillen))
  274. return 0;
  275. }
  276. if (test_x509_verify_param_copy_id(ip, NULL)) {
  277. if (!X509_VERIFY_PARAM_set1_ip(dest, id->ip, id->iplen))
  278. return 0;
  279. }
  280. dest->id->poison = src->id->poison;
  281. return 1;
  282. }
  283. int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
  284. const X509_VERIFY_PARAM *from)
  285. {
  286. unsigned long save_flags = to->inh_flags;
  287. int ret;
  288. to->inh_flags |= X509_VP_FLAG_DEFAULT;
  289. ret = X509_VERIFY_PARAM_inherit(to, from);
  290. to->inh_flags = save_flags;
  291. return ret;
  292. }
  293. static int int_x509_param_set1(char **pdest, size_t *pdestlen,
  294. const char *src, size_t srclen)
  295. {
  296. void *tmp;
  297. if (src == NULL || srclen == 0) {
  298. // Unlike OpenSSL, we do not allow an empty string to disable previously
  299. // configured checks.
  300. return 0;
  301. }
  302. tmp = BUF_memdup(src, srclen);
  303. if (!tmp) {
  304. return 0;
  305. }
  306. if (*pdest)
  307. OPENSSL_free(*pdest);
  308. *pdest = tmp;
  309. if (pdestlen)
  310. *pdestlen = srclen;
  311. return 1;
  312. }
  313. int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name)
  314. {
  315. if (param->name)
  316. OPENSSL_free(param->name);
  317. param->name = BUF_strdup(name);
  318. if (param->name)
  319. return 1;
  320. return 0;
  321. }
  322. int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags)
  323. {
  324. param->flags |= flags;
  325. if (flags & X509_V_FLAG_POLICY_MASK)
  326. param->flags |= X509_V_FLAG_POLICY_CHECK;
  327. return 1;
  328. }
  329. int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
  330. unsigned long flags)
  331. {
  332. param->flags &= ~flags;
  333. return 1;
  334. }
  335. unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param)
  336. {
  337. return param->flags;
  338. }
  339. int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose)
  340. {
  341. return X509_PURPOSE_set(&param->purpose, purpose);
  342. }
  343. int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust)
  344. {
  345. return X509_TRUST_set(&param->trust, trust);
  346. }
  347. void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth)
  348. {
  349. param->depth = depth;
  350. }
  351. void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
  352. {
  353. param->check_time = t;
  354. param->flags |= X509_V_FLAG_USE_CHECK_TIME;
  355. }
  356. int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
  357. ASN1_OBJECT *policy)
  358. {
  359. if (!param->policies) {
  360. param->policies = sk_ASN1_OBJECT_new_null();
  361. if (!param->policies)
  362. return 0;
  363. }
  364. if (!sk_ASN1_OBJECT_push(param->policies, policy))
  365. return 0;
  366. return 1;
  367. }
  368. int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
  369. STACK_OF(ASN1_OBJECT) *policies)
  370. {
  371. size_t i;
  372. ASN1_OBJECT *oid, *doid;
  373. if (!param)
  374. return 0;
  375. if (param->policies)
  376. sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
  377. if (!policies) {
  378. param->policies = NULL;
  379. return 1;
  380. }
  381. param->policies = sk_ASN1_OBJECT_new_null();
  382. if (!param->policies)
  383. return 0;
  384. for (i = 0; i < sk_ASN1_OBJECT_num(policies); i++) {
  385. oid = sk_ASN1_OBJECT_value(policies, i);
  386. doid = OBJ_dup(oid);
  387. if (!doid)
  388. return 0;
  389. if (!sk_ASN1_OBJECT_push(param->policies, doid)) {
  390. ASN1_OBJECT_free(doid);
  391. return 0;
  392. }
  393. }
  394. param->flags |= X509_V_FLAG_POLICY_CHECK;
  395. return 1;
  396. }
  397. int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
  398. const char *name, size_t namelen)
  399. {
  400. if (!int_x509_param_set_hosts(param->id, SET_HOST, name, namelen)) {
  401. param->id->poison = 1;
  402. return 0;
  403. }
  404. return 1;
  405. }
  406. int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
  407. const char *name, size_t namelen)
  408. {
  409. if (!int_x509_param_set_hosts(param->id, ADD_HOST, name, namelen)) {
  410. param->id->poison = 1;
  411. return 0;
  412. }
  413. return 1;
  414. }
  415. void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
  416. unsigned int flags)
  417. {
  418. param->id->hostflags = flags;
  419. }
  420. char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param)
  421. {
  422. return param->id->peername;
  423. }
  424. int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
  425. const char *email, size_t emaillen)
  426. {
  427. if (OPENSSL_memchr(email, '\0', emaillen) != NULL ||
  428. !int_x509_param_set1(&param->id->email, &param->id->emaillen,
  429. email, emaillen)) {
  430. param->id->poison = 1;
  431. return 0;
  432. }
  433. return 1;
  434. }
  435. int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
  436. const unsigned char *ip, size_t iplen)
  437. {
  438. if ((iplen != 4 && iplen != 16) ||
  439. !int_x509_param_set1((char **)&param->id->ip, &param->id->iplen,
  440. (char *)ip, iplen)) {
  441. param->id->poison = 1;
  442. return 0;
  443. }
  444. return 1;
  445. }
  446. int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc)
  447. {
  448. unsigned char ipout[16];
  449. size_t iplen;
  450. iplen = (size_t)a2i_ipadd(ipout, ipasc);
  451. if (iplen == 0)
  452. return 0;
  453. return X509_VERIFY_PARAM_set1_ip(param, ipout, iplen);
  454. }
  455. int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param)
  456. {
  457. return param->depth;
  458. }
  459. const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param)
  460. {
  461. return param->name;
  462. }
  463. static const X509_VERIFY_PARAM_ID _empty_id =
  464. { NULL, 0U, NULL, NULL, 0, NULL, 0, 0 };
  465. #define vpm_empty_id ((X509_VERIFY_PARAM_ID *)&_empty_id)
  466. /*
  467. * Default verify parameters: these are used for various applications and can
  468. * be overridden by the user specified table. NB: the 'name' field *must* be
  469. * in alphabetical order because it will be searched using OBJ_search.
  470. */
  471. static const X509_VERIFY_PARAM default_table[] = {
  472. {
  473. (char *)"default", /* X509 default parameters */
  474. 0, /* Check time */
  475. 0, /* internal flags */
  476. 0, /* flags */
  477. 0, /* purpose */
  478. 0, /* trust */
  479. 100, /* depth */
  480. NULL, /* policies */
  481. vpm_empty_id},
  482. {
  483. (char *)"pkcs7", /* S/MIME sign parameters */
  484. 0, /* Check time */
  485. 0, /* internal flags */
  486. 0, /* flags */
  487. X509_PURPOSE_SMIME_SIGN, /* purpose */
  488. X509_TRUST_EMAIL, /* trust */
  489. -1, /* depth */
  490. NULL, /* policies */
  491. vpm_empty_id},
  492. {
  493. (char *)"smime_sign", /* S/MIME sign parameters */
  494. 0, /* Check time */
  495. 0, /* internal flags */
  496. 0, /* flags */
  497. X509_PURPOSE_SMIME_SIGN, /* purpose */
  498. X509_TRUST_EMAIL, /* trust */
  499. -1, /* depth */
  500. NULL, /* policies */
  501. vpm_empty_id},
  502. {
  503. (char *)"ssl_client", /* SSL/TLS client parameters */
  504. 0, /* Check time */
  505. 0, /* internal flags */
  506. 0, /* flags */
  507. X509_PURPOSE_SSL_CLIENT, /* purpose */
  508. X509_TRUST_SSL_CLIENT, /* trust */
  509. -1, /* depth */
  510. NULL, /* policies */
  511. vpm_empty_id},
  512. {
  513. (char *)"ssl_server", /* SSL/TLS server parameters */
  514. 0, /* Check time */
  515. 0, /* internal flags */
  516. 0, /* flags */
  517. X509_PURPOSE_SSL_SERVER, /* purpose */
  518. X509_TRUST_SSL_SERVER, /* trust */
  519. -1, /* depth */
  520. NULL, /* policies */
  521. vpm_empty_id}
  522. };
  523. static STACK_OF(X509_VERIFY_PARAM) *param_table = NULL;
  524. static int param_cmp(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b)
  525. {
  526. return strcmp((*a)->name, (*b)->name);
  527. }
  528. int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param)
  529. {
  530. X509_VERIFY_PARAM *ptmp;
  531. if (!param_table) {
  532. param_table = sk_X509_VERIFY_PARAM_new(param_cmp);
  533. if (!param_table)
  534. return 0;
  535. } else {
  536. size_t idx;
  537. sk_X509_VERIFY_PARAM_sort(param_table);
  538. if (sk_X509_VERIFY_PARAM_find(param_table, &idx, param)) {
  539. ptmp = sk_X509_VERIFY_PARAM_value(param_table, idx);
  540. X509_VERIFY_PARAM_free(ptmp);
  541. (void)sk_X509_VERIFY_PARAM_delete(param_table, idx);
  542. }
  543. }
  544. if (!sk_X509_VERIFY_PARAM_push(param_table, param))
  545. return 0;
  546. return 1;
  547. }
  548. int X509_VERIFY_PARAM_get_count(void)
  549. {
  550. int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
  551. if (param_table)
  552. num += sk_X509_VERIFY_PARAM_num(param_table);
  553. return num;
  554. }
  555. const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id)
  556. {
  557. int num = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
  558. if (id < num)
  559. return default_table + id;
  560. return sk_X509_VERIFY_PARAM_value(param_table, id - num);
  561. }
  562. const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name)
  563. {
  564. X509_VERIFY_PARAM pm;
  565. unsigned i, limit;
  566. pm.name = (char *)name;
  567. if (param_table) {
  568. size_t idx;
  569. sk_X509_VERIFY_PARAM_sort(param_table);
  570. if (sk_X509_VERIFY_PARAM_find(param_table, &idx, &pm))
  571. return sk_X509_VERIFY_PARAM_value(param_table, idx);
  572. }
  573. limit = sizeof(default_table) / sizeof(X509_VERIFY_PARAM);
  574. for (i = 0; i < limit; i++) {
  575. if (strcmp(default_table[i].name, name) == 0) {
  576. return &default_table[i];
  577. }
  578. }
  579. return NULL;
  580. }
  581. void X509_VERIFY_PARAM_table_cleanup(void)
  582. {
  583. if (param_table)
  584. sk_X509_VERIFY_PARAM_pop_free(param_table, X509_VERIFY_PARAM_free);
  585. param_table = NULL;
  586. }