Commit Graph

14 Commits

Author SHA1 Message Date
Frank Denis
84695c8d42 Make sodium_compare() work on little-endian numbers as expected 2015-10-31 22:36:54 +01:00
Frank Denis
a2c8ff5ccb Visual Studio doesn't have %zu 2015-10-17 21:32:25 +02:00
Frank Denis
d667efde68 Add sodium_compare()
A constant-time version of memcmp(), useful to compare nonces and counters
in little-endian format, that plays well with sodium_increment().

Unlike sodium_memcmp() which can compare anything for equality,
sodium_compare() is designed to compare things that are comparable, byte by
byte. Therefore, the prototype is slightly different: its arguments are
supposed to be `const unsigned char *`.

The names sodium_memcmp() and sodium_compare() are slightly confusing.
But we're not going to rename sodium_memcmp(), and I cannot think of a
better name for sodium_compare() than sodium_compare().
2015-10-17 21:25:30 +02:00
Frank Denis
2aef671fd9 Indent 2015-10-17 21:10:52 +02:00
Frank Denis
e2fca8cac5 Add sodium_increment() 2015-06-22 15:44:58 +02:00
Frank Denis
37580f4f52 More tests 2014-09-16 20:46:43 -07:00
Frank Denis
82bc039d6c Consistent syle for the tests. 2014-09-14 11:32:55 -07:00
Frank Denis
4d276a81e7 Include header files commonly used by the tests to cmptest.h 2014-09-13 14:11:12 -07:00
Frank Denis
01059444ee Wait, what, printf(3) on Windows doesn't even support %zu? o_O 2014-04-17 22:15:09 -07:00
Frank Denis
219db714cf Add sodium_hex2bin() 2014-04-15 00:39:14 -07:00
Frank Denis
1a3786705e Add a sodium_bin2hex utility function. 2013-07-07 23:38:14 -07:00
Frank Denis
de517b70d9 char vs unsigned char in the sodium_utils test 2013-04-26 21:51:59 -07:00
Frank Denis
1827e508ea Remove trailing spaces 2013-04-25 22:38:06 -07:00
Frank Denis
4c31bb5ef1 Add tests for sodium_*() functions. 2013-04-25 22:37:15 -07:00