ssl_tls13_generic.c: adapt guards for MBEDTLS_SHAxxx_C

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-09-02 13:17:03 +02:00 committed by Przemyslaw Stekiel
parent 8cc46aa22c
commit 47e3cb1875

View file

@ -1388,7 +1388,7 @@ int mbedtls_ssl_reset_transcript_for_hrr( mbedtls_ssl_context *ssl )
if( ciphersuite_info->mac == MBEDTLS_MD_SHA256 ) if( ciphersuite_info->mac == MBEDTLS_MD_SHA256 )
{ {
#if defined(MBEDTLS_SHA256_C) #if defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA)
MBEDTLS_SSL_DEBUG_BUF( 4, "Truncated SHA-256 handshake transcript", MBEDTLS_SSL_DEBUG_BUF( 4, "Truncated SHA-256 handshake transcript",
hash_transcript, hash_len ); hash_transcript, hash_len );
@ -1398,11 +1398,11 @@ int mbedtls_ssl_reset_transcript_for_hrr( mbedtls_ssl_context *ssl )
#else #else
mbedtls_sha256_starts( &ssl->handshake->fin_sha256, 0 ); mbedtls_sha256_starts( &ssl->handshake->fin_sha256, 0 );
#endif #endif
#endif /* MBEDTLS_SHA256_C */ #endif /* MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA */
} }
else if( ciphersuite_info->mac == MBEDTLS_MD_SHA384 ) else if( ciphersuite_info->mac == MBEDTLS_MD_SHA384 )
{ {
#if defined(MBEDTLS_SHA384_C) #if defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA)
MBEDTLS_SSL_DEBUG_BUF( 4, "Truncated SHA-384 handshake transcript", MBEDTLS_SSL_DEBUG_BUF( 4, "Truncated SHA-384 handshake transcript",
hash_transcript, hash_len ); hash_transcript, hash_len );
@ -1412,12 +1412,12 @@ int mbedtls_ssl_reset_transcript_for_hrr( mbedtls_ssl_context *ssl )
#else #else
mbedtls_sha512_starts( &ssl->handshake->fin_sha384, 1 ); mbedtls_sha512_starts( &ssl->handshake->fin_sha384, 1 );
#endif #endif
#endif /* MBEDTLS_SHA384_C */ #endif /* MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA */
} }
#if defined(MBEDTLS_SHA256_C) || defined(MBEDTLS_SHA384_C) #if defined(MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA) || defined(MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA)
ssl->handshake->update_checksum( ssl, hash_transcript, hash_len ); ssl->handshake->update_checksum( ssl, hash_transcript, hash_len );
#endif /* MBEDTLS_SHA256_C || MBEDTLS_SHA384_C */ #endif /* MBEDTLS_HAS_ALG_SHA_256_VIA_MD_OR_PSA_BASED_ON_USE_PSA || MBEDTLS_HAS_ALG_SHA_384_VIA_MD_OR_PSA_BASED_ON_USE_PSA */
return( ret ); return( ret );
} }