Rename mbedtls_platform_memcmp() to mbedtls_platform_memequal()
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
diff --git a/include/mbedtls/asn1.h b/include/mbedtls/asn1.h
index adab7a1..44cf94a 100644
--- a/include/mbedtls/asn1.h
+++ b/include/mbedtls/asn1.h
@@ -130,11 +130,11 @@
*/
#define MBEDTLS_OID_CMP(oid_str, oid_buf) \
( ( MBEDTLS_OID_SIZE(oid_str) != (oid_buf)->len ) || \
- mbedtls_platform_memcmp( (oid_str), (oid_buf)->p, (oid_buf)->len) != 0 )
+ mbedtls_platform_memequal( (oid_str), (oid_buf)->p, (oid_buf)->len) != 0 )
#define MBEDTLS_OID_CMP_RAW(oid_str, oid_buf, oid_buf_len) \
( ( MBEDTLS_OID_SIZE(oid_str) != (oid_buf_len) ) || \
- mbedtls_platform_memcmp( (oid_str), (oid_buf), (oid_buf_len) ) != 0 )
+ mbedtls_platform_memequal( (oid_str), (oid_buf), (oid_buf_len) ) != 0 )
#ifdef __cplusplus
extern "C" {
diff --git a/include/mbedtls/compat-1.3.h b/include/mbedtls/compat-1.3.h
index 6e0fb8d..bd6de87 100644
--- a/include/mbedtls/compat-1.3.h
+++ b/include/mbedtls/compat-1.3.h
@@ -2231,7 +2231,7 @@
#define rsa_rsassa_pss_verify_ext mbedtls_rsa_rsassa_pss_verify_ext
#define rsa_self_test mbedtls_rsa_self_test
#define rsa_set_padding mbedtls_rsa_set_padding
-#define safer_memcmp mbedtls_platform_memcmp
+#define safer_memcmp mbedtls_platform_memequal
#define set_alarm mbedtls_set_alarm
#define sha1 mbedtls_sha1
#define sha1_context mbedtls_sha1_context
diff --git a/include/mbedtls/platform_util.h b/include/mbedtls/platform_util.h
index 7d16074..81d0f0f 100644
--- a/include/mbedtls/platform_util.h
+++ b/include/mbedtls/platform_util.h
@@ -215,12 +215,12 @@
int mbedtls_platform_memmove( void *dst, const void *src, size_t num );
/**
- * \brief Secure memcmp
+ * \brief Secure check if the buffers have the same data.
*
- * This is a constant-time version of memcmp(). If
- * MBEDTLS_ENTROPY_HARDWARE_ALT is defined, the order is also
- * randomised using the hardware RNG in order to further harden
- * against side-channel attacks.
+ * This is a constant-time version of memcmp(), but without checking
+ * if the bytes are greater or lower. If MBEDTLS_ENTROPY_HARDWARE_ALT
+ * is defined, the order is also randomised using the hardware RNG in
+ * order to further harden against side-channel attacks.
*
* \param buf1 First buffer to compare.
* \param buf2 Second buffer to compare against.
@@ -229,7 +229,7 @@
* \return 0 if the buffers were equal or an unspecified non-zero value
* otherwise.
*/
-int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num );
+int mbedtls_platform_memequal( const void *buf1, const void *buf2, size_t num );
/**
* \brief RNG-function for getting a random 32-bit integer.