From a242e83b21b8d70d0d85d9157f26695f65aebaad Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Thu, 11 Aug 2022 10:03:14 -0400 Subject: [PATCH] Rename the sha384 checksum context to reflect its purpose Signed-off-by: Andrzej Kurek --- library/ssl_misc.h | 2 +- library/ssl_tls.c | 18 +++++++++--------- library/ssl_tls13_generic.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/library/ssl_misc.h b/library/ssl_misc.h index e76086a12c..f019ad2387 100644 --- a/library/ssl_misc.h +++ b/library/ssl_misc.h @@ -794,7 +794,7 @@ struct mbedtls_ssl_handshake_params #if defined(MBEDTLS_USE_PSA_CRYPTO) psa_hash_operation_t fin_sha384_psa; #else - mbedtls_sha512_context fin_sha512; + mbedtls_sha512_context fin_sha384; #endif #endif diff --git a/library/ssl_tls.c b/library/ssl_tls.c index c45a1b84c6..e08a47e6e7 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -573,7 +573,7 @@ void mbedtls_ssl_reset_checksum( mbedtls_ssl_context *ssl ) psa_hash_abort( &ssl->handshake->fin_sha384_psa ); psa_hash_setup( &ssl->handshake->fin_sha384_psa, PSA_ALG_SHA_384 ); #else - mbedtls_sha512_starts( &ssl->handshake->fin_sha512, 1 ); + mbedtls_sha512_starts( &ssl->handshake->fin_sha384, 1 ); #endif #endif } @@ -592,7 +592,7 @@ static void ssl_update_checksum_start( mbedtls_ssl_context *ssl, #if defined(MBEDTLS_USE_PSA_CRYPTO) psa_hash_update( &ssl->handshake->fin_sha384_psa, buf, len ); #else - mbedtls_sha512_update( &ssl->handshake->fin_sha512, buf, len ); + mbedtls_sha512_update( &ssl->handshake->fin_sha384, buf, len ); #endif #endif } @@ -616,7 +616,7 @@ static void ssl_update_checksum_sha384( mbedtls_ssl_context *ssl, #if defined(MBEDTLS_USE_PSA_CRYPTO) psa_hash_update( &ssl->handshake->fin_sha384_psa, buf, len ); #else - mbedtls_sha512_update( &ssl->handshake->fin_sha512, buf, len ); + mbedtls_sha512_update( &ssl->handshake->fin_sha384, buf, len ); #endif } #endif @@ -639,8 +639,8 @@ static void ssl_handshake_params_init( mbedtls_ssl_handshake_params *handshake ) handshake->fin_sha384_psa = psa_hash_operation_init(); psa_hash_setup( &handshake->fin_sha384_psa, PSA_ALG_SHA_384 ); #else - mbedtls_sha512_init( &handshake->fin_sha512 ); - mbedtls_sha512_starts( &handshake->fin_sha512, 1 ); + mbedtls_sha512_init( &handshake->fin_sha384 ); + mbedtls_sha512_starts( &handshake->fin_sha384, 1 ); #endif #endif @@ -3510,7 +3510,7 @@ void mbedtls_ssl_handshake_free( mbedtls_ssl_context *ssl ) #if defined(MBEDTLS_USE_PSA_CRYPTO) psa_hash_abort( &handshake->fin_sha384_psa ); #else - mbedtls_sha512_free( &handshake->fin_sha512 ); + mbedtls_sha512_free( &handshake->fin_sha384 ); #endif #endif @@ -5062,7 +5062,7 @@ static int ssl_get_handshake_transcript_sha384( mbedtls_ssl_context *ssl, return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); mbedtls_sha512_init( &sha512 ); - mbedtls_sha512_clone( &sha512, &ssl->handshake->fin_sha512 ); + mbedtls_sha512_clone( &sha512, &ssl->handshake->fin_sha384 ); if( ( ret = mbedtls_sha512_finish( &sha512, dst ) ) != 0 ) { @@ -5884,7 +5884,7 @@ void ssl_calc_verify_tls_sha384( const mbedtls_ssl_context *ssl, MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> calc verify sha384" ) ); - mbedtls_sha512_clone( &sha512, &ssl->handshake->fin_sha512 ); + mbedtls_sha512_clone( &sha512, &ssl->handshake->fin_sha384 ); mbedtls_sha512_finish( &sha512, hash ); *hlen = 48; @@ -6986,7 +6986,7 @@ static void ssl_calc_finished_tls_sha384( MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> calc finished tls sha384" ) ); - mbedtls_sha512_clone( &sha512, &ssl->handshake->fin_sha512 ); + mbedtls_sha512_clone( &sha512, &ssl->handshake->fin_sha384 ); /* * TLSv1.2: diff --git a/library/ssl_tls13_generic.c b/library/ssl_tls13_generic.c index 64e134dfac..2b9ac5c57e 100644 --- a/library/ssl_tls13_generic.c +++ b/library/ssl_tls13_generic.c @@ -1410,7 +1410,7 @@ int mbedtls_ssl_reset_transcript_for_hrr( mbedtls_ssl_context *ssl ) psa_hash_abort( &ssl->handshake->fin_sha384_psa ); psa_hash_setup( &ssl->handshake->fin_sha384_psa, PSA_ALG_SHA_384 ); #else - mbedtls_sha512_starts( &ssl->handshake->fin_sha512, 1 ); + mbedtls_sha512_starts( &ssl->handshake->fin_sha384, 1 ); #endif #endif /* MBEDTLS_SHA384_C */ }