Commit graph

111 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
206c6ffc85 Implement ffs() / fls() and use the latter to compute the MSB. 2017-04-06 19:52:23 +02:00
Dag-Erling Smørgrav
115ea66061 Sort prototypes. 2017-04-06 19:51:47 +02:00
Dag-Erling Smørgrav
b4eb918dad Implement GCD using Stein's binary algorithm. 2017-04-06 19:51:47 +02:00
Dag-Erling Smørgrav
47a0bf838f Add functions for comparing an MPI to an integer. 2017-04-06 19:51:47 +02:00
Dag-Erling Smørgrav
26e434d64b Add functions that return the LSB and MSB of an MPI. 2017-04-06 19:51:47 +02:00
Dag-Erling Smørgrav
895d1eb539 Constify where possible. 2017-04-06 19:51:47 +02:00
Dag-Erling Smørgrav
95ba4d39da Bump version. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
3a6ba51b86 Adjust UiO copyright. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
c6536641c5 Major cleanup of the MD and SHA digests.
- Use the new vector byte-order conversion functions where appropriate.
- Use memset_s() instead of memset() where appropriate.
- Use consistent names and types for function arguments.
- Reindent, rename and reorganize to conform to Cryb style and idiom.

SHA224 and SHA256 were left mostly unchanged.  MD2 and MD4 were completely rewritten as the previous versions (taken from XySSL) seem to have been copied from RSAREF.

This breaks the ABI as some context structures have grown or shrunk and some function arguments have been changed from int to size_t.
2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
d96415b2c3 Define vector versions of the endianness conversion functions. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
ce5562d568 Remove unused struct member. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
6f794d4739 Fix typo, add missing declarations. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
a8f0cc2e69 Neither AES nor DES have keystream functions. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
239ab3a471 Implement double- and triple-DES.
Single-DES is now a special case of triple-DES with all three keys being the same.  This is significantly slower than a pure single-DES implementation, but that's fine since nobody should be using it anyway.
2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
700fa0718b Implement DES (single-key ECB only for now). 2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
c671da9b1c Implement the Salsa family of stream ciphers.
Note that we only have unit tests for Salsa20.
2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
43dbe1350a Forgot to add chacha.h to the build. 2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
cfd3951ee1 Implement the ChaCha family of stream ciphers. 2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
c2f4fa524f Second iteration of the cryb-cipher API.
We now have separate encryption and decryption methods, and can process an arbitrary amount of plaintext or ciphertext per call, rounded down to the block size (if applicable).  For stream ciphers, we also have a keystream method which fills the provided buffer with an arbitrary amount of keystream (once again, rounded down if applicable).
2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
2e14488de0 Add missing macro for cryb_aes_cipher. 2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
e66d580331 Fix copy-paste error: rc4 is a cipher, not a digest. 2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
3917a6dfd7 Annotate t_add_test() as printf()-like and fix the fallout. 2017-03-14 15:07:02 +01:00
Dag-Erling Smørgrav
52cf1f9d3c Rename t_verbose*() to t_printv*().
Not only is this a slightly more logical name, but it allows us to expose the verbose flag, previously private to cryb_t_main.c, as the equally logically named t_verbose.
2017-03-14 14:36:52 +01:00
Dag-Erling Smørgrav
5476b36e9a Switch to using a real version number and bump. 2017-03-07 00:49:19 +01:00
Dag-Erling Smørgrav
cf46393d5e Remove an unused header and fix some naming nits. 2017-03-06 23:40:05 +01:00
Dag-Erling Smørgrav
d419d7388a Remove an unnecessary pointer from struct aes_ctx.
The rk pointer in struct aes_ctx always pointed to the context's buffer and served no purpose whatsoever, but the compiler had no way of knowing that and could therefore not optimize away assignments to and from it.

