diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-01-21 15:45:40 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-03-05 08:25:55 +1000 |
commit | a54ff473df579dffbf70eec637d54e48370b5bdc (patch) | |
tree | 9f130122ebc5a44d07a9f223678f70d67409c218 /test/evp_pkey_provided_test.c | |
parent | b16654a2810c91384d60f30683d83416866e72d2 (diff) |
Add DH key validation to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10911)
Diffstat (limited to 'test/evp_pkey_provided_test.c')
-rw-r--r-- | test/evp_pkey_provided_test.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c index 6f7f3986e9..c395f185dd 100644 --- a/test/evp_pkey_provided_test.c +++ b/test/evp_pkey_provided_test.c @@ -331,7 +331,7 @@ static int test_fromdata_rsa(void) static int test_fromdata_dh(void) { int ret = 0; - EVP_PKEY_CTX *ctx = NULL; + EVP_PKEY_CTX *ctx = NULL, *key_ctx = NULL; EVP_PKEY *pk = NULL; /* * 32-bit DH key, extracted from this command, @@ -367,9 +367,19 @@ static int test_fromdata_dh(void) ret = test_print_key_using_pem("DH", pk) && test_print_key_using_serializer("DH", pk); + if (!TEST_ptr(key_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pk, ""))) + goto err; + + if (!TEST_false(EVP_PKEY_check(key_ctx)) + || !TEST_true(EVP_PKEY_public_check(key_ctx)) + || !TEST_false(EVP_PKEY_private_check(key_ctx)) /* Need a q */ + || !TEST_true(EVP_PKEY_pairwise_check(key_ctx))) + goto err; + err: EVP_PKEY_free(pk); EVP_PKEY_CTX_free(ctx); + EVP_PKEY_CTX_free(key_ctx); return ret; } @@ -552,7 +562,6 @@ err: #endif /* OPENSSL_NO_EC */ - int setup_tests(void) { if (!test_skip_common_options()) { |