summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-01-08 03:50:33 +0100
committerRichard Levitte <levitte@openssl.org>2020-01-17 09:04:04 +0100
commit81a624f2c215eb9def0917184b026b2e2db2dd54 (patch)
tree86fa131c7a2bf9007e96fe61a96db97cf29c5048
parentPROV: Adapt the RSA, DSA and DH KEYMGMT implementations (diff)
downloadopenssl-81a624f2c215eb9def0917184b026b2e2db2dd54.tar.xz
openssl-81a624f2c215eb9def0917184b026b2e2db2dd54.zip
TEST: Adapt test/evp_pkey_provided_test.c to check the key size
This is for the case where we build keys from user data Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10778)
-rw-r--r--test/evp_pkey_provided_test.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c
index 029a8e425a..8101585d95 100644
--- a/test/evp_pkey_provided_test.c
+++ b/test/evp_pkey_provided_test.c
@@ -126,7 +126,10 @@ static int test_fromdata_rsa(void)
goto err;
if (!TEST_true(EVP_PKEY_key_fromdata_init(ctx))
- || !TEST_true(EVP_PKEY_fromdata(ctx, &pk, fromdata_params)))
+ || !TEST_true(EVP_PKEY_fromdata(ctx, &pk, fromdata_params))
+ || !TEST_int_eq(EVP_PKEY_bits(pk), 32)
+ || !TEST_int_eq(EVP_PKEY_security_bits(pk), 8)
+ || !TEST_int_eq(EVP_PKEY_size(pk), 4))
goto err;
ret = test_print_key_using_pem(pk)
@@ -176,7 +179,10 @@ static int test_fromdata_dh(void)
goto err;
if (!TEST_true(EVP_PKEY_key_fromdata_init(ctx))
- || !TEST_true(EVP_PKEY_fromdata(ctx, &pk, fromdata_params)))
+ || !TEST_true(EVP_PKEY_fromdata(ctx, &pk, fromdata_params))
+ || !TEST_int_eq(EVP_PKEY_bits(pk), 32)
+ || !TEST_int_eq(EVP_PKEY_security_bits(pk), 0) /* Missing Q */
+ || !TEST_int_eq(EVP_PKEY_size(pk), 4))
goto err;
ret = test_print_key_using_pem(pk)