From 0ac71c0d92bc8bb32360744a5b2f3d0b4ab14b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 24 Feb 2023 12:13:55 +0100 Subject: [PATCH] Make debug statement more portable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's little reason for accessing the hash implementation's internal state, its output contains most of the same information. Signed-off-by: Manuel Pégourié-Gonnard --- library/ssl_tls.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 441089f16..778b00638 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -7675,17 +7675,14 @@ static int ssl_calc_finished_tls_sha256( * Hash( handshake ) )[0.11] */ -#if !defined(MBEDTLS_SHA256_ALT) - MBEDTLS_SSL_DEBUG_BUF(4, "finished sha2 state", (unsigned char *) - sha256.state, sizeof(sha256.state)); -#endif - ret = mbedtls_sha256_finish(&sha256, padbuf); if (ret != 0) { goto exit; } #endif /* MBEDTLS_USE_PSA_CRYPTO */ + MBEDTLS_SSL_DEBUG_BUF(4, "finished sha256 output", padbuf, 32); + ssl->handshake->tls_prf(session->master, 48, sender, padbuf, 32, buf, len); @@ -7760,16 +7757,14 @@ static int ssl_calc_finished_tls_sha384( * Hash( handshake ) )[0.11] */ -#if !defined(MBEDTLS_SHA512_ALT) - MBEDTLS_SSL_DEBUG_BUF(4, "finished sha512 state", (unsigned char *) - sha512.state, sizeof(sha512.state)); -#endif ret = mbedtls_sha512_finish(&sha512, padbuf); if (ret != 0) { goto exit; } #endif + MBEDTLS_SSL_DEBUG_BUF(4, "finished sha384 output", padbuf, 48); + ssl->handshake->tls_prf(session->master, 48, sender, padbuf, 48, buf, len);