From a91e0123cfe6690af653dc8d23390194238be33d Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 28 Jul 2014 16:10:19 -0700 Subject: [PATCH] Clarify what sodium_memcmp() is for. --- src/libsodium/include/sodium/utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libsodium/include/sodium/utils.h b/src/libsodium/include/sodium/utils.h index 817919ba..5b36a488 100644 --- a/src/libsodium/include/sodium/utils.h +++ b/src/libsodium/include/sodium/utils.h @@ -22,6 +22,11 @@ unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p, SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); +/* WARNING: sodium_memcmp() must be used to verify if two secret keys + * are equal, in constant time. + * It returns 0 if the keys are equal, and -1 if they differ. + * This function is not designed for lexicographical comparisons. + */ SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len);