Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -30957,6 +30957,8 @@ int SetSuitesHashSigAlgo(Suites* suites, const char* list)
#endif /* OPENSSL_EXTRA */

#if !defined(NO_TLS) && (!defined(NO_WOLFSSL_SERVER) || !defined(NO_CERTS))
/* Smallest RSA key able to make an RSA-PSS/SHA-256 signature: emLen >= 2*hLen+2 = 66 bytes (RFC 8017 9.1.1, salt len = hash len). */
#define RSA_PSS_SHA256_MIN_SZ 66 /* bytes: 2*WC_SHA256_DIGEST_SIZE + 2 */
static int MatchSigAlgo(WOLFSSL* ssl, int sigAlgo)
{
#ifdef HAVE_ED25519
Expand Down Expand Up @@ -31019,9 +31021,14 @@ static int MatchSigAlgo(WOLFSSL* ssl, int sigAlgo)
if (IsAtLeastTLSv1_3(ssl->version))
return sigAlgo == rsa_pss_sa_algo;
#endif
/* TLS 1.2 and below - RSA-PSS allowed. */
if (sigAlgo == rsa_pss_sa_algo)
/* TLS 1.2 and below - RSA-PSS allowed, but only if the RSA key is big
* enough to actually produce an RSA-PSS/SHA-256 signature. */
if (sigAlgo == rsa_pss_sa_algo) {
if (ssl->buffers.keySz != 0 &&
ssl->buffers.keySz < RSA_PSS_SHA256_MIN_SZ)
return 0;
return 1;
}
}
#endif
#ifdef HAVE_ECC_BRAINPOOL
Expand Down
Loading