Commit graph

100 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
37973b8705 Use CLOCK_MONOTONIC instead of the non-standard CLOCK_MONOTONIC_PRECISE.
Use librt if required for clock_gettime(2).
2014-10-30 12:56:47 +00:00
Dag-Erling Smørgrav
75ee849080 Add missing checks for clock_gettime(2) (Linux has it in librt) and
for the unaligned encoding / decoding functions in <cryb/endian.h>.
2014-10-30 12:55:36 +00:00
Dag-Erling Smørgrav
1b84de1d0f Add <sys/types.h> for size_t / ssize_t which <cryb/wstring.h> uses. 2014-10-30 12:52:00 +00:00
Dag-Erling Smørgrav
97e702145d Add <stdint.h> for the {,u}int*_t types. 2014-10-30 12:51:03 +00:00
Dag-Erling Smørgrav
e9bb48d9c8 Add <sys/types.h> for size_t / ssize_t which <cryb/string.h> uses. 2014-10-30 12:50:09 +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
46beb1adcb Various fixes for Linux and gcc portability. 2014-10-30 12:14:05 +00:00
Dag-Erling Smørgrav
cf44e01bb1 Check for <sys/ktrace.h> and utrace(2). 2014-10-30 12:05:45 +00:00
Dag-Erling Smørgrav
bd69c34a11 Emit jemalloc-compatible trace events if possible. 2014-10-30 12:05:08 +00:00
Dag-Erling Smørgrav
277201a4bb Before we exit, explicitly call t_fcloseall() and make stdout
unbuffered to reduce noise in the malloc() statistics.
2014-10-30 12:04:29 +00:00
Dag-Erling Smørgrav
bf087fd70e Gather memory allocation statistics and print them at the end if verbose. 2014-10-30 11:05:01 +00:00
Dag-Erling Smørgrav
4a4726f9d6 Compare the result of mmap() to MAP_FAILED, not NULL. 2014-10-18 22:01:08 +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
885c586ce9 Add a test function for comparison operators (but no test cases yet).
Consistently destroy MPIs after use.
2014-08-14 18:26:06 +00:00
Dag-Erling Smørgrav
d4fd9a1958 rm unused variable 2014-08-12 07:33:30 +00:00
Dag-Erling Smørgrav
db8cacc028 Complete and sort svn:ignore. 2014-08-12 07:33:28 +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
d5e05cd239 fix props 2014-08-03 14:38:35 +00:00
Dag-Erling Smørgrav
64a2da2b84 Refactor the malloc() etc code to reduce code duplication.
Introduce a t_malloc_fatal flag that makes unintentional allocation
failures fatal.  This reduces the need for error handling in tests.

Enable that flag in t_main().  Test programs that don't want it can
override it in t_prepare().
2014-08-03 00:58:13 +00:00
Dag-Erling Smørgrav
5875ade2ed Add a pointer comparison function. 2014-08-02 23:54:58 +00:00
Dag-Erling Smørgrav
ce567a72e0 Add a simple malloc() implementation which can be configured to fail
when testing error handling code.
2014-08-02 23:30:07 +00:00
Dag-Erling Smørgrav
3f982ecff7 Improve format strings. 2014-08-02 23:26:58 +00:00
Dag-Erling Smørgrav
25ff8b9664 Print hex strings in groups of eight. 2014-08-02 23:26:20 +00:00
Dag-Erling Smørgrav
33cb3dad6a Remove <stdio.h> from code that doesn't need it. 2014-08-02 23:23:19 +00:00
Dag-Erling Smørgrav
996b59dd91 Ignore managed string tests 2014-08-02 23:11:22 +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
cc8109c760 WIP: unit tests for managed strings. 2014-08-01 13:55:01 +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
c658232e3e && is subject to shortcut evaluation, so the second test will not run
if the first failed.  The ultimate outcome is the same, but using &
instead ensures that, when in verbose mode, we also get output from
the second test.
2014-07-19 15:34:49 +00:00
Dag-Erling Smørgrav
063197ed28 tweak svn:ignore 2014-07-19 08:10:09 +00:00
Dag-Erling Smørgrav
bee81cd1fd Prettier hex output 2014-07-19 06:06:33 +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
541d65a3cc pacify autoindenters 2014-07-19 02:59:42 +00:00
Dag-Erling Smørgrav
49e46f74b1 Add unit tests for strlcpy() 2014-07-13 21:35:15 +00:00
Dag-Erling Smørgrav
d508e9ebc2 Missing newline character 2014-07-13 21:34:54 +00:00
Dag-Erling Smørgrav
6be7e6da5f Add a check for buffer overflow 2014-07-13 21:33:46 +00:00
Dag-Erling Smørgrav
f1907404b1 Add a helper script for running the test suite with coverage analysis
enabled.
2014-07-13 21:21:43 +00:00
Dag-Erling Smørgrav
3ed82792fc Fix a bug that affected unterminated buffers: strlcat() would write a NUL
past the end of the buffer and return one less than the correct length.
2014-07-13 20:42:56 +00:00
Dag-Erling Smørgrav
08208a1b3e Add unit tests for strlcat() 2014-07-13 20:40:29 +00:00
Dag-Erling Smørgrav
973b68c4fa Style nits 2014-07-13 20:39:57 +00:00
Dag-Erling Smørgrav
023d9aefaa Add comparison functions for various integer types. 2014-07-13 20:39:00 +00:00
Dag-Erling Smørgrav
4c59fd979b Reorganize the configure script. Move the header and function checks
up so they're not affected by the debugging / developer options.
2014-07-13 19:59:58 +00:00
Dag-Erling Smørgrav
c9536ec04b Add tests for the carry operation in sha384 and sha512, which support
message of up to 2^128 bytes and therefore must use a high / low pair.
2014-07-12 22:12:38 +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