tls13: server: parse pre_shared_key only when some psk is selectable

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
Pengyu Lv 2023-10-30 15:26:26 +08:00
parent 7b711710b2
commit cfb23b8090

View File

@ -1728,9 +1728,8 @@ static int ssl_tls13_parse_client_hello(mbedtls_ssl_context *ssl,
* - The content up to but excluding the PSK extension, if present. * - The content up to but excluding the PSK extension, if present.
*/ */
/* If we've settled on a PSK-based exchange, parse PSK identity ext */ /* If we've settled on a PSK-based exchange, parse PSK identity ext */
if (mbedtls_ssl_tls13_some_psk_enabled(ssl) && if (ssl_tls13_check_psk_key_exchange(ssl) ||
mbedtls_ssl_conf_tls13_some_psk_enabled(ssl) && ssl_tls13_check_psk_ephemeral_key_exchange(ssl)) {
(handshake->received_extensions & MBEDTLS_SSL_EXT_MASK(PRE_SHARED_KEY))) {
ret = handshake->update_checksum(ssl, buf, ret = handshake->update_checksum(ssl, buf,
pre_shared_key_ext - buf); pre_shared_key_ext - buf);
if (0 != ret) { if (0 != ret) {