]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix RSA serializer import calls to use correct selection flags.
authorShane Lontis <shane.lontis@oracle.com>
Fri, 21 Aug 2020 01:15:10 +0000 (11:15 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sun, 30 Aug 2020 06:17:17 +0000 (16:17 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12698)

providers/implementations/encode_decode/encoder_rsa_priv.c
providers/implementations/encode_decode/encoder_rsa_pub.c

index 3ba648f3600699dd91f01fbf70c13f468776751b..7be37dd49ae7a5adf7277de13bc97d6644699f49 100644 (file)
@@ -28,6 +28,9 @@
 #include "prov/provider_ctx.h"
 #include "encoder_local.h"
 
+#define RSA_SELECT_PRIVATE_IMPORTABLE                                          \
+    (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
+
 static OSSL_FUNC_encoder_newctx_fn rsa_priv_newctx;
 static OSSL_FUNC_encoder_freectx_fn rsa_priv_freectx;
 static OSSL_FUNC_encoder_set_ctx_params_fn rsa_priv_set_ctx_params;
@@ -134,7 +137,7 @@ static int rsa_priv_der_data(void *vctx, const OSSL_PARAM params[],
         RSA *rsa;
 
         if ((rsa = rsa_new(ctx->provctx)) != NULL
-            && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+            && rsa_import(rsa, RSA_SELECT_PRIVATE_IMPORTABLE, params)
             && rsa_priv_der(ctx, rsa, out, cb, cbarg))
             ok = 1;
         rsa_free(rsa);
@@ -180,7 +183,7 @@ static int rsa_pem_priv_data(void *vctx, const OSSL_PARAM params[],
         RSA *rsa;
 
         if ((rsa = rsa_new(ctx->provctx)) != NULL
-            && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+            && rsa_import(rsa, RSA_SELECT_PRIVATE_IMPORTABLE, params)
             && rsa_pem_priv(ctx, rsa, out, cb, cbarg))
             ok = 1;
         rsa_free(rsa);
@@ -237,7 +240,7 @@ static int rsa_priv_print_data(void *vctx, const OSSL_PARAM params[],
         RSA *rsa;
 
         if ((rsa = rsa_new(ctx->provctx)) != NULL
-            && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+            && rsa_import(rsa, RSA_SELECT_PRIVATE_IMPORTABLE, params)
             && rsa_priv_print(ctx, rsa, out, cb, cbarg))
             ok = 1;
         rsa_free(rsa);
index 29e71cc093b4875d9e4273b227919706931e0b36..73bb466767e3da1ed14209761df84afc1ab414da 100644 (file)
@@ -24,6 +24,9 @@
 #include "prov/provider_ctx.h"
 #include "encoder_local.h"
 
+#define RSA_SELECT_PUBLIC_IMPORTABLE                                           \
+    (OSSL_KEYMGMT_SELECT_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
+
 static OSSL_FUNC_encoder_newctx_fn rsa_pub_newctx;
 static OSSL_FUNC_encoder_freectx_fn rsa_pub_freectx;
 static OSSL_FUNC_encoder_encode_data_fn rsa_pub_der_data;
@@ -63,7 +66,7 @@ static int rsa_pub_der_data(void *ctx, const OSSL_PARAM params[],
 
         /* ctx == provctx */
         if ((rsa = rsa_new(ctx)) != NULL
-            && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+            && rsa_import(rsa, RSA_SELECT_PUBLIC_IMPORTABLE, params)
             && rsa_pub_der(ctx, rsa, out, cb, cbarg))
             ok = 1;
         rsa_free(rsa);
@@ -104,7 +107,7 @@ static int rsa_pub_pem_data(void *ctx, const OSSL_PARAM params[],
 
         /* ctx == provctx */
         if ((rsa = rsa_new(ctx)) != NULL
-            && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+            && rsa_import(rsa, RSA_SELECT_PUBLIC_IMPORTABLE, params)
             && rsa_pub_pem(ctx, rsa, out, cb, cbarg))
             ok = 1;
         rsa_free(rsa);
@@ -144,7 +147,7 @@ static int rsa_pub_print_data(void *ctx, const OSSL_PARAM params[],
 
         /* ctx == provctx */
         if ((rsa = rsa_new(ctx)) != NULL
-            && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+            && rsa_import(rsa, RSA_SELECT_PUBLIC_IMPORTABLE, params)
             && rsa_pub_print(ctx, rsa, out, cb, cbarg))
             ok = 1;
         rsa_free(rsa);