]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Make EVP_PKEY_check() be an alias for EVP_PKEY_pairwise_check()
authorTomas Mraz <tomas@openssl.org>
Tue, 13 Jul 2021 15:41:02 +0000 (17:41 +0200)
committerPauli <pauli@openssl.org>
Thu, 15 Jul 2021 00:54:25 +0000 (10:54 +1000)
The implementation of EVP_PKEY_pairwise_check() is also changed
to handle the legacy keys.

Fixes #16046

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16069)

crypto/evp/pmeth_check.c
doc/man3/EVP_PKEY_check.pod

index 2ecf2d025188e7535bdf9e4aa3f591d0961ca991..7f3a2e3a1c805a5b1c81f53465862d8273572468 100644 (file)
@@ -152,26 +152,12 @@ int EVP_PKEY_private_check(EVP_PKEY_CTX *ctx)
     return -2;
 }
 
-int EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx)
+int EVP_PKEY_check(EVP_PKEY_CTX *ctx)
 {
-    EVP_PKEY *pkey = ctx->pkey;
-    int ok;
-
-    if (pkey == NULL) {
-        ERR_raise(ERR_LIB_EVP, EVP_R_NO_KEY_SET);
-        return 0;
-    }
-
-    if ((ok = try_provided_check(ctx, OSSL_KEYMGMT_SELECT_KEYPAIR,
-                                 OSSL_KEYMGMT_VALIDATE_FULL_CHECK)) != -1)
-        return ok;
-
-    /* not supported for legacy keys */
-    ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
-    return -2;
+    return EVP_PKEY_pairwise_check(ctx);
 }
 
-int EVP_PKEY_check(EVP_PKEY_CTX *ctx)
+int EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx)
 {
     EVP_PKEY *pkey = ctx->pkey;
     int ok;
index dc03671498769542ebd99229d291e07afcef1d53..1ba656fd221c823b9e428f02b7e8c344d37431d4 100644 (file)
@@ -44,7 +44,7 @@ EVP_PKEY_private_check() validates the private component of the key given by B<c
 EVP_PKEY_pairwise_check() validates that the public and private components have
 the correct mathematical relationship to each other for the key given by B<ctx>.
 
-EVP_PKEY_check() validates all components of a key given by B<ctx>.
+EVP_PKEY_check() is an alias for the EVP_PKEY_pairwise_check() function.
 
 =head1 NOTES