From aa050a7bdb943ca94ab914f2a9dc508e09a57431 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Mon, 16 Jan 2017 13:25:38 +0000 Subject: stdlib: Import timingsafe_bcmp() from FreeBSD Some side-channel attacks involve an attacker inferring something from the time taken for a memory compare operation to complete, for example when comparing hashes during image authentication. To mitigate this, timingsafe_bcmp() must be used for such operations instead of the standard memcmp(). This function executes in constant time and so doesn't leak any timing information to the caller. Change-Id: I470a723dc3626a0ee6d5e3f7fd48d0a57b8aa5fd Signed-off-by: dp-arm Signed-off-by: Antonio Nino Diaz --- include/lib/stdlib/string.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/lib/stdlib/string.h') diff --git a/include/lib/stdlib/string.h b/include/lib/stdlib/string.h index 9beeb448..902d9c13 100644 --- a/include/lib/stdlib/string.h +++ b/include/lib/stdlib/string.h @@ -61,6 +61,7 @@ size_t strlen(const char *) __pure; int strncmp(const char *, const char *, size_t) __pure; size_t strnlen(const char *, size_t) __pure; int strcasecmp(const char *, const char *); +int timingsafe_bcmp(const void *, const void *, size_t); __END_DECLS -- cgit v1.2.3