@@ -9063,6 +9063,9 @@ static void TLSX_KeyShare_FreeAll(KeyShareEntry* list, void* heap)
90639063 if (WOLFSSL_NAMED_GROUP_IS_FFDHE(current->group)) {
90649064#ifndef NO_DH
90659065 wc_FreeDhKey((DhKey*)current->key);
9066+ if (current->privKey != NULL && current->privKeyLen > 0) {
9067+ ForceZero(current->privKey, current->privKeyLen);
9068+ }
90669069#endif
90679070 }
90689071 else if (current->group == WOLFSSL_ECC_X25519) {
@@ -17369,8 +17372,8 @@ static word16 TLSX_GetMinSize_Server(const word16 *type)
1736917372
1737017373
1737117374/** Parses a buffer of TLS extensions. */
17372- int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length, byte msgType ,
17373- Suites *suites)
17375+ WOLFSSL_TEST_VIS int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length,
17376+ byte msgType, Suites *suites)
1737417377{
1737517378 int ret = 0;
1737617379 word16 offset = 0;
@@ -17992,6 +17995,20 @@ int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length, byte msgType,
1799217995#ifdef WOLFSSL_SRTP
1799317996 case TLSX_USE_SRTP:
1799417997 WOLFSSL_MSG("Use SRTP extension received");
17998+
17999+ #if defined(WOLFSSL_TLS13)
18000+ if (IsAtLeastTLSv1_3(ssl->version)) {
18001+ if (msgType != client_hello &&
18002+ msgType != encrypted_extensions)
18003+ return EXT_NOT_ALLOWED;
18004+ }
18005+ else
18006+ #endif
18007+ {
18008+ if (msgType != client_hello &&
18009+ msgType != server_hello)
18010+ return EXT_NOT_ALLOWED;
18011+ }
1799518012 ret = SRTP_PARSE(ssl, input + offset, size, isRequest);
1799618013 break;
1799718014#endif
@@ -18086,6 +18103,15 @@ int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length, byte msgType,
1808618103#if defined(WOLFSSL_TLS13) && defined(HAVE_ECH)
1808718104 case TLSX_ECH:
1808818105 WOLFSSL_MSG("ECH extension received");
18106+ if (!IsAtLeastTLSv1_3(ssl->version))
18107+ break;
18108+
18109+ if (msgType != client_hello &&
18110+ msgType != encrypted_extensions &&
18111+ msgType != hello_retry_request) {
18112+ return EXT_NOT_ALLOWED;
18113+ }
18114+
1808918115 ret = ECH_PARSE(ssl, input + offset, size, msgType);
1809018116 break;
1809118117 case TLSXT_ECH_OUTER_EXTENSIONS:
0 commit comments