Commit Graph

22 Commits

Author SHA1 Message Date
Frank Denis
265bdcfe07 bin2hex & bin2base64: return a null size on error
This might prevent applications that don't properly check return codes
from reusing previous data.
2017-08-09 22:41:20 +02:00
Frank Denis
a6480aec44 b64 test: intentionally overestimate sizes
overflows will be caught by the guard page, if any
2017-08-09 18:03:56 +02:00
Frank Denis
74fd8fd1ce C++ compat 2017-08-09 16:08:03 +02:00
Frank Denis
cdbb43f444 base64 tests 2017-08-09 15:56:58 +02:00
Frank Denis
cac2dde218 Indent 2017-02-23 11:24:48 +01:00
Frank Denis
ec6b86611f More checks for sodium_add() (overlaps) and sodium_increment() 2015-12-06 19:06:27 +01:00
Frank Denis
9337ecfa60 Add tests for sodium_add(), more tests for sodium_increment() and is_zero() 2015-11-16 23:22:01 +01:00
Frank Denis
7561a25d5a Add a is_zero() helper 2015-11-13 01:48:34 +01:00
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