Eliminate redundant version of mbedtls_ct_memcmp
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h
index 8bc1b64..6d44768 100644
--- a/library/psa_crypto_core.h
+++ b/library/psa_crypto_core.h
@@ -21,6 +21,8 @@
#ifndef PSA_CRYPTO_CORE_H
#define PSA_CRYPTO_CORE_H
+#include "mbedtls/constant_time.h"
+
#include "mbedtls/build_info.h"
#include "psa/crypto.h"
@@ -49,14 +51,7 @@
static inline int mbedtls_psa_safer_memcmp(
const uint8_t *a, const uint8_t *b, size_t n)
{
- size_t i;
- unsigned char diff = 0;
-
- for (i = 0; i < n; i++) {
- diff |= a[i] ^ b[i];
- }
-
- return diff;
+ return mbedtls_ct_memcmp(a, b, n);
}
/** The data structure representing a key slot, containing key material