Commit graph

128 commits

Author SHA1 Message Date
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
Dag-Erling Smørgrav
afe99d57dd Bump internal version number. 2016-01-09 20:12:01 +01:00
Dag-Erling Smørgrav
2237a13d5b Hide the no-op default case when not instrumenting for coverage analysis. 2016-01-09 18:37:36 +01:00
Dag-Erling Smørgrav
f9c8ce7c65 Build system overhaul 2015-12-14 18:08:22 +01:00
Dag-Erling Smørgrav
4d7893004c Prepare for moving to Github 2015-12-14 15:55:38 +01:00
Dag-Erling Smørgrav
955cbc3013 Add t_malloc_snapshot() which writes a snapshot of the allocator state to
a caller-provided buffer.  Use it to warn about leaks in each individual
test case.  Note that we can't fail a test case for leaking, because
individual test cases in a unit may modify shared state which is cleaned
up at the end of the series.
2015-11-02 19:34:03 +00:00
Dag-Erling Smørgrav
0a9f2c21fe When running a test, make sure it didn't leave allocation failure enabled.
Add predicates for null and non-null pointers.
Staticize some internal allocator state.
2015-10-13 21:39:47 +00:00
Dag-Erling Smørgrav
e6049c1d6a Add string_len() (return length of string) and string_dup_cs() (create a
string from a null-terminated string).  Add test for string_trunc().
2015-10-12 10:23:24 +00:00
Dag-Erling Smørgrav
f67b3cf5da Add missing prototype for t_compare_ssz() 2015-10-12 10:19:53 +00:00
Dag-Erling Smørgrav
f8ebdbc14d Move the test framework into its own subdirectory 2015-10-04 07:49:48 +00:00
Dag-Erling Smørgrav
aa4a92bac9 Fix cipher macros 2015-10-04 07:19:28 +00:00
Dag-Erling Smørgrav
a9e733f0ca Use an enum for encrypt / decrypt + minor cleanup 2015-10-03 14:43:33 +00:00
Dag-Erling Smørgrav
dd18cd2995 Kick off libcryb-cipher with AES (from XySSL) and RC4 (my own). 2015-10-03 14:24:59 +00:00
Dag-Erling Smørgrav
398abda6b0 Fix various bugs relating to digest algorithm registration and wrapping 2015-10-03 09:32:44 +00:00
Dag-Erling Smørgrav
531eeec36b Add a simple implementation of the Adler-32 checksum. 2015-08-18 13:27:06 +00:00
Dag-Erling Smørgrav
20cd7d6012 Add 16-bit endian conversion functions. 2015-08-17 15:37:07 +00:00
Dag-Erling Smørgrav
aa97da3335 Add simple implementations of Fletcher's checksum. 2015-08-17 15:21:47 +00:00
Dag-Erling Smørgrav
9103fab696 Add missing header 2015-04-08 12:17:51 +00:00
Dag-Erling Smørgrav
0d730bd66b Don't forget to distribute and install <cryb/memset_s.h> 2015-02-16 11:07:43 +00:00
Dag-Erling Smørgrav
f26cbe997d There is no reason not to distribute our ctype-like macros and strl*()
functions.
2015-01-21 23:34:52 +00:00
Dag-Erling Smørgrav
d0fb2359f1 Implement mpi_{add,sub}() in terms of mpi_{add,sub}_abs(). 2015-01-07 18:59:44 +00:00
Dag-Erling Smørgrav
c5b962387c Add mpi_eq_abs() and mpi_eq() predicates. 2014-12-30 11:12:11 +00:00
Dag-Erling Smørgrav
2ad45cfccf Add a string comparison function and a string equality predicate.
Write test cases for the former.
2014-12-29 12:41:39 +00:00
Dag-Erling Smørgrav
f82bbc1400 Catch up with OpenPAM's latest OATH changes:
Add an oath_mode(3) function which translates from mode names to numbers.

 Consistently use UINT_MAX, not -1, to indicate an invalid response.

 Change the meaning of the window parameter to always indicate the number
 of codes to check *in addition* to the current code.  Note that for TOTP,
 the window goes in both directions; a window of 1 means to check the
 current code plus the previous and next.
2014-12-20 01:45:01 +00:00
Dag-Erling Smørgrav
75daba7501 Define CRYB_COVERAGE to 1 when building with coverage analysis. 2014-12-20 01:09:58 +00:00
Dag-Erling Smørgrav
a98753b6ef Fix various cast-qual bugs. 2014-12-20 00:44:24 +00:00
Dag-Erling Smørgrav
6ed802ddf3 Consistently use #if HAVE_FOO instead of #ifdef HAVE_FOO. The reason is
that AC_CHECK_DECLS([foo]), unlike AC_CHECK_FUNCS([foo]), will always
define HAVE_FOO, so #ifdef HAVE_FOO will always be true even if it is 0.
This commit finally fixes the [bl]e{32,64}{enc,dec} issue on Linux.
2014-12-20 00:38:54 +00:00
Dag-Erling Smørgrav
8ef2266a4b r103 was incomplete. It changed the checks in the configure script (and
accidentally introduced a no-op line), but did not change the checks in
the header, so we ended up always using our own [bl]e{32,64}{enc,dec}.
2014-12-20 00:26:37 +00:00
Dag-Erling Smørgrav
e4dd25fa79 Use wstring throughout (except internally in struct cpe_name).
Add a typedef for struct cpe_name and use it throughout.
Fix inverted logic in cpe_upgrade().
2014-11-01 20:15:45 +00:00
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
1fbf2cf156 It appears that gcc does not accept partial struct initialization. Add
a CRYB_MPI_ZERO macro that expands to an all-zeroes initializer.
2014-10-30 12:46:01 +00:00
Dag-Erling Smørgrav
3be915b8d7 Previous commit was incomplete. Add missing prototypes and a test case. 2014-08-14 18:42:52 +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
83a5196475 Add missing header. 2014-08-01 22:47:00 +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
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
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
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
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
4c17e0f386 Empty and unlikely to ever be used. 2014-07-10 18:01:40 +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
efd34d4cc7 In an earlier version of the API, the _init function was responsible
for allocating the context structure.  This is no longer the case, but
the _init function type was not updated to reflect this.
2014-07-10 15:37:40 +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
bb9690cd94 We need to distribute (but not install) these headers. 2014-07-10 14:39:28 +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
2f3ecfa7ba Fix include guard, and always declare the functions. 2014-07-10 13:40:23 +00:00
Dag-Erling Smørgrav
77202e13a8 Update setprops and fix props again 2014-07-10 13:33:08 +00:00
Dag-Erling Smørgrav
41c2325beb Fix copyright; this originated in OpenPAM. 2014-07-04 11:34:25 +00:00
Dag-Erling Smørgrav
5c33011d59 Add missing header 2014-07-04 11:26:45 +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