Skip to content

Commit d505c0b

Browse files
Only reinitialize suites in InitSSL_Side if they were not set by the user. Always allocate suites in InitSSL_Side if they're NULL so InitSSL_Suites will set them.
1 parent 89931bd commit d505c0b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/internal.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,9 +2253,16 @@ int InitSSL_Side(WOLFSSL* ssl, word16 side)
22532253
}
22542254
#endif /* WOLFSSL_DTLS && !NO_WOLFSSL_SERVER */
22552255

2256-
/* Forcefully reinitialize suites here as the side may have changed. */
2257-
FreeSuites(ssl);
2258-
AllocateSuites(ssl);
2256+
/* Forcefully reinitialize suites here as the side may have changed,
2257+
* unless the user has explicitly set cipher suites.
2258+
* Two separate checks to ensure suites are always allocated, to avoid
2259+
* failing suites == NULL check in InitSSL_Suites. */
2260+
if (ssl->suites && !ssl->suites->setSuites) {
2261+
FreeSuites(ssl);
2262+
}
2263+
if (!ssl->suites) {
2264+
AllocateSuites(ssl);
2265+
}
22592266
return InitSSL_Suites(ssl);
22602267
}
22612268
#endif /* OPENSSL_EXTRA || WOLFSSL_EITHER_SIDE ||

0 commit comments

Comments
 (0)