2 * Copyright 2006-2019 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "internal/constant_time_locl.h"
13 #include "internal/cryptlib.h"
14 #include <openssl/asn1t.h>
15 #include <openssl/x509.h>
16 #include <openssl/rsa.h>
17 #include <openssl/bn.h>
18 #include <openssl/evp.h>
19 #include <openssl/x509v3.h>
20 #include <openssl/cms.h>
21 #include "internal/evp_int.h"
24 /* RSA pkey context structure */
27 /* Key gen parameters */
31 /* Keygen callback info */
33 /* RSA padding mode */
37 /* message digest for MGF1 */
41 /* Minimum salt length or -1 if no PSS parameter restriction */
46 unsigned char *oaep_label;
50 /* True if PSS parameters are restricted */
51 #define rsa_pss_restricted(rctx) (rctx->min_saltlen != -1)
53 static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
55 RSA_PKEY_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));
60 rctx->primes = RSA_DEFAULT_PRIME_NUM;
61 if (pkey_ctx_is_pss(ctx))
62 rctx->pad_mode = RSA_PKCS1_PSS_PADDING;
64 rctx->pad_mode = RSA_PKCS1_PADDING;
65 /* Maximum for sign, auto for verify */
66 rctx->saltlen = RSA_PSS_SALTLEN_AUTO;
67 rctx->min_saltlen = -1;
69 ctx->keygen_info = rctx->gentmp;
70 ctx->keygen_info_count = 2;
75 static int pkey_rsa_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
77 RSA_PKEY_CTX *dctx, *sctx;
79 if (!pkey_rsa_init(dst))
83 dctx->nbits = sctx->nbits;
85 dctx->pub_exp = BN_dup(sctx->pub_exp);
89 dctx->pad_mode = sctx->pad_mode;
91 dctx->mgf1md = sctx->mgf1md;
92 if (sctx->oaep_label) {
93 OPENSSL_free(dctx->oaep_label);
94 dctx->oaep_label = OPENSSL_memdup(sctx->oaep_label, sctx->oaep_labellen);
95 if (!dctx->oaep_label)
97 dctx->oaep_labellen = sctx->oaep_labellen;
102 static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk)
104 if (ctx->tbuf != NULL)
106 if ((ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey))) == NULL) {
107 RSAerr(RSA_F_SETUP_TBUF, ERR_R_MALLOC_FAILURE);
113 static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx)
115 RSA_PKEY_CTX *rctx = ctx->data;
117 BN_free(rctx->pub_exp);
118 OPENSSL_free(rctx->tbuf);
119 OPENSSL_free(rctx->oaep_label);
124 static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig,
125 size_t *siglen, const unsigned char *tbs,
129 RSA_PKEY_CTX *rctx = ctx->data;
130 RSA *rsa = ctx->pkey->pkey.rsa;
133 if (tbslen != (size_t)EVP_MD_size(rctx->md)) {
134 RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_INVALID_DIGEST_LENGTH);
138 if (EVP_MD_type(rctx->md) == NID_mdc2) {
140 if (rctx->pad_mode != RSA_PKCS1_PADDING)
142 ret = RSA_sign_ASN1_OCTET_STRING(0,
143 tbs, tbslen, sig, &sltmp, rsa);
148 } else if (rctx->pad_mode == RSA_X931_PADDING) {
149 if ((size_t)EVP_PKEY_size(ctx->pkey) < tbslen + 1) {
150 RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_KEY_SIZE_TOO_SMALL);
153 if (!setup_tbuf(rctx, ctx)) {
154 RSAerr(RSA_F_PKEY_RSA_SIGN, ERR_R_MALLOC_FAILURE);
157 memcpy(rctx->tbuf, tbs, tbslen);
158 rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_type(rctx->md));
159 ret = RSA_private_encrypt(tbslen + 1, rctx->tbuf,
160 sig, rsa, RSA_X931_PADDING);
161 } else if (rctx->pad_mode == RSA_PKCS1_PADDING) {
163 ret = RSA_sign(EVP_MD_type(rctx->md),
164 tbs, tbslen, sig, &sltmp, rsa);
168 } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) {
169 if (!setup_tbuf(rctx, ctx))
171 if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa,
173 rctx->md, rctx->mgf1md,
176 ret = RSA_private_encrypt(RSA_size(rsa), rctx->tbuf,
177 sig, rsa, RSA_NO_PADDING);
182 ret = RSA_private_encrypt(tbslen, tbs, sig, ctx->pkey->pkey.rsa,
191 static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx,
192 unsigned char *rout, size_t *routlen,
193 const unsigned char *sig, size_t siglen)
196 RSA_PKEY_CTX *rctx = ctx->data;
199 if (rctx->pad_mode == RSA_X931_PADDING) {
200 if (!setup_tbuf(rctx, ctx))
202 ret = RSA_public_decrypt(siglen, sig,
203 rctx->tbuf, ctx->pkey->pkey.rsa,
208 if (rctx->tbuf[ret] != RSA_X931_hash_id(EVP_MD_type(rctx->md))) {
209 RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
210 RSA_R_ALGORITHM_MISMATCH);
213 if (ret != EVP_MD_size(rctx->md)) {
214 RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
215 RSA_R_INVALID_DIGEST_LENGTH);
219 memcpy(rout, rctx->tbuf, ret);
220 } else if (rctx->pad_mode == RSA_PKCS1_PADDING) {
222 ret = int_rsa_verify(EVP_MD_type(rctx->md),
223 NULL, 0, rout, &sltmp,
224 sig, siglen, ctx->pkey->pkey.rsa);
232 ret = RSA_public_decrypt(siglen, sig, rout, ctx->pkey->pkey.rsa,
241 static int pkey_rsa_verify(EVP_PKEY_CTX *ctx,
242 const unsigned char *sig, size_t siglen,
243 const unsigned char *tbs, size_t tbslen)
245 RSA_PKEY_CTX *rctx = ctx->data;
246 RSA *rsa = ctx->pkey->pkey.rsa;
250 if (rctx->pad_mode == RSA_PKCS1_PADDING)
251 return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen,
253 if (tbslen != (size_t)EVP_MD_size(rctx->md)) {
254 RSAerr(RSA_F_PKEY_RSA_VERIFY, RSA_R_INVALID_DIGEST_LENGTH);
257 if (rctx->pad_mode == RSA_X931_PADDING) {
258 if (pkey_rsa_verifyrecover(ctx, NULL, &rslen, sig, siglen) <= 0)
260 } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) {
262 if (!setup_tbuf(rctx, ctx))
264 ret = RSA_public_decrypt(siglen, sig, rctx->tbuf,
265 rsa, RSA_NO_PADDING);
268 ret = RSA_verify_PKCS1_PSS_mgf1(rsa, tbs,
269 rctx->md, rctx->mgf1md,
270 rctx->tbuf, rctx->saltlen);
278 if (!setup_tbuf(rctx, ctx))
280 rslen = RSA_public_decrypt(siglen, sig, rctx->tbuf,
281 rsa, rctx->pad_mode);
286 if ((rslen != tbslen) || memcmp(tbs, rctx->tbuf, rslen))
293 static int pkey_rsa_encrypt(EVP_PKEY_CTX *ctx,
294 unsigned char *out, size_t *outlen,
295 const unsigned char *in, size_t inlen)
298 RSA_PKEY_CTX *rctx = ctx->data;
300 if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
301 int klen = RSA_size(ctx->pkey->pkey.rsa);
302 if (!setup_tbuf(rctx, ctx))
304 if (!RSA_padding_add_PKCS1_OAEP_mgf1(rctx->tbuf, klen,
308 rctx->md, rctx->mgf1md))
310 ret = RSA_public_encrypt(klen, rctx->tbuf, out,
311 ctx->pkey->pkey.rsa, RSA_NO_PADDING);
313 ret = RSA_public_encrypt(inlen, in, out, ctx->pkey->pkey.rsa,
322 static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
323 unsigned char *out, size_t *outlen,
324 const unsigned char *in, size_t inlen)
327 RSA_PKEY_CTX *rctx = ctx->data;
329 if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
330 if (!setup_tbuf(rctx, ctx))
332 ret = RSA_private_decrypt(inlen, in, rctx->tbuf,
333 ctx->pkey->pkey.rsa, RSA_NO_PADDING);
336 ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf,
340 rctx->md, rctx->mgf1md);
342 ret = RSA_private_decrypt(inlen, in, out, ctx->pkey->pkey.rsa,
345 *outlen = constant_time_select_s(constant_time_msb_s(ret), *outlen, ret);
346 ret = constant_time_select_int(constant_time_msb(ret), ret, 1);
350 static int check_padding_md(const EVP_MD *md, int padding)
357 mdnid = EVP_MD_type(md);
359 if (padding == RSA_NO_PADDING) {
360 RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_PADDING_MODE);
364 if (padding == RSA_X931_PADDING) {
365 if (RSA_X931_hash_id(mdnid) == -1) {
366 RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_X931_DIGEST);
371 /* List of all supported RSA digests */
390 RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_DIGEST);
399 static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
401 RSA_PKEY_CTX *rctx = ctx->data;
404 case EVP_PKEY_CTRL_RSA_PADDING:
405 if ((p1 >= RSA_PKCS1_PADDING) && (p1 <= RSA_PKCS1_PSS_PADDING)) {
406 if (!check_padding_md(rctx->md, p1))
408 if (p1 == RSA_PKCS1_PSS_PADDING) {
409 if (!(ctx->operation &
410 (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY)))
413 rctx->md = EVP_sha1();
414 } else if (pkey_ctx_is_pss(ctx)) {
417 if (p1 == RSA_PKCS1_OAEP_PADDING) {
418 if (!(ctx->operation & EVP_PKEY_OP_TYPE_CRYPT))
421 rctx->md = EVP_sha1();
427 RSAerr(RSA_F_PKEY_RSA_CTRL,
428 RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE);
431 case EVP_PKEY_CTRL_GET_RSA_PADDING:
432 *(int *)p2 = rctx->pad_mode;
435 case EVP_PKEY_CTRL_RSA_PSS_SALTLEN:
436 case EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN:
437 if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING) {
438 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PSS_SALTLEN);
441 if (type == EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN) {
442 *(int *)p2 = rctx->saltlen;
444 if (p1 < RSA_PSS_SALTLEN_MAX)
446 if (rsa_pss_restricted(rctx)) {
447 if (p1 == RSA_PSS_SALTLEN_AUTO
448 && ctx->operation == EVP_PKEY_OP_VERIFY) {
449 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PSS_SALTLEN);
452 if ((p1 == RSA_PSS_SALTLEN_DIGEST
453 && rctx->min_saltlen > EVP_MD_size(rctx->md))
454 || (p1 >= 0 && p1 < rctx->min_saltlen)) {
455 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_PSS_SALTLEN_TOO_SMALL);
463 case EVP_PKEY_CTRL_RSA_KEYGEN_BITS:
464 if (p1 < RSA_MIN_MODULUS_BITS) {
465 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_KEY_SIZE_TOO_SMALL);
471 case EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP:
472 if (p2 == NULL || !BN_is_odd((BIGNUM *)p2) || BN_is_one((BIGNUM *)p2)) {
473 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_BAD_E_VALUE);
476 BN_free(rctx->pub_exp);
480 case EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES:
481 if (p1 < RSA_DEFAULT_PRIME_NUM || p1 > RSA_MAX_PRIME_NUM) {
482 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_KEY_PRIME_NUM_INVALID);
488 case EVP_PKEY_CTRL_RSA_OAEP_MD:
489 case EVP_PKEY_CTRL_GET_RSA_OAEP_MD:
490 if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
491 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PADDING_MODE);
494 if (type == EVP_PKEY_CTRL_GET_RSA_OAEP_MD)
495 *(const EVP_MD **)p2 = rctx->md;
500 case EVP_PKEY_CTRL_MD:
501 if (!check_padding_md(p2, rctx->pad_mode))
503 if (rsa_pss_restricted(rctx)) {
504 if (EVP_MD_type(rctx->md) == EVP_MD_type(p2))
506 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_DIGEST_NOT_ALLOWED);
512 case EVP_PKEY_CTRL_GET_MD:
513 *(const EVP_MD **)p2 = rctx->md;
516 case EVP_PKEY_CTRL_RSA_MGF1_MD:
517 case EVP_PKEY_CTRL_GET_RSA_MGF1_MD:
518 if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING
519 && rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
520 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_MGF1_MD);
523 if (type == EVP_PKEY_CTRL_GET_RSA_MGF1_MD) {
525 *(const EVP_MD **)p2 = rctx->mgf1md;
527 *(const EVP_MD **)p2 = rctx->md;
529 if (rsa_pss_restricted(rctx)) {
530 if (EVP_MD_type(rctx->mgf1md) == EVP_MD_type(p2))
532 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_MGF1_DIGEST_NOT_ALLOWED);
539 case EVP_PKEY_CTRL_RSA_OAEP_LABEL:
540 if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
541 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PADDING_MODE);
544 OPENSSL_free(rctx->oaep_label);
546 rctx->oaep_label = p2;
547 rctx->oaep_labellen = p1;
549 rctx->oaep_label = NULL;
550 rctx->oaep_labellen = 0;
554 case EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL:
555 if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
556 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PADDING_MODE);
559 *(unsigned char **)p2 = rctx->oaep_label;
560 return rctx->oaep_labellen;
562 case EVP_PKEY_CTRL_DIGESTINIT:
563 case EVP_PKEY_CTRL_PKCS7_SIGN:
564 #ifndef OPENSSL_NO_CMS
565 case EVP_PKEY_CTRL_CMS_SIGN:
569 case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
570 case EVP_PKEY_CTRL_PKCS7_DECRYPT:
571 #ifndef OPENSSL_NO_CMS
572 case EVP_PKEY_CTRL_CMS_DECRYPT:
573 case EVP_PKEY_CTRL_CMS_ENCRYPT:
575 if (!pkey_ctx_is_pss(ctx))
578 case EVP_PKEY_CTRL_PEER_KEY:
579 RSAerr(RSA_F_PKEY_RSA_CTRL,
580 RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
589 static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx,
590 const char *type, const char *value)
593 RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_VALUE_MISSING);
596 if (strcmp(type, "rsa_padding_mode") == 0) {
599 if (strcmp(value, "pkcs1") == 0) {
600 pm = RSA_PKCS1_PADDING;
601 } else if (strcmp(value, "sslv23") == 0) {
602 pm = RSA_SSLV23_PADDING;
603 } else if (strcmp(value, "none") == 0) {
605 } else if (strcmp(value, "oeap") == 0) {
606 pm = RSA_PKCS1_OAEP_PADDING;
607 } else if (strcmp(value, "oaep") == 0) {
608 pm = RSA_PKCS1_OAEP_PADDING;
609 } else if (strcmp(value, "x931") == 0) {
610 pm = RSA_X931_PADDING;
611 } else if (strcmp(value, "pss") == 0) {
612 pm = RSA_PKCS1_PSS_PADDING;
614 RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_UNKNOWN_PADDING_TYPE);
617 return EVP_PKEY_CTX_set_rsa_padding(ctx, pm);
620 if (strcmp(type, "rsa_pss_saltlen") == 0) {
623 if (!strcmp(value, "digest"))
624 saltlen = RSA_PSS_SALTLEN_DIGEST;
625 else if (!strcmp(value, "max"))
626 saltlen = RSA_PSS_SALTLEN_MAX;
627 else if (!strcmp(value, "auto"))
628 saltlen = RSA_PSS_SALTLEN_AUTO;
630 saltlen = atoi(value);
631 return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
634 if (strcmp(type, "rsa_keygen_bits") == 0) {
635 int nbits = atoi(value);
637 return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits);
640 if (strcmp(type, "rsa_keygen_pubexp") == 0) {
643 BIGNUM *pubexp = NULL;
644 if (!BN_asc2bn(&pubexp, value))
646 ret = EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp);
652 if (strcmp(type, "rsa_keygen_primes") == 0) {
653 int nprimes = atoi(value);
655 return EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, nprimes);
658 if (strcmp(type, "rsa_mgf1_md") == 0)
659 return EVP_PKEY_CTX_md(ctx,
660 EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT,
661 EVP_PKEY_CTRL_RSA_MGF1_MD, value);
663 if (pkey_ctx_is_pss(ctx)) {
665 if (strcmp(type, "rsa_pss_keygen_mgf1_md") == 0)
666 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN,
667 EVP_PKEY_CTRL_RSA_MGF1_MD, value);
669 if (strcmp(type, "rsa_pss_keygen_md") == 0)
670 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN,
671 EVP_PKEY_CTRL_MD, value);
673 if (strcmp(type, "rsa_pss_keygen_saltlen") == 0) {
674 int saltlen = atoi(value);
676 return EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, saltlen);
680 if (strcmp(type, "rsa_oaep_md") == 0)
681 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_CRYPT,
682 EVP_PKEY_CTRL_RSA_OAEP_MD, value);
684 if (strcmp(type, "rsa_oaep_label") == 0) {
689 lab = OPENSSL_hexstr2buf(value, &lablen);
692 ret = EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, lab, lablen);
701 /* Set PSS parameters when generating a key, if necessary */
702 static int rsa_set_pss_param(RSA *rsa, EVP_PKEY_CTX *ctx)
704 RSA_PKEY_CTX *rctx = ctx->data;
706 if (!pkey_ctx_is_pss(ctx))
708 /* If all parameters are default values don't set pss */
709 if (rctx->md == NULL && rctx->mgf1md == NULL && rctx->saltlen == -2)
711 rsa->pss = rsa_pss_params_create(rctx->md, rctx->mgf1md,
712 rctx->saltlen == -2 ? 0 : rctx->saltlen);
713 if (rsa->pss == NULL)
718 static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
721 RSA_PKEY_CTX *rctx = ctx->data;
725 if (rctx->pub_exp == NULL) {
726 rctx->pub_exp = BN_new();
727 if (rctx->pub_exp == NULL || !BN_set_word(rctx->pub_exp, RSA_F4))
733 if (ctx->pkey_gencb) {
734 pcb = BN_GENCB_new();
739 evp_pkey_set_cb_translate(pcb, ctx);
743 ret = RSA_generate_multi_prime_key(rsa, rctx->nbits, rctx->primes,
746 if (ret > 0 && !rsa_set_pss_param(rsa, ctx)) {
751 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, rsa);
757 const EVP_PKEY_METHOD rsa_pkey_meth = {
759 EVP_PKEY_FLAG_AUTOARGLEN,
776 pkey_rsa_verifyrecover,
793 * Called for PSS sign or verify initialisation: checks PSS parameter
794 * sanity and sets any restrictions on key usage.
797 static int pkey_pss_init(EVP_PKEY_CTX *ctx)
800 RSA_PKEY_CTX *rctx = ctx->data;
802 const EVP_MD *mgf1md;
803 int min_saltlen, max_saltlen;
805 /* Should never happen */
806 if (!pkey_ctx_is_pss(ctx))
808 rsa = ctx->pkey->pkey.rsa;
809 /* If no restrictions just return */
810 if (rsa->pss == NULL)
812 /* Get and check parameters */
813 if (!rsa_pss_get_param(rsa->pss, &md, &mgf1md, &min_saltlen))
816 /* See if minimum salt length exceeds maximum possible */
817 max_saltlen = RSA_size(rsa) - EVP_MD_size(md);
818 if ((RSA_bits(rsa) & 0x7) == 1)
820 if (min_saltlen > max_saltlen) {
821 RSAerr(RSA_F_PKEY_PSS_INIT, RSA_R_INVALID_SALT_LENGTH);
825 rctx->min_saltlen = min_saltlen;
828 * Set PSS restrictions as defaults: we can then block any attempt to
829 * use invalid values in pkey_rsa_ctrl
833 rctx->mgf1md = mgf1md;
834 rctx->saltlen = min_saltlen;
839 const EVP_PKEY_METHOD rsa_pss_pkey_meth = {
841 EVP_PKEY_FLAG_AUTOARGLEN,
857 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,