EVP, PROV: Add misc missing bits for RSA-PSS
authorRichard Levitte <levitte@openssl.org>
Mon, 20 Jul 2020 14:09:47 +0000 (16:09 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 27 Jul 2020 10:15:29 +0000 (12:15 +0200)
- EVP_PKEY_is_a() didn't recognise "RSA-PSS" for legacy keys.
- The RSA-PSS keymgmt didn't have a OSSL_FUNC_keymgmt_match() function.
- ossl_prov_prepare_rsa_params() didn't return 1 for unrestricted
  RSA-PSS params.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12492)

crypto/evp/p_lib.c
providers/implementations/keymgmt/rsa_kmgmt.c
providers/implementations/serializers/serializer_rsa.c

index 65a767b4d03b9dfe7ada4f76af5137dd4d9b4821..a7fd687dd0b6c36de981272915e0b12c7c6ad225 100644 (file)
@@ -935,6 +935,8 @@ int EVP_PKEY_is_a(const EVP_PKEY *pkey, const char *name)
 
         if (strcasecmp(name, "RSA") == 0)
             type = EVP_PKEY_RSA;
+        else if (strcasecmp(name, "RSA-PSS") == 0)
+            type = EVP_PKEY_RSA_PSS;
 #ifndef OPENSSL_NO_EC
         else if (strcasecmp(name, "EC") == 0)
             type = EVP_PKEY_EC;
index 3231c020c96bbb5a29945326303a538240a3a751..21a35d7d9a4b5d60f9072c2dc8b4d9ffcccf460b 100644 (file)
@@ -632,6 +632,7 @@ const OSSL_DISPATCH rsapss_keymgmt_functions[] = {
     { OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*) (void))rsa_get_params },
     { OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS, (void (*) (void))rsa_gettable_params },
     { OSSL_FUNC_KEYMGMT_HAS, (void (*)(void))rsa_has },
+    { OSSL_FUNC_KEYMGMT_MATCH, (void (*)(void))rsa_match },
     { OSSL_FUNC_KEYMGMT_VALIDATE, (void (*)(void))rsa_validate },
     { OSSL_FUNC_KEYMGMT_IMPORT, (void (*)(void))rsa_import },
     { OSSL_FUNC_KEYMGMT_IMPORT_TYPES, (void (*)(void))rsa_import_types },
index d0cea458d123daf4532d8b35411a05f23aa5c6e1..d2a54598280ca81b634f7c032ac16222d56093b2 100644 (file)
@@ -199,6 +199,7 @@ int ossl_prov_prepare_rsa_params(const void *rsa, int nid,
     case RSA_FLAG_TYPE_RSASSAPSS:
         if (rsa_pss_params_30_is_unrestricted(pss)) {
             *pstrtype = V_ASN1_UNDEF;
+            return 1;
         } else {
             ASN1_STRING *astr = NULL;
             WPACKET pkt;