SPRTL: 'memory compare' function
The 'memory compare' function with security enhancement - return the
result after all elements are enumerated to avoid attack by time
measurement.
Change-Id: I979a32b56e38832cbfd28581749671cb26634ca4
Signed-off-by: Shawn Shan <shawn.shan@arm.com>
diff --git a/secure_fw/lib/sprt/tfm_libsprt_c.h b/secure_fw/lib/sprt/tfm_libsprt_c.h
index 7dd2259..f303dc4 100644
--- a/secure_fw/lib/sprt/tfm_libsprt_c.h
+++ b/secure_fw/lib/sprt/tfm_libsprt_c.h
@@ -35,4 +35,20 @@
*/
void *tfm_sprt_c_memcpy(void *dest, const void *src, size_t n);
+/**
+ * \brief Compare the first 'n' bytes of the memory areas 's1' and 's2'.
+ *
+ * \param[in] s1 The address of the first memory area
+ * \param[in] s2 The address of the second memory area
+ * \param[in] n The size(Byte) to compare
+ *
+ * \retval > 0 The first n bytes of s1 great than the first n
+ * bytes of s2
+ * \retval < 0 The first n bytes of s1 less than the first n
+ * bytes of s2
+ * \retval = 0 The first n bytes of s1 equal to the first n
+ * bytes of s2
+ */
+int tfm_sprt_c_memcmp(const void *s1, const void *s2, size_t n);
+
#endif /* __TFM_LIBSPRT_C_H__ */