diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-07-28 14:13:06 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-08-18 10:20:03 +0200 |
commit | 3a1596f4e3d710c163279a20e6b844d371886e73 (patch) | |
tree | 4a47ad0bf99160c3f1abc0b56ce9deda2bb4a762 /test | |
parent | ec_kmgmt.c: Do not crash when getting OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY (diff) | |
download | openssl-3a1596f4e3d710c163279a20e6b844d371886e73.tar.xz openssl-3a1596f4e3d710c163279a20e6b844d371886e73.zip |
Add testcases for EVP_PKEY_get1_encoded_public_key
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18902)
Diffstat (limited to 'test')
-rw-r--r-- | test/evp_extra_test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index dfcd317773..23f92f26f0 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -897,6 +897,7 @@ static int test_EC_priv_pub(void) EVP_PKEY *params_and_keypair = NULL; BIGNUM *priv = NULL; int ret = 0; + unsigned char *encoded = NULL; /* * Setup the parameters for our pkey object. For our purposes they don't @@ -1005,6 +1006,17 @@ static int test_EC_priv_pub(void) || !TEST_int_gt(EVP_PKEY_eq(params_and_keypair, params_and_priv), 0)) goto err; + /* Positive and negative testcase for EVP_PKEY_get1_encoded_public_key */ + if (!TEST_int_gt(EVP_PKEY_get1_encoded_public_key(params_and_pub, &encoded), 0)) + goto err; + OPENSSL_free(encoded); + encoded = NULL; + if (!TEST_int_eq(EVP_PKEY_get1_encoded_public_key(just_params, &encoded), 0)) { + OPENSSL_free(encoded); + encoded = NULL; + goto err; + } + ret = 1; err: OSSL_PARAM_free(params); |