diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-03-12 12:32:44 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-14 15:37:18 +1000 |
commit | 0fc39c9030df3e313c7ee08a3aefec8ab44bcd9a (patch) | |
tree | 34f6ad98787d3bcf0ebe3e95ac712332a5c440cd /test | |
parent | 8bfb8f34580cac3a53b0ac88dec566c19d6c8c53 (diff) |
Remove TODO in rsa_ameth.c
Fixes #14390
The only caller of this function tests EVP_KEYMGMT_is_a() beforehand
which will fail if the RSA key types do not match. So the test is not
necessary. The assert has been removed when it does the test.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14524)
Diffstat (limited to 'test')
-rw-r--r-- | test/keymgmt_internal_test.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/keymgmt_internal_test.c b/test/keymgmt_internal_test.c index 77414dbc27..e309c9e654 100644 --- a/test/keymgmt_internal_test.c +++ b/test/keymgmt_internal_test.c @@ -142,8 +142,8 @@ static int test_pass_rsa(FIXTURE *fixture) RSA *rsa = NULL; BIGNUM *bn1 = NULL, *bn2 = NULL, *bn3 = NULL; EVP_PKEY *pk = NULL; - EVP_KEYMGMT *km1 = NULL, *km2 = NULL; - void *provkey = NULL; + EVP_KEYMGMT *km = NULL, *km1 = NULL, *km2 = NULL, *km3 = NULL; + void *provkey = NULL, *provkey2 = NULL; BIGNUM *bn_primes[1] = { NULL }; BIGNUM *bn_exps[1] = { NULL }; BIGNUM *bn_coeffs[1] = { NULL }; @@ -216,9 +216,16 @@ static int test_pass_rsa(FIXTURE *fixture) if (!TEST_ptr(km1 = EVP_KEYMGMT_fetch(fixture->ctx1, "RSA", NULL)) || !TEST_ptr(km2 = EVP_KEYMGMT_fetch(fixture->ctx2, "RSA", NULL)) + || !TEST_ptr(km3 = EVP_KEYMGMT_fetch(fixture->ctx1, "RSA-PSS", NULL)) || !TEST_ptr_ne(km1, km2)) goto err; + km = km3; + /* Check that we can't export an RSA key into a RSA-PSS keymanager */ + if (!TEST_ptr_null(provkey2 = evp_pkey_export_to_provider(pk, NULL, &km, + NULL))) + goto err; + if (!TEST_ptr(provkey = evp_pkey_export_to_provider(pk, NULL, &km1, NULL)) || !TEST_true(evp_keymgmt_export(km2, provkey, OSSL_KEYMGMT_SELECT_KEYPAIR, @@ -249,6 +256,7 @@ static int test_pass_rsa(FIXTURE *fixture) EVP_PKEY_free(pk); EVP_KEYMGMT_free(km1); EVP_KEYMGMT_free(km2); + EVP_KEYMGMT_free(km3); return ret; } |