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 9320281..e720a0b 100644 (file)
@@ -49,7 +49,10 @@ static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
     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;