@@ -24,6 +24,17 @@ namespace hmac_cpp {
2424 HMAC_CPP_API bool constant_time_equals (const uint8_t * a, size_t a_len,
2525 const uint8_t * b, size_t b_len);
2626
27+ // / \brief Alias for \c constant_time_equals.
28+ // / \param a Pointer to first array.
29+ // / \param a_len Length of the first array.
30+ // / \param b Pointer to second array.
31+ // / \param b_len Length of the second array.
32+ // / \return true if both arrays are equal.
33+ // / \note Avoids early length checks; input lengths are treated as public
34+ // / and may influence timing.
35+ HMAC_CPP_API bool constant_time_equal (const uint8_t * a, size_t a_len,
36+ const uint8_t * b, size_t b_len);
37+
2738 // / \brief Compare vectors in constant time.
2839 // / \param a First vector.
2940 // / \param b Second vector.
@@ -42,19 +53,7 @@ namespace hmac_cpp {
4253 reinterpret_cast <const uint8_t *>(b.data ()), b.size ());
4354 }
4455
45- // / \brief Alias for constant_time_equals.
46- // / \param a Pointer to first array.
47- // / \param a_len Length of the first array.
48- // / \param b Pointer to second array.
49- // / \param b_len Length of the second array.
50- // / \return true if both arrays are equal.
51- // / \note Avoids early length checks to mitigate timing attacks.
52- inline bool constant_time_equal (const uint8_t * a, size_t a_len,
53- const uint8_t * b, size_t b_len) {
54- return constant_time_equals (a, a_len, b, b_len);
55- }
56-
57- // / \brief Alias for constant_time_equals on vectors.
56+ // / \brief Alias for \c constant_time_equal on vectors.
5857 // / \param a First vector.
5958 // / \param b Second vector.
6059 // / \return true if both vectors are equal.
@@ -63,7 +62,7 @@ namespace hmac_cpp {
6362 return constant_time_equal (a.data (), a.size (), b.data (), b.size ());
6463 }
6564
66- // / \brief Alias for constant_time_equals on strings.
65+ // / \brief Alias for \c constant_time_equal on strings.
6766 // / \param a First string.
6867 // / \param b Second string.
6968 // / \return true if both strings are equal.
0 commit comments