Skip to content

Commit

Permalink
Merge pull request #7341 from dgarske/psk_openssl
Browse files Browse the repository at this point in the history
Fix for PSK callback with OPENSSL_EXTRA to correctly handle the 0 length
  • Loading branch information
JacobBarthelmeh authored Mar 15, 2024
2 parents 2f43cc1 + 8d1714a commit 5a5648a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -13364,15 +13364,17 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
MAX_PSK_ID_LEN, ssl->arrays->psk_key, MAX_PSK_KEY_LEN);
}
if (
#ifndef OPENSSL_EXTRA
#ifdef OPENSSL_EXTRA
/* OpenSSL treats a PSK key length of 0
* to indicate no PSK available.
*/
ssl->arrays->psk_keySz == 0 ||
#endif
(ssl->arrays->psk_keySz > MAX_PSK_KEY_LEN &&
(int)ssl->arrays->psk_keySz != USE_HW_PSK)) {
#ifndef OPENSSL_EXTRA
ret = PSK_KEY_ERROR;
#endif
}
else {
ssl->arrays->client_identity[MAX_PSK_ID_LEN] = '\0';
Expand Down

0 comments on commit 5a5648a

Please sign in to comment.