]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix evp_extra_test to use libctx in an X509_PUBKEY
authorMatt Caswell <matt@openssl.org>
Fri, 21 May 2021 14:50:43 +0000 (15:50 +0100)
committerPauli <pauli@openssl.org>
Sat, 5 Jun 2021 07:39:10 +0000 (17:39 +1000)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15591)

test/evp_extra_test.c

index f91784b3a943d4f35495d65d0bc19ecb6db45531..f26330b5d8d3035461ca72295e4c83454f337090 100644 (file)
@@ -1945,11 +1945,13 @@ static int test_emptyikm_HKDF(void)
 static int test_X509_PUBKEY_inplace(void)
 {
     int ret = 0;
-    X509_PUBKEY *xp = NULL;
+    X509_PUBKEY *xp = X509_PUBKEY_new_ex(testctx, testpropq);
     const unsigned char *p = kExampleECPubKeyDER;
     size_t input_len = sizeof(kExampleECPubKeyDER);
 
-    if (!TEST_ptr(xp = d2i_X509_PUBKEY(NULL, &p, input_len)))
+    if (!TEST_ptr(xp))
+        goto done;
+    if (!TEST_ptr(d2i_X509_PUBKEY(&xp, &p, input_len)))
         goto done;
 
     if (!TEST_ptr(X509_PUBKEY_get0(xp)))
@@ -1978,7 +1980,9 @@ static int test_X509_PUBKEY_dup(void)
     const unsigned char *p = kExampleECPubKeyDER;
     size_t input_len = sizeof(kExampleECPubKeyDER);
 
-    if (!TEST_ptr(xp = d2i_X509_PUBKEY(NULL, &p, input_len))
+    xp = X509_PUBKEY_new_ex(testctx, testpropq);
+    if (!TEST_ptr(xp)
+            || !TEST_ptr(d2i_X509_PUBKEY(&xp, &p, input_len))
             || !TEST_ptr(xq = X509_PUBKEY_dup(xp))
             || !TEST_ptr_ne(xp, xq))
         goto done;