summaryrefslogtreecommitdiffstats
path: root/test/evp_pkey_provided_test.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-01-29 20:32:32 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-01-29 20:32:32 +1000
commit12603de634fe628488066d1f3f2c720ca20d6df9 (patch)
treea7345e533ae5811eeb682a7cf8d02c6a8008b6f6 /test/evp_pkey_provided_test.c
parenta76ce2862bc6ae2cf8a749c8747d371041fc42d1 (diff)
Add RSA key validation to default provider
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10780)
Diffstat (limited to 'test/evp_pkey_provided_test.c')
-rw-r--r--test/evp_pkey_provided_test.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c
index 8101585d95..a39fa0a724 100644
--- a/test/evp_pkey_provided_test.c
+++ b/test/evp_pkey_provided_test.c
@@ -92,7 +92,7 @@ err:
static int test_fromdata_rsa(void)
{
int ret = 0;
- EVP_PKEY_CTX *ctx = NULL;
+ EVP_PKEY_CTX *ctx = NULL, *key_ctx = NULL;
EVP_PKEY *pk = NULL;
/*
* 32-bit RSA key, extracted from this command,
@@ -132,11 +132,21 @@ static int test_fromdata_rsa(void)
|| !TEST_int_eq(EVP_PKEY_size(pk), 4))
goto err;
+ if (!TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pk, "")))
+ goto err;
+
+ if (!TEST_true(EVP_PKEY_check(key_ctx))
+ || !TEST_true(EVP_PKEY_public_check(key_ctx))
+ || !TEST_true(EVP_PKEY_private_check(key_ctx))
+ || !TEST_true(EVP_PKEY_pairwise_check(key_ctx)))
+ goto err;
+
ret = test_print_key_using_pem(pk)
| test_print_key_using_serializer(pk);
err:
EVP_PKEY_free(pk);
+ EVP_PKEY_CTX_free(key_ctx);
EVP_PKEY_CTX_free(ctx);
return ret;