Use -1 as uninitialised marker

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-08-04 12:52:51 +01:00
parent 4566132163
commit b30adce7fd
2 changed files with 4 additions and 4 deletions

View file

@ -99,7 +99,7 @@
#include <asm/hwcap.h>
#include <sys/auxv.h>
char mbedtls_aesce_has_support_result = 2;
signed char mbedtls_aesce_has_support_result = -1;
#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
/*
@ -113,7 +113,7 @@ int mbedtls_aesce_has_support_impl(void)
* It is possible that we could end up setting result more than
* once, but that is harmless.
*/
if (mbedtls_aesce_has_support_result == 2) {
if (mbedtls_aesce_has_support_result == -1) {
unsigned long auxval = getauxval(AT_HWCAP);
if ((auxval & (HWCAP_ASIMD | HWCAP_AES)) ==
(HWCAP_ASIMD | HWCAP_AES)) {

View file

@ -44,7 +44,7 @@ extern "C" {
#if defined(__linux__) && !defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
extern char mbedtls_aesce_has_support_result;
extern signed char mbedtls_aesce_has_support_result;
/**
* \brief Internal function to detect the crypto extension in CPUs.
@ -53,7 +53,7 @@ extern char mbedtls_aesce_has_support_result;
*/
int mbedtls_aesce_has_support_impl(void);
#define mbedtls_aesce_has_support() (mbedtls_aesce_has_support_result == 2 ? \
#define mbedtls_aesce_has_support() (mbedtls_aesce_has_support_result == -1 ? \
mbedtls_aesce_has_support_impl() : \
mbedtls_aesce_has_support_result)