Note that the removal of rk breaks the ABI, since it changes the size of struct aes_ctx, but we allow ourselves that because neither the API nor the ABI have been fixed yet.
2017-03-03 23:49:00 +01:00
Dag-Erling Smørgrav
e01cc16c76 Bump version. 2017-02-19 20:10:18 +01:00
Dag-Erling Smørgrav
f70dac496f Mechanically bump copyright dates to the date of the latest commit. 2017-02-19 20:07:43 +01:00
Dag-Erling Smørgrav
713cc68a0d Bump version. 2017-02-07 10:29:03 +01:00
Dag-Erling Smørgrav
071e9e7e32 Fix accidental reintroduction of <cryb/attributes.h>, previously renamed to <cryb/defs.h>. 2016-11-14 13:11:44 +01:00
Dag-Erling Smørgrav
040f5ec69c Fix a couple of header errors. 2016-11-14 13:04:32 +01:00
Dag-Erling Smørgrav
2d507aaee4 Implement our own assert() and, more importantly, assertf(). 2016-11-14 13:00:51 +01:00
Dag-Erling Smørgrav
856571a06d Implement a soft assert for unit tests.
Unlike assert(3), which uses abort(3), this has no other side effects (before raising SIGABRT) than an fprintf() call.  The test framework will catch the SIGABRT, report that the test case failed, and proceed with the next case.
2016-11-14 13:00:16 +01:00
Dag-Erling Smørgrav
c4798b486c Constify t_compare_ptr(). 2016-10-03 16:55:27 +02:00
Dag-Erling Smørgrav
86cbac767a Bump version. 2016-10-03 12:32:02 +02:00
Dag-Erling Smørgrav
b77cb1aeb4 Tidy up the headers a bit and make them C++-safe. 2016-10-03 12:31:16 +02:00
Dag-Erling Smørgrav
be954631db Finish and hook up half-written name-to-enum / enum-to-name conversion for OATH modes. 2016-10-03 12:26:30 +02:00
Dag-Erling Smørgrav
3e50b04edd Bump version. 2016-09-18 21:22:58 +02:00
Dag-Erling Smørgrav
dc43296a47 Centralize most of .gitignore. 2016-09-17 21:38:54 +02:00
Dag-Erling Smørgrav
8396c4193b Add string_buf(), string_compare_cs(), string_equal_cs(). 2016-09-17 21:37:18 +02:00
Dag-Erling Smørgrav
cb6743bace Add wide-character versions of strlcat(), strlcmp(), strlcpy(). 2016-09-17 21:35:42 +02:00
Dag-Erling Smørgrav
d9b6740247 Implement the full range of BSD endianness conversion functions. 2016-09-15 11:18:01 +02:00
Dag-Erling Smørgrav
d9fbbe245f Bump version 2016-09-04 15:04:26 +02:00
Dag-Erling Smørgrav
06a757e878 Big reorganization and cleanup 2016-09-04 14:56:39 +02:00
Dag-Erling Smørgrav
c030e63ef2 Bump version 2016-03-21 12:35:42 +01:00
Dag-Erling Smørgrav
401465d8ea Move main() from libcryb-test to the test program.
Instead of having libcryb-test provide main() and assume that the test program defines t_prepare() and t_cleanup(), have libcryb-test provide a t_main() function which the test program calls with pointers to its prepare and cleanup functions.
2016-03-15 14:29:44 +01:00
Dag-Erling Smørgrav
c68fd1098d We need <cryb/attributes.h> here for the CRYB_PRINTF() macro. 2016-03-15 14:28:47 +01:00
Dag-Erling Smørgrav
34fe861a36 <cryb/coverage.h> needs to be installed along with libcryb-test. 2016-03-15 14:27:02 +01:00
Dag-Erling Smørgrav
61a83a1fae Cosmetic: use angle brackets instead of double quotes 2016-03-15 14:26:32 +01:00
Dag-Erling Smørgrav
6eaaac308f Add a t_compare_strn() function which is to t_compare_str() what strncmp() is to
strcmp().
2016-01-10 18:49:19 +01:00