Set PSS padding mode for PSS keys.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 30 Nov 2016 16:23:18 +0000 (16:23 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 8 Jan 2017 01:42:47 +0000 (01:42 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2177)

crypto/rsa/rsa_pmeth.c

index 93202815c4ce6ba356e57ee86583ea6683bc7a31..e720a0b2a3dcf766b75dcf61edcba5d19538300e 100644 (file)
@@ -49,7 +49,10 @@ static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
     if (rctx == NULL)
         return 0;
     rctx->nbits = 1024;
     if (rctx == NULL)
         return 0;
     rctx->nbits = 1024;
-    rctx->pad_mode = RSA_PKCS1_PADDING;
+    if (ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS)
+        rctx->pad_mode = RSA_PKCS1_PSS_PADDING;
+    else
+        rctx->pad_mode = RSA_PKCS1_PADDING;
     rctx->saltlen = -2;
     ctx->data = rctx;
     ctx->keygen_info = rctx->gentmp;
     rctx->saltlen = -2;
     ctx->data = rctx;
     ctx->keygen_info = rctx->gentmp;