Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -23523,7 +23523,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,

wc_Md5Free(&md5);
}
else {
else if (ssl->specs.mac_algorithm == sha_mac) {
ret = wc_InitSha_ex(&sha, ssl->heap, ssl->devId);
if (ret != 0)
return ret;
Expand Down Expand Up @@ -23573,6 +23573,10 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,

wc_ShaFree(&sha);
}
else {
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
return 0;
}
#endif /* !NO_OLD_TLS && !WOLFSSL_AEAD_ONLY */
Expand Down
14 changes: 14 additions & 0 deletions src/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ int SetCipherSpecs(WOLFSSL* ssl)
ssl->options.cipherSuite, &ssl->specs,
&ssl->options);
if (ret == 0) {
#ifdef WOLFSSL_ALLOW_SSLV3
/* SSLv3 (RFC 6101) defines MAC algorithms as MD5 and SHA-1. SHA-256
* was introduced in TLS 1.2 (RFC 5246). SSL_hmac for old SSLv3
* connections can not handle newer cipher suites that use digest sizes
* larger than SHA-1 */
if (ssl->version.major == SSLv3_MAJOR &&
ssl->version.minor == SSLv3_MINOR &&
ssl->specs.hash_size > WC_SHA_DIGEST_SIZE) {
WOLFSSL_MSG("SSLv3 does not support SHA-256 or higher MAC");
WOLFSSL_ERROR_VERBOSE(UNSUPPORTED_SUITE);
return UNSUPPORTED_SUITE;
}
#endif /* WOLFSSL_ALLOW_SSLV3 */

/* set TLS if it hasn't been turned off */
if (ssl->version.major == SSLv3_MAJOR &&
ssl->version.minor >= TLSv1_MINOR) {
Expand Down