1 /* 2 * Copyright 2022-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 #define OPENSSL_SUPPRESS_DEPRECATED /* EVP_PKEY_get1/set1_RSA */ 11 12 #include <openssl/x509.h> 13 #include <openssl/x509v3.h> 14 #include <openssl/asn1.h> 15 #include <openssl/evp.h> 16 #include <openssl/rsa.h> 17 #include <openssl/pem.h> 18 #include "crypto/x509.h" /* x509_st definition */ 19 #include "testutil.h" 20 21 static EVP_PKEY *pubkey = NULL; 22 static EVP_PKEY *privkey = NULL; 23 static EVP_MD *signmd = NULL; 24 25 /* EC key pair used for signing */ 26 static const unsigned char privkeydata[] = { 27 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x7d, 0x2b, 0xfe, 0x5c, 0xcb, 0xcb, 0x27, 0xd6, 0x28, 28 0xfe, 0x98, 0x34, 0x84, 0x4a, 0x13, 0x6f, 0x70, 0xc4, 0x1a, 0x0b, 0xfc, 0xde, 0xb0, 0xb2, 0x32, 29 0xb1, 0xdd, 0x4f, 0x0e, 0xbc, 0xdf, 0x89, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 30 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xbf, 0x82, 0xd9, 0xc9, 0x4b, 0x19, 0x43, 31 0x45, 0x6b, 0xd4, 0x50, 0x64, 0x9b, 0xd5, 0x8d, 0x5a, 0xd9, 0xdc, 0xc9, 0x24, 0x23, 0x7a, 0x3b, 32 0x48, 0x23, 0xe2, 0x2a, 0x24, 0xf2, 0x9c, 0x6f, 0x87, 0xd0, 0xc4, 0x0f, 0xcc, 0x7e, 0x7c, 0x8d, 33 0xfc, 0x08, 0x46, 0x37, 0x85, 0x4f, 0x5b, 0x3a, 0x0b, 0x97, 0xd7, 0x57, 0x2a, 0x5a, 0x6b, 0x7a, 34 0x0b, 0xe4, 0xe8, 0x9c, 0x4a, 0xbb, 0xbf, 0x09, 0x4d 35 }; 36 37 static const unsigned char pubkeydata[] = { 38 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 39 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xbf, 0x82, 0xd9, 0xc9, 0x4b, 40 0x19, 0x43, 0x45, 0x6b, 0xd4, 0x50, 0x64, 0x9b, 0xd5, 0x8d, 0x5a, 0xd9, 0xdc, 0xc9, 0x24, 0x23, 41 0x7a, 0x3b, 0x48, 0x23, 0xe2, 0x2a, 0x24, 0xf2, 0x9c, 0x6f, 0x87, 0xd0, 0xc4, 0x0f, 0xcc, 0x7e, 42 0x7c, 0x8d, 0xfc, 0x08, 0x46, 0x37, 0x85, 0x4f, 0x5b, 0x3a, 0x0b, 0x97, 0xd7, 0x57, 0x2a, 0x5a, 43 0x6b, 0x7a, 0x0b, 0xe4, 0xe8, 0x9c, 0x4a, 0xbb, 0xbf, 0x09, 0x4d 44 }; 45 46 /* Self signed cert using ECDSA-SHA256 with the keypair listed above */ 47 static const unsigned char certdata[] = { 48 0x30, 0x82, 0x01, 0x86, 0x30, 0x82, 0x01, 0x2d, 0x02, 0x14, 0x75, 0xd6, 0x04, 0xd2, 0x80, 0x61, 49 0xd3, 0x32, 0xbc, 0xae, 0x38, 0x58, 0xfe, 0x12, 0x42, 0x81, 0x7a, 0xdd, 0x0b, 0x99, 0x30, 0x0a, 50 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 51 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 52 0x04, 0x08, 0x0c, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 53 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 54 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 55 0x64, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x32, 0x31, 0x30, 0x31, 0x32, 0x30, 0x37, 0x32, 0x37, 0x35, 56 0x35, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x35, 0x30, 0x30, 0x32, 0x32, 0x37, 0x30, 0x37, 0x32, 0x37, 57 0x35, 0x35, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 58 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x53, 0x6f, 0x6d, 59 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 60 0x0c, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 61 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 62 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 63 0x07, 0x03, 0x42, 0x00, 0x04, 0xbf, 0x82, 0xd9, 0xc9, 0x4b, 0x19, 0x43, 0x45, 0x6b, 0xd4, 0x50, 64 0x64, 0x9b, 0xd5, 0x8d, 0x5a, 0xd9, 0xdc, 0xc9, 0x24, 0x23, 0x7a, 0x3b, 0x48, 0x23, 0xe2, 0x2a, 65 0x24, 0xf2, 0x9c, 0x6f, 0x87, 0xd0, 0xc4, 0x0f, 0xcc, 0x7e, 0x7c, 0x8d, 0xfc, 0x08, 0x46, 0x37, 66 0x85, 0x4f, 0x5b, 0x3a, 0x0b, 0x97, 0xd7, 0x57, 0x2a, 0x5a, 0x6b, 0x7a, 0x0b, 0xe4, 0xe8, 0x9c, 67 0x4a, 0xbb, 0xbf, 0x09, 0x4d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 68 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0x5f, 0x45, 0x7f, 0xa4, 0x6a, 0x03, 0xfd, 0xe7, 69 0xf3, 0x42, 0x43, 0x38, 0x5b, 0x81, 0x08, 0x1a, 0x47, 0x8e, 0x59, 0x3a, 0x28, 0x5b, 0x97, 0x67, 70 0x47, 0x66, 0x2a, 0x16, 0xf5, 0xce, 0xf5, 0x92, 0x02, 0x20, 0x22, 0x0e, 0xab, 0x35, 0xdf, 0x49, 71 0xb1, 0x86, 0xa3, 0x3b, 0x26, 0xda, 0x7e, 0x8b, 0x44, 0x45, 0xc6, 0x46, 0x14, 0x04, 0x22, 0x2b, 72 0xe5, 0x2a, 0x62, 0x84, 0xc5, 0x94, 0xa0, 0x1b, 0xaa, 0xa9 73 }; 74 75 /* Some simple CRL data */ 76 static const unsigned char crldata[] = { 77 0x30, 0x81, 0x8B, 0x30, 0x31, 0x02, 0x01, 0x01, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 78 0x3D, 0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x0F, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04, 79 0x03, 0x0C, 0x04, 0x54, 0x65, 0x73, 0x74, 0x17, 0x0D, 0x32, 0x32, 0x31, 0x30, 0x31, 0x32, 0x30, 80 0x35, 0x33, 0x34, 0x30, 0x31, 0x5A, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 81 0x03, 0x02, 0x05, 0x00, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x75, 0xAC, 0xA9, 0xB5, 0xFE, 82 0x63, 0x09, 0x8B, 0x57, 0x4F, 0xBB, 0xC6, 0x0C, 0xA9, 0x9A, 0x7C, 0x55, 0x89, 0xF9, 0x9C, 0x48, 83 0xE9, 0xF3, 0xED, 0xE5, 0xC2, 0x88, 0xCE, 0xEC, 0xB1, 0x51, 0xF1, 0x02, 0x21, 0x00, 0x8B, 0x93, 84 0xC5, 0xA6, 0x28, 0x48, 0x5A, 0x4E, 0x10, 0x52, 0x82, 0x12, 0x2F, 0xC4, 0x62, 0x2D, 0x3F, 0x5A, 85 0x62, 0x7F, 0x9D, 0x1B, 0x12, 0xC5, 0x36, 0x25, 0x73, 0x03, 0xF4, 0xDE, 0x62, 0x24 86 }; 87 88 /* 89 * Test for Regression discussed in PR #19388 90 * In order for this simple test to fail, it requires the digest used for 91 * signing to be different from the alg within the loaded cert. 92 */ 93 static int test_x509_tbs_cache(void) 94 { 95 int ret; 96 X509 *x = NULL; 97 const unsigned char *p = certdata; 98 99 ret = TEST_ptr(x = d2i_X509(NULL, &p, sizeof(certdata))) 100 && TEST_int_gt(X509_sign(x, privkey, signmd), 0) 101 && TEST_int_eq(X509_verify(x, pubkey), 1); 102 X509_free(x); 103 return ret; 104 } 105 106 static int test_x509_verify_with_new(void) 107 { 108 int ret; 109 EVP_PKEY *pkey = NULL; 110 X509 *x = NULL; 111 112 ret = TEST_ptr(x = X509_new()) 113 && TEST_ptr(pkey = EVP_PKEY_new()) 114 && TEST_int_eq(X509_verify(x, pkey), -1) 115 && TEST_int_eq(X509_verify(x, pubkey), -1); 116 X509_free(x); 117 EVP_PKEY_free(pkey); 118 return ret; 119 } 120 121 /* 122 * Test for Regression discussed in PR #19388 123 * In order for this simple test to fail, it requires the digest used for 124 * signing to be different from the alg within the loaded cert. 125 */ 126 static int test_x509_crl_tbs_cache(void) 127 { 128 int ret; 129 X509_CRL *crl = NULL; 130 const unsigned char *p = crldata; 131 132 ret = TEST_ptr(crl = d2i_X509_CRL(NULL, &p, sizeof(crldata))) 133 && TEST_int_gt(X509_CRL_sign(crl, privkey, signmd), 0) 134 && TEST_int_eq(X509_CRL_verify(crl, pubkey), 1); 135 136 X509_CRL_free(crl); 137 return ret; 138 } 139 140 static int test_asn1_item_verify(void) 141 { 142 int ret = 0; 143 BIO *bio = NULL; 144 X509 *x509 = NULL; 145 const char *certfile; 146 const ASN1_BIT_STRING *sig = NULL; 147 const X509_ALGOR *alg = NULL; 148 EVP_PKEY *pkey; 149 #ifndef OPENSSL_NO_DEPRECATED_3_0 150 RSA *rsa = NULL; 151 #endif 152 153 if (!TEST_ptr(certfile = test_get_argument(0)) 154 || !TEST_ptr(bio = BIO_new_file(certfile, "r")) 155 || !TEST_ptr(x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL)) 156 || !TEST_ptr(pkey = X509_get0_pubkey(x509))) 157 goto err; 158 159 #ifndef OPENSSL_NO_DEPRECATED_3_0 160 /* Issue #24575 requires legacy key but the test is useful anyway */ 161 if (!TEST_ptr(rsa = EVP_PKEY_get1_RSA(pkey))) 162 goto err; 163 164 if (!TEST_int_gt(EVP_PKEY_set1_RSA(pkey, rsa), 0)) 165 goto err; 166 #endif 167 168 X509_get0_signature(&sig, &alg, x509); 169 170 if (!TEST_int_gt(ASN1_item_verify(ASN1_ITEM_rptr(X509_CINF), 171 (X509_ALGOR *)alg, (ASN1_BIT_STRING *)sig, 172 &x509->cert_info, pkey), 173 0)) 174 goto err; 175 176 ERR_set_mark(); 177 if (!TEST_int_lt(ASN1_item_verify(ASN1_ITEM_rptr(X509_CINF), 178 (X509_ALGOR *)alg, (ASN1_BIT_STRING *)sig, 179 NULL, pkey), 180 0)) { 181 ERR_clear_last_mark(); 182 goto err; 183 } 184 ERR_pop_to_mark(); 185 186 ret = 1; 187 188 err: 189 #ifndef OPENSSL_NO_DEPRECATED_3_0 190 RSA_free(rsa); 191 #endif 192 X509_free(x509); 193 BIO_free(bio); 194 return ret; 195 } 196 197 static int test_x509_delete_last_extension(void) 198 { 199 int ret = 0; 200 X509 *x509 = NULL; 201 X509_EXTENSION *ext = NULL; 202 ASN1_OBJECT *obj = NULL; 203 204 if (!TEST_ptr((x509 = X509_new())) 205 /* Initially, there are no extensions and thus no extension list. */ 206 || !TEST_ptr_null(X509_get0_extensions(x509)) 207 /* Add an extension. */ 208 || !TEST_ptr((ext = X509_EXTENSION_new())) 209 || !TEST_ptr((obj = OBJ_nid2obj(NID_subject_key_identifier))) 210 || !TEST_int_eq(X509_EXTENSION_set_object(ext, obj), 1) 211 || !TEST_int_eq(X509_add_ext(x509, ext, -1), 1) 212 /* There should now be an extension list. */ 213 || !TEST_ptr(X509_get0_extensions(x509)) 214 || !TEST_int_eq(sk_X509_EXTENSION_num(X509_get0_extensions(x509)), 1)) 215 goto err; 216 217 /* Delete the extension. */ 218 X509_EXTENSION_free(X509_delete_ext(x509, 0)); 219 220 /* The extension list should be NULL again. */ 221 if (!TEST_ptr_null(X509_get0_extensions(x509))) 222 goto err; 223 224 ret = 1; 225 226 err: 227 X509_free(x509); 228 X509_EXTENSION_free(ext); 229 return ret; 230 } 231 232 static int test_x509_crl_delete_last_extension(void) 233 { 234 int ret = 0; 235 X509_CRL *crl = NULL; 236 X509_EXTENSION *ext = NULL; 237 ASN1_OBJECT *obj = NULL; 238 239 if (!TEST_ptr((crl = X509_CRL_new())) 240 /* Initially, there are no extensions and thus no extension list. */ 241 || !TEST_ptr_null(X509_CRL_get0_extensions(crl)) 242 /* Add an extension. */ 243 || !TEST_ptr((ext = X509_EXTENSION_new())) 244 || !TEST_ptr((obj = OBJ_nid2obj(NID_subject_key_identifier))) 245 || !TEST_int_eq(X509_EXTENSION_set_object(ext, obj), 1) 246 || !TEST_int_eq(X509_CRL_add_ext(crl, ext, -1), 1) 247 /* There should now be an extension list. */ 248 || !TEST_ptr(X509_CRL_get0_extensions(crl)) 249 || !TEST_int_eq(sk_X509_EXTENSION_num(X509_CRL_get0_extensions(crl)), 250 1)) 251 goto err; 252 253 /* Delete the extension. */ 254 X509_EXTENSION_free(X509_CRL_delete_ext(crl, 0)); 255 256 /* The extension list should be NULL again. */ 257 if (!TEST_ptr_null(X509_CRL_get0_extensions(crl))) 258 goto err; 259 260 ret = 1; 261 262 err: 263 X509_CRL_free(crl); 264 X509_EXTENSION_free(ext); 265 return ret; 266 } 267 268 static int test_x509_revoked_delete_last_extension(void) 269 { 270 int ret = 0; 271 X509_REVOKED *rev = NULL; 272 X509_EXTENSION *ext = NULL; 273 ASN1_OBJECT *obj = NULL; 274 275 if (!TEST_ptr((rev = X509_REVOKED_new())) 276 /* Initially, there are no extensions and thus no extension list. */ 277 || !TEST_ptr_null(X509_REVOKED_get0_extensions(rev)) 278 /* Add an extension. */ 279 || !TEST_ptr((ext = X509_EXTENSION_new())) 280 || !TEST_ptr((obj = OBJ_nid2obj(NID_subject_key_identifier))) 281 || !TEST_int_eq(X509_EXTENSION_set_object(ext, obj), 1) 282 || !TEST_int_eq(X509_REVOKED_add_ext(rev, ext, -1), 1) 283 /* There should now be an extension list. */ 284 || !TEST_ptr(X509_REVOKED_get0_extensions(rev)) 285 || !TEST_int_eq(sk_X509_EXTENSION_num(X509_REVOKED_get0_extensions(rev)), 1)) 286 goto err; 287 288 /* Delete the extension. */ 289 X509_EXTENSION_free(X509_REVOKED_delete_ext(rev, 0)); 290 291 /* The extension list should be NULL again. */ 292 if (!TEST_ptr_null(X509_REVOKED_get0_extensions(rev))) 293 goto err; 294 295 ret = 1; 296 297 err: 298 X509_REVOKED_free(rev); 299 X509_EXTENSION_free(ext); 300 return ret; 301 } 302 303 /* 304 * nameConstraints extnValue contents with one empty directoryName subtree. 305 * Empty X509_NAME has canon_enc == NULL / canon_enclen == 0. 306 * 307 * SEQUENCE { [0|1] { SEQUENCE { [4] { SEQUENCE {} } } } } 308 */ 309 static const unsigned char nc_excluded_empty_dirname[] = { 310 0x30, 0x08, 0xa1, 0x06, 0x30, 0x04, 0xa4, 0x02, 0x30, 0x00 311 }; 312 static const unsigned char nc_permitted_empty_dirname[] = { 313 0x30, 0x08, 0xa0, 0x06, 0x30, 0x04, 0xa4, 0x02, 0x30, 0x00 314 }; 315 316 /* Decode a raw nameConstraints extnValue into a NAME_CONSTRAINTS object. */ 317 static NAME_CONSTRAINTS *nc_empty_dirname_from_der(const unsigned char *der, 318 unsigned int der_len) 319 { 320 NAME_CONSTRAINTS *nc = NULL; 321 ASN1_OCTET_STRING *os = NULL; 322 X509_EXTENSION *ext = NULL; 323 324 os = ASN1_OCTET_STRING_new(); 325 if (!TEST_ptr(os) 326 || !TEST_true(ASN1_OCTET_STRING_set(os, der, der_len))) 327 goto end; 328 ext = X509_EXTENSION_create_by_NID(NULL, NID_name_constraints, 329 1 /* critical */, os); 330 if (!TEST_ptr(ext)) 331 goto end; 332 nc = X509V3_EXT_d2i(ext); 333 334 end: 335 X509_EXTENSION_free(ext); 336 ASN1_OCTET_STRING_free(os); 337 return nc; 338 } 339 340 /* Build a minimal certificate with a non-empty subject DN. */ 341 static X509 *nc_empty_dirname_subject(const char *cn) 342 { 343 X509 *x = NULL; 344 X509_NAME *nm = NULL; 345 346 if (!TEST_ptr(x = X509_new())) 347 goto err; 348 nm = X509_NAME_new(); 349 if (!TEST_ptr(nm) 350 || !TEST_true(X509_NAME_add_entry_by_txt(nm, "CN", MBSTRING_ASC, 351 (const unsigned char *)cn, -1, -1, 0)) 352 || !TEST_true(X509_set_subject_name(x, nm))) 353 goto err; 354 X509_NAME_free(nm); 355 return x; 356 357 err: 358 X509_NAME_free(nm); 359 X509_free(x); 360 return NULL; 361 } 362 363 /* Check an empty directoryName constraint against a non-empty subject DN. */ 364 static int nc_check_empty_dirname(const unsigned char *der, unsigned int der_len, 365 int expected) 366 { 367 int ok = 0; 368 NAME_CONSTRAINTS *nc = NULL; 369 X509 *x = NULL; 370 371 if (!TEST_ptr(nc = nc_empty_dirname_from_der(der, der_len)) 372 || !TEST_ptr(x = nc_empty_dirname_subject("leaf.example")) 373 || !TEST_int_eq(NAME_CONSTRAINTS_check(x, nc), expected)) 374 goto end; 375 376 ok = 1; 377 378 end: 379 X509_free(x); 380 NAME_CONSTRAINTS_free(nc); 381 return ok; 382 } 383 384 /* Empty excluded directoryName matches the subject DN: excluded violation. */ 385 static int test_nc_empty_dirname_excluded(void) 386 { 387 return nc_check_empty_dirname(nc_excluded_empty_dirname, 388 sizeof(nc_excluded_empty_dirname), X509_V_ERR_EXCLUDED_VIOLATION); 389 } 390 391 /* Empty permitted directoryName matches the subject DN: permitted. */ 392 static int test_nc_empty_dirname_permitted(void) 393 { 394 return nc_check_empty_dirname(nc_permitted_empty_dirname, 395 sizeof(nc_permitted_empty_dirname), X509_V_OK); 396 } 397 398 OPT_TEST_DECLARE_USAGE("<pss-self-signed-cert.pem>\n") 399 400 int setup_tests(void) 401 { 402 const unsigned char *p; 403 int cnt; 404 405 cnt = test_get_argument_count(); 406 if (cnt != 1) { 407 TEST_error("Must specify a certificate file self-signed with RSA-PSS.\n"); 408 return 0; 409 } 410 411 p = pubkeydata; 412 pubkey = d2i_PUBKEY(NULL, &p, sizeof(pubkeydata)); 413 414 p = privkeydata; 415 privkey = d2i_PrivateKey(EVP_PKEY_EC, NULL, &p, sizeof(privkeydata)); 416 417 if (pubkey == NULL || privkey == NULL) { 418 BIO_printf(bio_err, "Failed to create keys\n"); 419 return 0; 420 } 421 422 /* Note this digest is different from the certificate digest */ 423 signmd = EVP_MD_fetch(NULL, "SHA384", NULL); 424 if (signmd == NULL) { 425 BIO_printf(bio_err, "Failed to fetch digest\n"); 426 return 0; 427 } 428 429 ADD_TEST(test_x509_tbs_cache); 430 ADD_TEST(test_x509_crl_tbs_cache); 431 ADD_TEST(test_asn1_item_verify); 432 ADD_TEST(test_x509_delete_last_extension); 433 ADD_TEST(test_x509_crl_delete_last_extension); 434 ADD_TEST(test_x509_revoked_delete_last_extension); 435 ADD_TEST(test_x509_verify_with_new); 436 ADD_TEST(test_nc_empty_dirname_excluded); 437 ADD_TEST(test_nc_empty_dirname_permitted); 438 return 1; 439 } 440 441 void cleanup_tests(void) 442 { 443 EVP_MD_free(signmd); 444 EVP_PKEY_free(pubkey); 445 EVP_PKEY_free(privkey); 446 } 447