66 #ifndef OPENSSL_NO_CMS
70 #include <openssl/fips.h>
121 if (!pkey_rsa_init(dst))
185 static int pkey_rsa_sign(
EVP_PKEY_CTX *ctx,
unsigned char *sig,
size_t *siglen,
186 const unsigned char *tbs,
size_t tbslen)
193 ret = pkey_fips_check_ctx(ctx);
213 ret = FIPS_rsa_sign_digest(rsa, tbs, tbslen, rctx->
md,
232 tbs, tbslen, sig, &sltmp, rsa);
240 if (!setup_tbuf(rctx, ctx))
242 memcpy(rctx->
tbuf, tbs, tbslen);
252 tbs, tbslen, sig, &sltmp, rsa);
259 if (!setup_tbuf(rctx, ctx))
283 unsigned char *rout,
size_t *routlen,
284 const unsigned char *sig,
size_t siglen)
293 if (!setup_tbuf(rctx, ctx))
301 if (rctx->
tbuf[ret] !=
315 memcpy(rout, rctx->
tbuf, ret);
321 NULL, 0, rout, &sltmp,
340 const unsigned char *sig,
size_t siglen,
341 const unsigned char *tbs,
size_t tbslen)
348 rv = pkey_fips_check_ctx(ctx);
360 return FIPS_rsa_verify_digest(rsa,
375 if (pkey_rsa_verifyrecover(ctx, NULL, &rslen,
382 if (!setup_tbuf(rctx, ctx))
400 if (!setup_tbuf(rctx, ctx))
408 if ((rslen != tbslen) || memcmp(tbs, rctx->
tbuf, rslen))
417 unsigned char *out,
size_t *outlen,
418 const unsigned char *in,
size_t inlen)
431 unsigned char *out,
size_t *outlen,
432 const unsigned char *in,
size_t inlen)
444 static int check_padding_md(
const EVP_MD *md,
int padding)
478 if (!check_padding_md(rctx->
md, p1))
540 if (!check_padding_md(p2, rctx->
pad_mode))
568 #ifndef OPENSSL_NO_CMS
596 const char *type,
const char *value)
603 if (!strcmp(type,
"rsa_padding_mode"))
606 if (!strcmp(value,
"pkcs1"))
608 else if (!strcmp(value,
"sslv23"))
610 else if (!strcmp(value,
"none"))
612 else if (!strcmp(value,
"oeap"))
614 else if (!strcmp(value,
"x931"))
616 else if (!strcmp(value,
"pss"))
627 if (!strcmp(type,
"rsa_pss_saltlen"))
630 saltlen = atoi(value);
634 if (!strcmp(type,
"rsa_keygen_bits"))
641 if (!strcmp(type,
"rsa_keygen_pubexp"))
706 pkey_rsa_verifyrecover,