Skip to content

Commit 8d1714a

Browse files
committed
Fix for PSK callback with OPENSSL_EXTRA to correctly handle the 0 length case. Thank you @miyazakh. Broken in #7302
1 parent 81c5cf7 commit 8d1714a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tls.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13364,15 +13364,17 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
1336413364
MAX_PSK_ID_LEN, ssl->arrays->psk_key, MAX_PSK_KEY_LEN);
1336513365
}
1336613366
if (
13367-
#ifndef OPENSSL_EXTRA
13367+
#ifdef OPENSSL_EXTRA
1336813368
/* OpenSSL treats a PSK key length of 0
1336913369
* to indicate no PSK available.
1337013370
*/
1337113371
ssl->arrays->psk_keySz == 0 ||
1337213372
#endif
1337313373
(ssl->arrays->psk_keySz > MAX_PSK_KEY_LEN &&
1337413374
(int)ssl->arrays->psk_keySz != USE_HW_PSK)) {
13375+
#ifndef OPENSSL_EXTRA
1337513376
ret = PSK_KEY_ERROR;
13377+
#endif
1337613378
}
1337713379
else {
1337813380
ssl->arrays->client_identity[MAX_PSK_ID_LEN] = '\0';

0 commit comments

Comments
 (0)