mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Improve some debug messages and error codes
On a parsing error in TLS, return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE, not a crypto error code. On error paths, emit a level-1 debug message. Report the offending sizes. Downgrade an informational message's level to 3. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@ -1518,6 +1518,9 @@ int mbedtls_ssl_tls13_read_public_xxdhe_share(mbedtls_ssl_context *ssl,
|
||||
|
||||
/* Store peer's ECDH/FFDH public key. */
|
||||
if (peerkey_len > sizeof(handshake->xxdh_psa_peerkey)) {
|
||||
MBEDTLS_SSL_DEBUG_MSG(1, ("Invalid public key length: %u > %" MBEDTLS_PRINTF_SIZET,
|
||||
(unsigned) peerkey_len,
|
||||
sizeof(handshake->xxdh_psa_peerkey)));
|
||||
return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
||||
}
|
||||
memcpy(handshake->xxdh_psa_peerkey, p, peerkey_len);
|
||||
|
Reference in New Issue
Block a user