summaryrefslogtreecommitdiffstats
path: root/crypto/evp/pmeth_check.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-02-17 13:00:34 +1000
committerShane Lontis <shane.lontis@oracle.com>2021-02-22 13:31:31 +1000
commit4718326a46ad460fefc5cc240a8599af4b5993c7 (patch)
treebe4beed6f52122d46ebba91baf9fb59ba586f918 /crypto/evp/pmeth_check.c
parent681618cfc18b4f01f2c07e823308d30f6f47504b (diff)
Add EVP_PKEY_public_check_quick.
Adding the EVP_PKEY_param_check_quick() reminded me that there are also partial checks for public keys as part of SP800-56A for FFC (DH named safe prime groups) and ECC. The code was mainly already there and just needed to be plumbed into the validate methods. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14206)
Diffstat (limited to 'crypto/evp/pmeth_check.c')
-rw-r--r--crypto/evp/pmeth_check.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/crypto/evp/pmeth_check.c b/crypto/evp/pmeth_check.c
index 61e6db655d..112965e794 100644
--- a/crypto/evp/pmeth_check.c
+++ b/crypto/evp/pmeth_check.c
@@ -42,7 +42,7 @@ static int try_provided_check(EVP_PKEY_CTX *ctx, int selection, int checktype)
return evp_keymgmt_validate(keymgmt, keydata, selection, checktype);
}
-int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx)
+static int evp_pkey_public_check_combined(EVP_PKEY_CTX *ctx, int checktype)
{
EVP_PKEY *pkey = ctx->pkey;
int ok;
@@ -53,7 +53,7 @@ int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx)
}
if ((ok = try_provided_check(ctx, OSSL_KEYMGMT_SELECT_PUBLIC_KEY,
- OSSL_KEYMGMT_VALIDATE_FULL_CHECK)) != -1)
+ checktype)) != -1)
return ok;
if (pkey->type == EVP_PKEY_NONE)
@@ -76,6 +76,16 @@ int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx)
return -2;
}
+int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx)
+{
+ return evp_pkey_public_check_combined(ctx, OSSL_KEYMGMT_VALIDATE_FULL_CHECK);
+}
+
+int EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx)
+{
+ return evp_pkey_public_check_combined(ctx, OSSL_KEYMGMT_VALIDATE_QUICK_CHECK);
+}
+
static int evp_pkey_param_check_combined(EVP_PKEY_CTX *ctx, int checktype)
{
EVP_PKEY *pkey = ctx->pkey;