From 7e7aba8c9d8e39a80705b0dd1902dd554f14ee20 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Thu, 24 Feb 2022 08:33:11 +0000 Subject: [PATCH] Rename mbedtls_a64_crypto_sha256_check_support() to mbedtls_a64_crypto_sha256_determine_support() The Mbed TLS coding standard specifies that "check" functions must return 0 for success (i.e. feature present), while "has" functions should return 1 for true. Since we were using "check" to do the actual check, and "has" to get the cached value, having inverted values here would be confusing. Therefore, rename "check" to "determine", as that's what those functions are doing. Signed-off-by: Tom Cosgrove --- library/sha256.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/sha256.c b/library/sha256.c index 307887bb3f..ff62802704 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -68,12 +68,12 @@ * MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT if no detection mechanism found */ #if defined(HWCAP_SHA2) -static int mbedtls_a64_crypto_sha256_check_support( void ) +static int mbedtls_a64_crypto_sha256_determine_support( void ) { return( ( getauxval( AT_HWCAP ) & HWCAP_SHA2 ) ? 1 : 0 ); } #elif defined(__APPLE__) -static int mbedtls_a64_crypto_sha256_check_support( void ) +static int mbedtls_a64_crypto_sha256_determine_support( void ) { return( 1 ); } @@ -82,7 +82,7 @@ static int mbedtls_a64_crypto_sha256_check_support( void ) #include #include -static int mbedtls_a64_crypto_sha256_check_support( void ) +static int mbedtls_a64_crypto_sha256_determine_support( void ) { return( IsProcessorFeaturePresent( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) ? 1 : 0 ); @@ -107,7 +107,7 @@ static void sigill_handler( int signal ) longjmp( return_from_sigill, 1 ); } -static int mbedtls_a64_crypto_sha256_check_support( void ) +static int mbedtls_a64_crypto_sha256_determine_support( void ) { struct sigaction old_action, new_action; @@ -519,7 +519,7 @@ static int mbedtls_a64_crypto_sha256_has_support( void ) if( !done ) { - supported = mbedtls_a64_crypto_sha256_check_support(); + supported = mbedtls_a64_crypto_sha256_determine_support(); done = 1; }