@@ -897,7 +897,7 @@ static void Dtls13RtxRemoveCurAck(WOLFSSL* ssl)
897897#endif
898898}
899899
900- static void Dtls13MaybeSaveClientHello (WOLFSSL * ssl )
900+ static void Dtls13SaveOrFlushClientHello (WOLFSSL * ssl )
901901{
902902 Dtls13RtxRecord * r , * * prev_next ;
903903
@@ -906,15 +906,18 @@ static void Dtls13MaybeSaveClientHello(WOLFSSL* ssl)
906906
907907 if (ssl -> options .side == WOLFSSL_CLIENT_END &&
908908 ssl -> options .connectState >= CLIENT_HELLO_SENT &&
909- ssl -> options .connectState <= HELLO_AGAIN_REPLY &&
910- ssl -> options .downgrade && ssl -> options .minDowngrade >= DTLSv1_2_MINOR ) {
909+ ssl -> options .connectState <= HELLO_AGAIN_REPLY ) {
911910 while (r != NULL ) {
912911 if (r -> handshakeType == client_hello ) {
913912 Dtls13RtxRecordUnlink (ssl , prev_next , r );
914- XFREE (ssl -> dtls13ClientHello , ssl -> heap , DYNAMIC_TYPE_DTLS_MSG );
915- ssl -> dtls13ClientHello = r -> data ;
916- ssl -> dtls13ClientHelloSz = r -> length ;
917- r -> data = NULL ;
913+ if (ssl -> options .downgrade &&
914+ ssl -> options .minDowngrade >= DTLSv1_2_MINOR ) {
915+ XFREE (ssl -> dtls13ClientHello , ssl -> heap ,
916+ DYNAMIC_TYPE_DTLS_MSG );
917+ ssl -> dtls13ClientHello = r -> data ;
918+ ssl -> dtls13ClientHelloSz = r -> length ;
919+ r -> data = NULL ;
920+ }
918921 Dtls13FreeRtxBufferRecord (ssl , r );
919922 return ;
920923 }
@@ -934,7 +937,7 @@ static int Dtls13RtxMsgRecvd(WOLFSSL* ssl, enum HandShakeType hs,
934937 ssl -> keys .dtls_expected_peer_handshake_number ) {
935938
936939 if (hs == server_hello )
937- Dtls13MaybeSaveClientHello (ssl );
940+ Dtls13SaveOrFlushClientHello (ssl );
938941
939942 /* In the handshake, receiving part of the next flight, acknowledge the
940943 * sent flight. */
0 commit comments