summaryrefslogtreecommitdiffstats
path: root/test/evp_extra_test2.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-04-27 16:01:13 +0200
committerTomas Mraz <tomas@openssl.org>2021-05-13 13:30:07 +0200
commitb4c4a2c68817ea0b2df8012673fa4e0712681704 (patch)
tree0e9ef2698c96e048dda681af0aadc9f7daac384a /test/evp_extra_test2.c
parente9fe0f7e9df7e0909ca52a024b889e48616a29d9 (diff)
Implement pem_read_key directly through OSSL_DECODER
Using OSSL_STORE is too heavy and breaks things. There were also needed various fixes mainly for missing proper handling of the SM2 keys in the OSSL_DECODER. Fixes #14788 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15045)
Diffstat (limited to 'test/evp_extra_test2.c')
-rw-r--r--test/evp_extra_test2.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/evp_extra_test2.c b/test/evp_extra_test2.c
index d9d26711ba..cad1934c5b 100644
--- a/test/evp_extra_test2.c
+++ b/test/evp_extra_test2.c
@@ -371,10 +371,17 @@ static int test_d2i_PrivateKey_ex(void) {
provider = OSSL_PROVIDER_load(NULL, "default");
key_bio = BIO_new_mem_buf((&keydata[0])->kder, (&keydata)[0]->size);
- ok = TEST_ptr(pkey = PEM_read_bio_PrivateKey(key_bio, NULL, NULL, NULL));
+ if (!TEST_ptr_null(pkey = PEM_read_bio_PrivateKey(key_bio, NULL, NULL, NULL)))
+ goto err;
+
+ ERR_clear_error();
+ if (!TEST_int_ge(BIO_seek(key_bio, 0), 0))
+ goto err;
+ ok = TEST_ptr(pkey = d2i_PrivateKey_bio(key_bio, NULL));
TEST_int_eq(ERR_peek_error(), 0);
test_openssl_errors();
+ err:
EVP_PKEY_free(pkey);
BIO_free(key_bio);
OSSL_PROVIDER_unload(provider);