Add constant time memory comparison function os_memcmp_const
authorJouni Malinen <j@w1.fi>
Sun, 29 Jun 2014 16:33:19 +0000 (19:33 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 2 Jul 2014 09:38:47 +0000 (12:38 +0300)
commitafc3c8b07ffcdccc9349c83dfd3cc904ad9fbfb1
treed815bf38c6c3f16acd12539cabf1592752cca553
parentee352f1e5a4957d06adb9a6ba560677dc6dfecb2
Add constant time memory comparison function os_memcmp_const

This function is meant for comparing passwords or hash values where
difference in execution time could provide external observer information
about the location of the difference in the memory buffers. The return
value does not behave like os_memcmp(), i.e., os_memcmp_const() cannot
be used to sort items into a defined order. Unlike os_memcmp(),
execution time of os_memcmp_const() does not depend on the contents of
the compared memory buffers, but only on the total compared length.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/utils/os.h
src/utils/os_internal.c
src/utils/os_none.c
src/utils/os_unix.c
src/utils/os_win32.c