Make debug statement more portable
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 <manuel.pegourie-gonnard@arm.com>
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 441089f..778b006 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -7675,17 +7675,14 @@
* 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 @@
* 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);