Commit graph

318 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
0d5f51697e Slight cleanup of the DES code. 2017-03-19 13:12:20 +01:00
Dag-Erling Smørgrav
548bf31631 Implement DES (single-key ECB only for now). 2017-03-18 17:12:16 +01:00
Dag-Erling Smørgrav
371d519169 Implement the Salsa family of stream ciphers.
Note that we only have unit tests for Salsa20.
2017-03-18 14:42:26 +01:00
Dag-Erling Smørgrav
c04e816ed9 Forgot to add chacha.h to the build. 2017-03-18 14:42:26 +01:00
Dag-Erling Smørgrav
e6ab68673b Remove incorrect and unnecessary casts. 2017-03-16 18:07:24 +01:00
Dag-Erling Smørgrav
b67f0dbf00 Implement the ChaCha family of stream ciphers. 2017-03-16 18:02:56 +01:00
Dag-Erling Smørgrav
1ca9e1928e Misc cleanup after API change. 2017-03-16 18:00:09 +01:00
Dag-Erling Smørgrav
1073dceed9 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-03-16 15:09:34 +01:00
Dag-Erling Smørgrav
5f4d82e99e Remove incorrect CRYB_USED annotations. 2017-03-15 10:22:24 +01:00
Dag-Erling Smørgrav
277e946f78 Add missing macro for cryb_aes_cipher. 2017-03-14 17:00:02 +01:00
Dag-Erling Smørgrav
5c9838da99 Fix copy-paste error: rc4 is a cipher, not a digest. 2017-03-14 15:48:32 +01:00
Dag-Erling Smørgrav
7c360e7fd8 Replace pkg-config's pkg.m4 with pkgconf's extended version. 2017-03-14 15:14:12 +01: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
7b289d622f Include pkg.m4 from the latest version of pkg-config. 2017-03-07 02:28:04 +01:00
Dag-Erling Smørgrav
aafbf63023 Install pkg-config before building on Travis. 2017-03-07 02:14:32 +01:00
Dag-Erling Smørgrav
fbf69f31cb Start using pkg-config / pkgconf. 2017-03-07 00:54:46 +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
a0444f1b08 Fix versioning when PACKAGE_VERSION is in dotted-decimal form. 2017-03-07 00:24:52 +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
9bf06c258c Improve tests for sloppy padding in encoded input. 2017-03-05 17:18:30 +01:00
Dag-Erling Smørgrav
d017611d76 All property names and values may be percent-encoded.
If the key length is not a multiple of 40 bits, its base32 representation may be padded, and that padding will be encoded.   We already decoded the label (which may contain spaces and other unsafe characters), but not the key.  For the sake of simplicity and robustness, we now decode the name and value of every property.

This corresponds to OpenPAM r886.
2017-03-05 17:06:30 +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
95b2518eed Add m4/ax_gcc_builtin.m4 to EXTRA_DIST.
As luck would have it, 'make dist' always includes it in the tarball and 'make maintainer-clean' does not delete it, but still...
2017-03-03 17:36:02 +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
d4626dbd70 When freeing a mapped allocation, call UTRACE_FREE() again for the metadata. 2017-02-19 19:49:27 +01:00
Dag-Erling Smørgrav
d8f6837026 Eliminate a redundant newline. 2017-02-19 18:45:43 +01:00
Dag-Erling Smørgrav
692852a349 Report the correct size when tracing a realloc() call. 2017-02-19 18:13:07 +01:00
Dag-Erling Smørgrav
9414c8b8f1 Disable coverage analysis of the C++ test. 2017-02-19 17:33:42 +01:00
Dag-Erling Smørgrav
01ffa275ad Increase test coverage for cryb_mpi_add_abs(). 2017-02-19 17:29:07 +01:00
Dag-Erling Smørgrav
f6905c8edb Fix bugs in cryb_mpi_{add,sub}_abs() caused by assuming that the target is initally positive zero.
If its operands were identical, cryb_mpi_add_abs() would leave the target untouched.  Explicitly call mpi_zero() before returning.  While there, extend the “identical operands” shortcut to also cover equality.

Both cryb_mpi_add_abs() and cryb_mpi_sub_abs() would leave the target's negative flag untouched.  Explicitly clear it before returning.
2017-02-19 17:20:40 +01:00
Dag-Erling Smørgrav
894cc207b9 Additional tests for cryb_mpi_{add,sub}_abs().
These tests reveal that both functions assume that the target is initially positive zero if it is not identical with one of the operands, and fail in various ways if it is not, or if it is uninitialized.
2017-02-19 17:11:02 +01:00
Dag-Erling Smørgrav
ae7f1e909e Rework t_compare_mpi() to improve diagnostics. 2017-02-19 14:38:24 +01:00
Dag-Erling Smørgrav
42f68fb348 Add null pointer checks to t_compare_{ptr,mem,str,strn}(). 2017-02-19 14:38:09 +01:00
Dag-Erling Smørgrav
713cc68a0d Bump version. 2017-02-07 10:29:03 +01:00
Dag-Erling Smørgrav
9f7af230b5 Bump copyright date. 2017-02-07 10:28:49 +01:00
Dag-Erling Smørgrav
912ba9b6ff Add a test that ensures that our headers are compilable in C++. 2017-01-24 15:08:48 +01:00
Dag-Erling Smørgrav
cf28ec163b All our tests are in the test directory. 2017-01-23 11:34:42 +01:00
Dag-Erling Smørgrav
642b34411c Alphabetize. 2016-11-21 14:02:05 +01:00
Dag-Erling Smørgrav
50fbf04eb4 Add version tests for libcryb-oath and libcryb-rand. 2016-11-21 13:52:19 +01:00
Dag-Erling Smørgrav
3da29c38c6 Fix typo in libcryb-enc's dependency list. 2016-11-21 13:47:17 +01:00
Dag-Erling Smørgrav
4cad790446 Fix typo in libcryb-rand's Makefile and ensure that it is built before libcryb-oath, which uses it. 2016-11-21 13:46:49 +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
c6158a8dbf Don't confuse 2 ^ n with 1 << n in debugging output. 2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
2ba5067496 Do not attempt to catch SIGABRT emanating from a test case.
It is reasonable to assume that a SIGABRT originates from a call to abort(3), either directly or via assert(3).  Both the C standard and POSIX give the implementation great latitude with regard to abort(3)'s behavior, and both explicitly mention that it may close all streams before raising SIGABRT.  This means that we cannot safely proceed after a call to abort(3).  One could argue that we can't safely proceed after a SIGBUS or SIGSEGV either, but in practice, the damage is usually quite limited.
2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
183f023ab6 Alphabetize. 2016-11-14 12:59:13 +01:00