Dag-Erling Smørgrav
2027ce33e7
Add tests for the off-by-one bug we just fixed in mpi_cmp_abs().
2014-12-30 16:38:47 +00:00
Dag-Erling Smørgrav
e21452d0c7
Add a few tests for subtraction. They're not particularly well thought
...
out, because currently subtraction does not work at all, but they work
well enough in the sense that they fail with the current implementation.
2014-12-30 11:19:02 +00:00
Dag-Erling Smørgrav
b6368af502
Re-add $(RT_LIBS) where needed.
2014-12-29 23:56:22 +00:00
Dag-Erling Smørgrav
03867777c6
Add numerous tests, mostly for allocation failures and edge conditions.
...
Add a t_compare_mpi() predicate which checks that two MPIs have the same
value (but not necessarily the exact same representation).
Clean up and improve existing tests.
2014-12-29 23:54:02 +00:00
Dag-Erling Smørgrav
7b6b493509
Declare t_malloc_fail_after.
2014-12-29 23:49:50 +00:00
Dag-Erling Smørgrav
3ec87c7a8c
Introduce t_malloc_fail_after: if non-zero, it serves as a countdown to
...
setting t_malloc_fail. Also, enforce t_malloc_fail in realloc(), but not
before checking that the argument was valid.
2014-12-29 23:49:29 +00:00
Dag-Erling Smørgrav
b2ec312d9f
Link each test with only the libraries it needs. This avoids rebuilding
...
every single test whenever any of the libraries changes.
2014-12-29 22:17:02 +00:00
Dag-Erling Smørgrav
85defb9929
Fix a cast that discards a const qualifier.
2014-12-29 15:23:52 +00:00
Dag-Erling Smørgrav
7a09b0638f
I had forgotten that t_add_test() is actually a printf()-like variadic
...
function, which obviates the need for asprintf() in the string comparison
and equality tests.
2014-12-29 14:24:08 +00:00
Dag-Erling Smørgrav
3333bd5709
Add test cases for the static inline functions in <cryb/endian.h>.
2014-12-29 14:20:28 +00:00
Dag-Erling Smørgrav
0dae3b2417
Test string_equal() using the same test cases as for string_compare().
...
Improve test case descriptions.
2014-12-29 13:36:06 +00:00
Dag-Erling Smørgrav
e20e76a3f7
Recognize "on" and "off".
2014-12-29 13:25:44 +00:00
Dag-Erling Smørgrav
82e32027af
Move the decision of whether to check for memory leaks from the malloc()
...
code to the driver and allow an environment variable to override the
default (on unless coverage is enabled).
2014-12-29 13:24:44 +00:00
Dag-Erling Smørgrav
56eccb99fe
Add two utility functions which check if a string contains something that
...
can be interpreted as either true or false. Use this instead of a basic
non-NULL test for the CRYB_PERFTEST check.
2014-12-29 13:22:53 +00:00
Dag-Erling Smørgrav
559f6c24f7
Fix off-by-one error in TAP output: the test case number was being
...
incremented (converted from zero-based to one-based) twice.
2014-12-29 13:03:08 +00:00
Dag-Erling Smørgrav
eb10ce6d05
If the test case changes desc, it *must* point to an allocated buffer
...
which the driver will free after printing the result.
2014-12-29 12:56:35 +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
eadeeb486c
Skip memory leak checks if coverage analysis is enabled.
2014-12-20 01:30:01 +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
20dab3e342
Provisionally include strlcmp(), although it is not (currently) used
...
anywhere. Opinion is divided as to whether this is useful, or whether
its usefulness is outweighed by its awkwardness. Still, we have it, so
we may as well commit it.
2014-12-20 00:23:59 +00:00
Dag-Erling Smørgrav
a587a25d45
Ignore free(NULL) instead of treating it the same as free(malloc(0)).
2014-10-30 16:35:54 +00:00
Dag-Erling Smørgrav
1f0fd8d9fe
Create an additional test case which always runs after cleanup and checks
...
for memory leaks. It may be necessary to make this optional at some point,
but for now, none of our tests leak memory.
2014-10-30 16:31:03 +00:00
Dag-Erling Smørgrav
14c64ec3a5
Improved checks for <sys/ktrace.h>.
2014-10-30 13:07:16 +00:00
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
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
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
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
be31515f5e
Start of a multiple-precision integer arithmetic library.
2014-08-12 07:30:31 +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
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
cc8109c760
WIP: unit tests for managed strings.
2014-08-01 13:55:01 +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
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
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
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
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
a9e8aed740
Formatting nit
2014-07-11 22:29:02 +00:00
Dag-Erling Smørgrav
8c9c5f26e4
Take advantage of t_compare_mem().
2014-07-11 22:26:23 +00:00
Dag-Erling Smørgrav
2b1d10e02e
Oops, fix copy-pasto in previous commit.
2014-07-11 22:15:57 +00:00
Dag-Erling Smørgrav
a4576782b2
Add generic comparison functions.
2014-07-11 22:10:09 +00:00
Dag-Erling Smørgrav
18650540d8
Avoid hardcoded lengths. This fixes a bug in the HMAC-SHA224 tests.
2014-07-11 15:09:59 +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
17d3517f3a
Forgot to svn add t_const.c.
2014-07-11 12:50:43 +00:00
Dag-Erling Smørgrav
8e786c5a98
Introduce t_zero (a 256-byte array of zeroes) and t_seq8 (a 256-byte array
...
counting up from zero). Use them to simplify the HMAC-SHA1 test vectors.
2014-07-11 12:46:23 +00:00
Dag-Erling Smørgrav
b3a718a7ff
Oops, use the correct keys
2014-07-11 11:28:01 +00:00
Dag-Erling Smørgrav
0681394b23
Replace the FIPS-198 test vectors with those from the NIST CSRC's
...
algorithm example page.
2014-07-11 11:21:19 +00:00
Dag-Erling Smørgrav
cd10966e07
Make the performance tests conditional on a run-time environment variable
...
rather than a build-time option.
2014-07-11 00:18:34 +00:00
Dag-Erling Smørgrav
7c9b8f108a
Reorder for consistency
2014-07-11 00:16:52 +00:00
Dag-Erling Smørgrav
c41c51d901
Reorder for consistency
2014-07-11 00:10:48 +00:00
Dag-Erling Smørgrav
63bcbcca20
Rename the HMAC-SHA1 code.
2014-07-10 23:57:47 +00:00
Dag-Erling Smørgrav
b6578d1bd2
Fix props again again... why does this keep happening?
2014-07-10 17:59:50 +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
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
6da2e5388a
Unbreak the performance tests.
2014-07-10 13:30:48 +00:00
Dag-Erling Smørgrav
25b5dd2e33
Add missing unit test for RFC 3986 support
2014-07-04 11:23:28 +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