Commit graph

334 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
cddb124bc6 Use the correct variable for find(1). 2017-03-22 20:57:28 +01:00
Dag-Erling Smørgrav
9103c3deac Replace the old mkpkgng script with a true port Makefile. 2017-03-22 20:54:54 +01:00
Dag-Erling Smørgrav
417c7e4812 Adjust UiO copyright. 2017-03-22 20:36:02 +01:00
Dag-Erling Smørgrav
3a0354ffe0 Merge pull request #2 from cryb-to/cryb-digest
Major cleanup of MDx and SHAx.
2017-03-22 20:35:13 +01:00
Dag-Erling Smørgrav
3eb1dd1be6 Silence compiler warnings about operator precedence. 2017-03-22 20:27:10 +01:00
Dag-Erling Smørgrav
95ab26f82c 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-03-21 14:57:19 +01:00
Dag-Erling Smørgrav
6a60c8024b Define vector versions of the endianness conversion functions. 2017-03-21 14:57:18 +01:00
Dag-Erling Smørgrav
9796dc64ee Merge pull request #1 from cryb-to/cryb-cipher
Add DES / 3DES, Salsa, ChaCha.
2017-03-21 14:32:34 +01:00
Dag-Erling Smørgrav
93af184693 Remove unused struct member. 2017-03-21 13:24:46 +01:00
Dag-Erling Smørgrav
f35e970d05 Fix typo, add missing declarations. 2017-03-21 13:22:08 +01:00
Dag-Erling Smørgrav
bfba1198b1 Neither AES nor DES have keystream functions. 2017-03-19 15:30:13 +01:00
Dag-Erling Smørgrav
c32bf05135 Assert that the cipher mode and key length are valid. 2017-03-19 15:20:32 +01:00
Dag-Erling Smørgrav
8b27222cbb Use the keystream function like we do for other stream ciphers. 2017-03-19 14:52:14 +01:00
Dag-Erling Smørgrav
7c348c4d33 Use CAVP test vectors for AES and DES. 2017-03-19 14:47:11 +01:00
Dag-Erling Smørgrav
bf0016a888 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-03-19 14:32:12 +01:00
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
ebcd155011 Order by year of last contribution. 2017-03-15 10:14: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