Commit graph

34 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
f7bdd342dc Add our own version of <endian.h> which includes implementations of the
unaligned encoding / decoding functions which Linux lacks.
2014-10-30 12:48:21 +00:00
Dag-Erling Smørgrav
d4fd9a1958 rm unused variable 2014-08-12 07:33:30 +00:00
Dag-Erling Smørgrav
be31515f5e Start of a multiple-precision integer arithmetic library. 2014-08-12 07:30:31 +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
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
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
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
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
7f410bdfd3 Silence a GCC warning about an empty if statement. 2014-07-11 15:14:23 +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
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
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
Dag-Erling Smørgrav
dffacacccf The spec says XOR here, not OR. Interestingly, it doesn't seem to
make any difference.
2014-07-11 09:45:29 +00:00
Dag-Erling Smørgrav
cc13b6a16a Remove k from the sha1 context structure, as it is a constant.
Rearrange the sha1 context structure to improve alignment.
2014-07-11 09:17:05 +00:00
Dag-Erling Smørgrav
4467480786 Remove a mostly pointless timing attack countermeasure. 2014-07-11 09:09:47 +00:00
Dag-Erling Smørgrav
ca46c7c591 Fully separate the SHA-384 and SHA-512 code. 2014-07-11 00:12:33 +00:00
Dag-Erling Smørgrav
63bcbcca20 Rename the HMAC-SHA1 code. 2014-07-10 23:57:47 +00:00
Dag-Erling Smørgrav
b0ff5af2ba Clean up headers and typedefs.
Fix context length in the algorithm descriptors.
Expose the block length and include it in the algorithm descriptors.
Complete the list of available digest algorithms.
2014-07-10 18:09:47 +00:00
Dag-Erling Smørgrav
dff909ba65 Spell the name of the University of Oslo in English. 2014-07-10 17:15:54 +00:00
Dag-Erling Smørgrav
593125c353 Import sha256 from libcperciva
Import md2, md4, sha384 and sha512 from XySSL
2014-07-10 14:51:07 +00:00
Dag-Erling Smørgrav
1d2f0661b3 Clean up namespace macros and provide algorithm definitions. 2014-07-10 13:53:05 +00:00
Dag-Erling Smørgrav
601403cba3 Use custom keywords. 2014-07-04 11:20:46 +00:00
Dag-Erling Smørgrav
ae99587ba4 initial code drop 2014-07-04 11:18:53 +00:00