From 2c9f86b3b6a4d4ed80b50d04d941230b3a78c4ce Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 19 Sep 2023 17:48:13 +0100 Subject: [PATCH] Add docs for mbedtls_ct_memcmp_partial test Signed-off-by: Dave Rodgman --- tests/suites/test_suite_constant_time.function | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/suites/test_suite_constant_time.function b/tests/suites/test_suite_constant_time.function index 9df9432eb..262f841bc 100644 --- a/tests/suites/test_suite_constant_time.function +++ b/tests/suites/test_suite_constant_time.function @@ -260,6 +260,17 @@ exit: /* END_CASE */ /* BEGIN_CASE depends_on:MBEDTLS_NIST_KW_C */ + +/** + * Generate two arrays of the given size, and test mbedtls_ct_memcmp_partial + * over them. The arrays will be identical, except that one byte may be specified + * to be different. + * + * \p diff Index of byte that differs (if out of range, the arrays will match). + * \p size Size of arrays to compare + * \p skip_head Leading bytes to skip, as per mbedtls_ct_memcmp_partial + * \p skip_tail Trailing bytes to skip, as per mbedtls_ct_memcmp_partial + */ void mbedtls_ct_memcmp_partial(int diff, int size, int skip_head, int skip_tail) { uint8_t *a = NULL, *b = NULL;