Commit graph

246 commits

Author SHA1 Message Date
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
eb61dac230 <unistd.h> required for t_compare_ssz() 2015-10-12 10:20:14 +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
b5d5f111ca Add missing Makefile 2015-10-04 07:51:08 +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
ab8f712584 Correctly register AES192 and AES256 2015-10-04 07:19:52 +00:00
Dag-Erling Smørgrav
aa4a92bac9 Fix cipher macros 2015-10-04 07:19:28 +00:00
Dag-Erling Smørgrav
cf02f33af7 Implement the full range of test vectors from RFC 6229. 2015-10-04 07:08:36 +00:00
Dag-Erling Smørgrav
476c9f27f7 Use our own endianness conversion macros. 2015-10-04 07:07:53 +00:00
Dag-Erling Smørgrav
03bd9ea902 Code cleanup 2015-10-03 15:33:47 +00:00
Dag-Erling Smørgrav
ed9403627f Add more AES test vectors 2015-10-03 15:13:17 +00:00
Dag-Erling Smørgrav
dd466ab29b Move some code around 2015-10-03 14:47:59 +00:00
Dag-Erling Smørgrav
023ec74be2 Implement cipher algorithm list and rename some files. 2015-10-03 14:44:59 +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
1826bb12bf Modify the coverage build script so that it only runs "make clean" if
coverage was not already enabled when the script was started.
2015-10-03 14:30:24 +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
94471e9923 Always clear the negative flag in mpi_zero() 2015-10-03 14:23:32 +00:00
Dag-Erling Smørgrav
9042130830 Fix ossifrage underflow error in Adler32 unit test 2015-10-03 14:20:07 +00:00
Dag-Erling Smørgrav
bf36ff7a8c Correct context length for SHA digests 2015-10-03 13:56:07 +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
8d087eeb64 Fix endian.h includes 2015-10-03 09:31:57 +00:00
Dag-Erling Smørgrav
f99073058c Whitespace cleanup to reduce diffs between SHA-512 and SHA-384. 2015-09-15 10:09:09 +00:00
Dag-Erling Smørgrav
17ccbb2f76 rm leftover code from a copypasto 2015-08-28 10:44:30 +00:00
Dag-Erling Smørgrav
0961e4b2e0 Rewrite unit tests for the Fletcher and Adler checksums to exercise
boundary conditions (low and high word overflow).
2015-08-28 08:38:49 +00:00
Dag-Erling Smørgrav
8351719b84 Simplify test cases by a) using C99 VLAs and b) removing error checks for
allocation failures which are either harmless (e.g. failing to allocate
the test description string) or will trigger a segfault which the driver
now catches, allowing subequent test cases to run.
2015-08-19 11:27:48 +00:00
Dag-Erling Smørgrav
cbc2cd1112 If a test case triggers one of a list of signals (including SIGABRT and
SIGSEGV), eat it and fail the test.  Also print a summary in verbose mode.
2015-08-19 11:17:06 +00:00
Dag-Erling Smørgrav
5e1e20c624 Add marginally useful test cases based on t_zero. 2015-08-18 15:21:02 +00:00
Dag-Erling Smørgrav
d670e3e94d Increase the sizeo of t_zero to 4096 bytes. 2015-08-18 15:14:11 +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
1609b4e08a Cite the Fletcher paper. 2015-08-18 10:42:41 +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
e4c5e8a9dd Fix props 2015-08-17 15:24:50 +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
110ad04333 If no SVN version is available, use today's date.
Place the temporary directory in ${builddir} rather than /tmp.
2015-02-15 09:19:25 +00:00
Dag-Erling Smørgrav
dc75f2edd8 Add a memset_s() implementation (cf. C11 / WG14 N1381) 2015-02-15 09:18:18 +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
342ac3fd78 Note that rand_bytes() is just a placeholder for the sake of liboath. 2015-01-08 12:24:19 +00:00
Dag-Erling Smørgrav
a33f58cad7 Fix equality predicate. 2015-01-07 19:23:38 +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
cddb6c0e02 Rewrite the zero shortcut tests to avoid dropping a const qualifier. 2014-12-30 20:03:58 +00:00
Dag-Erling Smørgrav
3904e809b2 Add two test cases for shortcut logic used when one operand is zero and
the other is also the target.
2014-12-30 19:57:07 +00:00
Dag-Erling Smørgrav
241f524238 Fix a bogus t_malloc_fail in one of the mpi_add_abs() tests.
Add several subtraction test cases and modify some others to better
exercise the carry logic, which is far more complex for subtraction than
for addition.

Add test cases where the target is the same MPI as one or both operands.
2014-12-30 19:48:57 +00:00
Dag-Erling Smørgrav
7a90ca7b42 Since X may point to the same MPI as either G or L (or even both), we
can't set the carry flag based on the contents of G or L after having
modified X.  Instead, compute and stash the new carry value first.
2014-12-30 19:14:59 +00:00
Dag-Erling Smørgrav
8d0e24dee7 Remove the "trailing garbage" version of the mpi_cmp() test. It would
be better to systematically pad MPIs used in all tests with garbage.

Greatly expand the number of mpi_cmp() tests to cover all possible
combinations of same or different sign, same or different msb and same
or different magnitude.
2014-12-30 17:00:56 +00:00
Dag-Erling Smørgrav
f18b915b67 Fix the "x = a + b" allocation failure test. Since a and b were
equal, mpi_sub_abs() would return early and the test would never
exercise the mpi_grow() call which is intended to fail.
2014-12-30 16:46:44 +00:00
Dag-Erling Smørgrav
0d483f20ab Fix msb calculation. We may have to backtrack quite a bit, for
instance when subtracting two nearly equal large numbers.
2014-12-30 16:45:18 +00:00
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
1c024928f9 Fix off-by-one bug in mpi_cmp() which could cause it to read past the
end of the buffer.
2014-12-30 16:35:13 +00:00