diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-01-29 20:32:32 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-01-29 20:32:32 +1000 |
commit | 12603de634fe628488066d1f3f2c720ca20d6df9 (patch) | |
tree | a7345e533ae5811eeb682a7cf8d02c6a8008b6f6 /providers | |
parent | a76ce2862bc6ae2cf8a749c8747d371041fc42d1 (diff) |
Add RSA key validation to default provider
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10780)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/keymgmt/rsa_kmgmt.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/providers/implementations/keymgmt/rsa_kmgmt.c b/providers/implementations/keymgmt/rsa_kmgmt.c index 54e4c540d9..e205a412f3 100644 --- a/providers/implementations/keymgmt/rsa_kmgmt.c +++ b/providers/implementations/keymgmt/rsa_kmgmt.c @@ -23,6 +23,9 @@ static OSSL_OP_keymgmt_importkey_fn rsa_importkey; static OSSL_OP_keymgmt_exportkey_fn rsa_exportkey; static OSSL_OP_keymgmt_get_key_params_fn rsa_get_key_params; +static OSSL_OP_keymgmt_validate_public_fn rsa_validatekey_public; +static OSSL_OP_keymgmt_validate_private_fn rsa_validatekey_private; +static OSSL_OP_keymgmt_validate_pairwise_fn rsa_validatekey_pairwise; #define RSA_DEFAULT_MD "SHA256" @@ -288,6 +291,27 @@ static int rsa_get_key_params(void *key, OSSL_PARAM params[]) return 1; } +static int rsa_validatekey_public(void *key) +{ + RSA *rsa = key; + + return rsa_validate_public(rsa); +} + +static int rsa_validatekey_private(void *key) +{ + RSA *rsa = key; + + return rsa_validate_private(rsa); +} + +static int rsa_validatekey_pairwise(void *key) +{ + RSA *rsa = key; + + return rsa_validate_pairwise(rsa); +} + const OSSL_DISPATCH rsa_keymgmt_functions[] = { { OSSL_FUNC_KEYMGMT_IMPORTKEY, (void (*)(void))rsa_importkey }, { OSSL_FUNC_KEYMGMT_IMPORTKEY_TYPES, (void (*)(void))rsa_importkey_types }, @@ -295,5 +319,11 @@ const OSSL_DISPATCH rsa_keymgmt_functions[] = { { OSSL_FUNC_KEYMGMT_EXPORTKEY_TYPES, (void (*)(void))rsa_exportkey_types }, { OSSL_FUNC_KEYMGMT_FREEKEY, (void (*)(void))RSA_free }, { OSSL_FUNC_KEYMGMT_GET_KEY_PARAMS, (void (*) (void))rsa_get_key_params }, + { OSSL_FUNC_KEYMGMT_VALIDATE_PUBLIC, + (void (*)(void))rsa_validatekey_public }, + { OSSL_FUNC_KEYMGMT_VALIDATE_PRIVATE, + (void (*)(void))rsa_validatekey_private }, + { OSSL_FUNC_KEYMGMT_VALIDATE_PAIRWISE, + (void (*)(void))rsa_validatekey_pairwise }, { 0, NULL } }; |