Fix for PSK callback with OPENSSL_EXTRA to correctly handle the 0 length case. Thank you @miyazakh. Broken in #7302

pull/7341/head
David Garske 2024-03-15 08:09:59 -07:00
parent 81c5cf794c
commit 8d1714a307
1 changed files with 3 additions and 1 deletions

View File

@ -13364,7 +13364,7 @@ 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.
*/
@ -13372,7 +13372,9 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
#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';