Commit graph

331 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
f164c3ac6e Replace the old mkpkgng script with a true port Makefile. 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
cdbb565482 Silence compiler warnings about operator precedence. 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
5c98dc1084 Assert that the cipher mode and key length are valid. 2017-04-06 19:51:46 +02:00
Dag-Erling Smørgrav
e21ec8afbc Use the keystream function like we do for other stream ciphers. 2017-04-06 19:51:45 +02:00
Dag-Erling Smørgrav
536a5a31d4 Use CAVP test vectors for AES and DES. 2017-04-06 19:51:45 +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
0c06ab5330 Slight cleanup of the DES code. 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
94720a2fff Remove incorrect and unnecessary casts. 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
d383e7ab62 Misc cleanup after API change. 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
8b9a7766da Remove incorrect CRYB_USED annotations. 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
ebcd155011 Order by year of last contribution. 2017-03-15 10:14:24 +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