Skip to content

Commit

Permalink
TEST: Adapt test/evp_pkey_provided_test.c to check the key size
Browse files Browse the repository at this point in the history
This is for the case where we build keys from user data

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from #10778)
  • Loading branch information
levitte committed Jan 17, 2020
1 parent 9e5aaf7 commit 81a624f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/evp_pkey_provided_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 81a624f

Please sign in to comment.