diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/x509/x509_asn1.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/regress/lib/libcrypto/x509/x509_asn1.c b/src/regress/lib/libcrypto/x509/x509_asn1.c index 4daed41f1e..30b0607079 100644 --- a/src/regress/lib/libcrypto/x509/x509_asn1.c +++ b/src/regress/lib/libcrypto/x509/x509_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_asn1.c,v 1.10 2023/04/28 13:48:38 job Exp $ */ | 1 | /* $OpenBSD: x509_asn1.c,v 1.11 2023/04/28 15:12:51 job Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Job Snijders <job@openbsd.org> | 3 | * Copyright (c) 2023 Job Snijders <job@openbsd.org> |
| 4 | * | 4 | * |
| @@ -306,13 +306,11 @@ test_x509_setters(void) | |||
| 306 | errx(1, "EVP_PKEY_keygen"); | 306 | errx(1, "EVP_PKEY_keygen"); |
| 307 | if (X509_set_pubkey(a, pkey) != 1) | 307 | if (X509_set_pubkey(a, pkey) != 1) |
| 308 | errx(1, "X509_set_pubkey"); | 308 | errx(1, "X509_set_pubkey"); |
| 309 | EVP_PKEY_CTX_free(pkey_ctx); | ||
| 310 | EVP_PKEY_free(pkey); | ||
| 311 | pkey_ctx = NULL; | ||
| 312 | pkey = NULL; | ||
| 313 | failed |= x509_compare("X509_set_pubkey", a, der2, der2sz); | 309 | failed |= x509_compare("X509_set_pubkey", a, der2, der2sz); |
| 314 | |||
| 315 | x509_cleanup(&a, &der2); | 310 | x509_cleanup(&a, &der2); |
| 311 | |||
| 312 | EVP_PKEY_CTX_free(pkey_ctx); | ||
| 313 | EVP_PKEY_free(pkey); | ||
| 316 | X509_free(x); | 314 | X509_free(x); |
| 317 | free(der); | 315 | free(der); |
| 318 | 316 | ||
| @@ -348,8 +346,6 @@ test_x509_crl_setters(void) | |||
| 348 | // one time creation of the original DER | 346 | // one time creation of the original DER |
| 349 | if (!X509_CRL_sign(xc, pkey, EVP_sha256())) | 347 | if (!X509_CRL_sign(xc, pkey, EVP_sha256())) |
| 350 | errx(1, "X509_CRL_sign"); | 348 | errx(1, "X509_CRL_sign"); |
| 351 | EVP_PKEY_free(pkey); | ||
| 352 | EVP_PKEY_CTX_free(pkey_ctx); | ||
| 353 | if ((dersz = i2d_X509_CRL(xc, &der)) <= 0) | 349 | if ((dersz = i2d_X509_CRL(xc, &der)) <= 0) |
| 354 | errx(1, "i2d_X509_CRL"); | 350 | errx(1, "i2d_X509_CRL"); |
| 355 | 351 | ||
| @@ -379,6 +375,8 @@ test_x509_crl_setters(void) | |||
| 379 | failed |= x509_crl_compare("X509_set_notAfter", ac, der2, der2sz); | 375 | failed |= x509_crl_compare("X509_set_notAfter", ac, der2, der2sz); |
| 380 | x509_crl_cleanup(&ac, &der2); | 376 | x509_crl_cleanup(&ac, &der2); |
| 381 | 377 | ||
| 378 | EVP_PKEY_free(pkey); | ||
| 379 | EVP_PKEY_CTX_free(pkey_ctx); | ||
| 382 | X509_CRL_free(xc); | 380 | X509_CRL_free(xc); |
| 383 | free(der); | 381 | free(der); |
| 384 | 382 | ||
| @@ -458,8 +456,6 @@ test_x509_req_setters(void) | |||
| 458 | errx(1, "X509_NAME_add_entry_by_txt"); | 456 | errx(1, "X509_NAME_add_entry_by_txt"); |
| 459 | if (!X509_REQ_set_subject_name(xr, xn)) | 457 | if (!X509_REQ_set_subject_name(xr, xn)) |
| 460 | errx(1, "X509_REQ_set_subject_name"); | 458 | errx(1, "X509_REQ_set_subject_name"); |
| 461 | X509_NAME_free(xn); | ||
| 462 | xn = NULL; | ||
| 463 | 459 | ||
| 464 | if ((pkey_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL)) == NULL) | 460 | if ((pkey_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL)) == NULL) |
| 465 | errx(1, "EVP_PKEY_CTX_new_id"); | 461 | errx(1, "EVP_PKEY_CTX_new_id"); |
| @@ -507,15 +503,15 @@ test_x509_req_setters(void) | |||
| 507 | failed |= x509_req_compare("X509_REQ_add1_attr", ar, der2, der2sz); | 503 | failed |= x509_req_compare("X509_REQ_add1_attr", ar, der2, der2sz); |
| 508 | x509_req_cleanup(&ar, &der2); | 504 | x509_req_cleanup(&ar, &der2); |
| 509 | 505 | ||
| 506 | ASN1_OBJECT_free(coid); | ||
| 507 | X509_NAME_free(xn); | ||
| 510 | ASN1_OCTET_STRING_free(aos); | 508 | ASN1_OCTET_STRING_free(aos); |
| 511 | X509_EXTENSION_free(xe); | 509 | sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); |
| 512 | X509_ATTRIBUTE_free(xa); | 510 | X509_ATTRIBUTE_free(xa); |
| 513 | EVP_PKEY_free(pkey); | 511 | EVP_PKEY_free(pkey); |
| 514 | EVP_PKEY_CTX_free(pkey_ctx); | 512 | EVP_PKEY_CTX_free(pkey_ctx); |
| 515 | X509_REQ_free(ar); | ||
| 516 | X509_REQ_free(xr); | 513 | X509_REQ_free(xr); |
| 517 | free(der); | 514 | free(der); |
| 518 | free(der2); | ||
| 519 | 515 | ||
| 520 | return failed; | 516 | return failed; |
| 521 | } | 517 | } |
