Commit graph

479 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
ce567a72e0 Add a simple malloc() implementation which can be configured to fail
when testing error handling code.
2014-08-02 23:30:07 +00:00
Dag-Erling Smørgrav
3f982ecff7 Improve format strings. 2014-08-02 23:26:58 +00:00
Dag-Erling Smørgrav
25ff8b9664 Print hex strings in groups of eight. 2014-08-02 23:26:20 +00:00
Dag-Erling Smørgrav
33cb3dad6a Remove <stdio.h> from code that doesn't need it. 2014-08-02 23:23:19 +00:00
Dag-Erling Smørgrav
996b59dd91 Ignore managed string tests 2014-08-02 23:11:22 +00:00
Dag-Erling Smørgrav
83a5196475 Add missing header. 2014-08-01 22:47:00 +00:00
Dag-Erling Smørgrav
35d982ea57 Rename CPEXX_VER to cpeXX_ver and remove CPEXX_NATTR, which is redundant. 2014-08-01 22:38:36 +00:00
Dag-Erling Smørgrav
479ffbba4a Remove author and sponsor tags; we'll deal with that some other way.
Remove $Cryb$ tags as it is likely that the code will move to git.
2014-08-01 14:31:07 +00:00
Dag-Erling Smørgrav
526303caad WIP: CPE library. 2014-08-01 14:18:25 +00:00
Dag-Erling Smørgrav
cc8109c760 WIP: unit tests for managed strings. 2014-08-01 13:55:01 +00:00
Dag-Erling Smørgrav
bec11577b0 sbuf-inspired managed string implementation which also supports wide
strings.
2014-08-01 13:53:04 +00:00
Dag-Erling Smørgrav
fe2d45ad56 Create rol / ror functions for all integer sizes. 2014-07-19 15:36:07 +00:00
Dag-Erling Smørgrav
c658232e3e && is subject to shortcut evaluation, so the second test will not run
if the first failed.  The ultimate outcome is the same, but using &
instead ensures that, when in verbose mode, we also get output from
the second test.
2014-07-19 15:34:49 +00:00
Dag-Erling Smørgrav
063197ed28 tweak svn:ignore 2014-07-19 08:10:09 +00:00
Dag-Erling Smørgrav
bee81cd1fd Prettier hex output 2014-07-19 06:06:33 +00:00
Dag-Erling Smørgrav
0023f57ab5 Add a library of general (non-cryptographic) hash functions, currently
consisting of the Pearson string hash function and the Murmur3-32 hash
function.
2014-07-19 06:03:57 +00:00
Dag-Erling Smørgrav
541d65a3cc pacify autoindenters 2014-07-19 02:59:42 +00:00
Dag-Erling Smørgrav
49e46f74b1 Add unit tests for strlcpy() 2014-07-13 21:35:15 +00:00
Dag-Erling Smørgrav
d508e9ebc2 Missing newline character 2014-07-13 21:34:54 +00:00
Dag-Erling Smørgrav
6be7e6da5f Add a check for buffer overflow 2014-07-13 21:33:46 +00:00
Dag-Erling Smørgrav
f1907404b1 Add a helper script for running the test suite with coverage analysis
enabled.
2014-07-13 21:21:43 +00:00
Dag-Erling Smørgrav
3ed82792fc Fix a bug that affected unterminated buffers: strlcat() would write a NUL
past the end of the buffer and return one less than the correct length.
2014-07-13 20:42:56 +00:00
Dag-Erling Smørgrav
08208a1b3e Add unit tests for strlcat() 2014-07-13 20:40:29 +00:00
Dag-Erling Smørgrav
973b68c4fa Style nits 2014-07-13 20:39:57 +00:00
Dag-Erling Smørgrav
023d9aefaa Add comparison functions for various integer types. 2014-07-13 20:39:00 +00:00
Dag-Erling Smørgrav
4c59fd979b Reorganize the configure script. Move the header and function checks
up so they're not affected by the debugging / developer options.
2014-07-13 19:59:58 +00:00
Dag-Erling Smørgrav
c9536ec04b Add tests for the carry operation in sha384 and sha512, which support
message of up to 2^128 bytes and therefore must use a high / low pair.
2014-07-12 22:12:38 +00:00
Dag-Erling Smørgrav
910c782b2f In the md4 code, use a 64-bit counter to avoid a manual carry operation. 2014-07-12 22:10:57 +00:00
Dag-Erling Smørgrav
340b3240cf Consistently use const void * for data and keys, uint8_t * for digests
and MACs, and uint8_t, uint32_t or uint64_t (as appropriate) for internal
state.  Also remove a few unnecessary casts.
2014-07-12 21:57:31 +00:00
Dag-Erling Smørgrav
a9e8aed740 Formatting nit 2014-07-11 22:29:02 +00:00
Dag-Erling Smørgrav
8c9c5f26e4 Take advantage of t_compare_mem(). 2014-07-11 22:26:23 +00:00
Dag-Erling Smørgrav
891ac33286 Typo in svn:ignore 2014-07-11 22:16:42 +00:00
Dag-Erling Smørgrav
2b1d10e02e Oops, fix copy-pasto in previous commit. 2014-07-11 22:15:57 +00:00
Dag-Erling Smørgrav
a4576782b2 Add generic comparison functions. 2014-07-11 22:10:09 +00:00
Dag-Erling Smørgrav
7f410bdfd3 Silence a GCC warning about an empty if statement. 2014-07-11 15:14:23 +00:00
Dag-Erling Smørgrav
18650540d8 Avoid hardcoded lengths. This fixes a bug in the HMAC-SHA224 tests. 2014-07-11 15:09:59 +00:00
Dag-Erling Smørgrav
30c8e19de7 Remove HMAC-MD2 and HMAC-MD4. They may or may not reappear at a later
date in libcryb-mac.
2014-07-11 13:54:22 +00:00
Dag-Erling Smørgrav
729e501b79 Mechanical whitespace cleanup 2014-07-11 13:40:06 +00:00
Dag-Erling Smørgrav
2c697a472b Implement SHA-224 and HMAC-SHA224. 2014-07-11 13:33:58 +00:00
Dag-Erling Smørgrav
25e162687e Credit upstream sources. 2014-07-11 13:08:39 +00:00
Dag-Erling Smørgrav
6aa7f9a0e6 Implement HMAC-SHA{256,384,512} and add unit tests. Remove pre-existing
HMAC implementations from the libcperciva and XySSL code.
2014-07-11 13:01:32 +00:00
Dag-Erling Smørgrav
17d3517f3a Forgot to svn add t_const.c. 2014-07-11 12:50:43 +00:00
Dag-Erling Smørgrav
8e786c5a98 Introduce t_zero (a 256-byte array of zeroes) and t_seq8 (a 256-byte array
counting up from zero).  Use them to simplify the HMAC-SHA1 test vectors.
2014-07-11 12:46:23 +00:00
Dag-Erling Smørgrav
b3a718a7ff Oops, use the correct keys 2014-07-11 11:28:01 +00:00
Dag-Erling Smørgrav
0681394b23 Replace the FIPS-198 test vectors with those from the NIST CSRC's
algorithm example page.
2014-07-11 11:21:19 +00:00
Dag-Erling Smørgrav
5bb81214cc Instead of storing the key in the hmac_sha1_ctx so we can compute the
output pad in hmac_sha1_final(), prepare a sha1 context in advance and
discard the key as early as possible.
Inspired by Colin Percival's HMAC-SHA-256 implementation.
2014-07-11 10:28:55 +00:00
Dag-Erling Smørgrav
950a1770e5 Breathe 2014-07-11 10:11:18 +00:00
Dag-Erling Smørgrav
26b512bfd7 Eliminate a variable 2014-07-11 10:10:50 +00:00
Dag-Erling Smørgrav
8f42136d40 Trust the compiler to eliminate unnecessary conversions. 2014-07-11 10:07:24 +00:00
Dag-Erling Smørgrav
fd77c1c38e Unroll the loop in sha1_compute(), speeding it up by about 50%. 2014-07-11 09:58:58 +00:00