EVP: Clarify the states of an EVP_PKEY
[openssl.git] / providers / implementations / keymgmt / rsa_kmgmt.c
index 4e77f5c4a79d368afe36ff168ad8d4a4fbd85482..2826d337b4fa34049733cc9df3c1708c691bef4b 100644 (file)
@@ -198,14 +198,19 @@ static int rsa_has(void *keydata, int selection)
     RSA *rsa = keydata;
     int ok = 0;
 
-    if ((selection & RSA_POSSIBLE_SELECTIONS) != 0)
-        ok = 1;
-
-    ok = ok && (RSA_get0_e(rsa) != NULL);
-    if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
-        ok = ok && (RSA_get0_n(rsa) != NULL);
-    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
-        ok = ok && (RSA_get0_d(rsa) != NULL);
+    if (rsa != NULL) {
+        if ((selection & RSA_POSSIBLE_SELECTIONS) != 0)
+            ok = 1;
+
+        if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0)
+            ok = ok && 0;     /* This will change with PSS and OAEP */
+        if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0)
+            ok = ok && (RSA_get0_e(rsa) != NULL);
+        if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
+            ok = ok && (RSA_get0_n(rsa) != NULL);
+        if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
+            ok = ok && (RSA_get0_d(rsa) != NULL);
+    }
     return ok;
 }