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
Dag-Erling Smørgrav
43b870dc83
WIP: implement subtraction correctly. The actual result is now correct
...
most of the time, but the MSB calculation is not.
2014-12-30 11:23:30 +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
7524a14386
comment nit
2014-12-30 11:15:28 +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
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
bc8e9d67ba
In both mpi_add_abs() and mpi_sub_abs(), make sure that the target is
...
untouched if the operation fails. Also ensure that A = A +/- A works.
2014-12-29 23:44:34 +00:00
Dag-Erling Smørgrav
98c6349d4a
In mpi_zero(), save a memset() if the target is already zero.
2014-12-29 23:22:54 +00:00
Dag-Erling Smørgrav
1412dac680
Shifting any number by zero places is a no-op, but so is shifting zero by
...
any number of places.
2014-12-29 23:20:26 +00:00
Dag-Erling Smørgrav
8228f19d5a
In mpi_copy(), any failure should leave the target untouched.
2014-12-29 23:18:57 +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
889412ec40
Accept a -jN argument which we pass on to gmake.
...
Delete all coverage files, not just the root one.
Exit if the tests fail so we can inspect the result.
2014-12-29 17:04:30 +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
82f5c5cf77
In mpi_load(), use be32dec() when possible.
...
In mpi_set(), it is impossible for the value being loaded to exceed
the minimum size of an mpi; thus, there is no need for mpi_grow().
2014-12-29 15:08:09 +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
3e3d1f8084
Ignore test.cov
2014-12-29 13:38:32 +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
79967f2844
Fix string_equal() for strings of unequal length.
2014-12-29 12:46:44 +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
1a76a0cbb0
Get latest mkpkgng script from OpenPAM.
2014-12-20 02:58:11 +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
4b808bc4df
Fill in.
2014-12-20 01:38:57 +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
75daba7501
Define CRYB_COVERAGE to 1 when building with coverage analysis.
2014-12-20 01:09:58 +00:00
Dag-Erling Smørgrav
13bad71153
Make coverage.sh executable.
2014-12-20 00:52:37 +00:00
Dag-Erling Smørgrav
24ae6c9434
Differentiate between the Cryb libraries and the Cryb.to project.
2014-12-20 00:47:21 +00:00
Dag-Erling Smørgrav
a98753b6ef
Fix various cast-qual bugs.
2014-12-20 00:44:24 +00:00
Dag-Erling Smørgrav
dfa89d80d8
Remove bogus props.
2014-12-20 00:40:07 +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
b74f5f8588
Add -Wcast-qual to the developer warning flags.
2014-12-20 00:27:20 +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
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
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
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
44230ff5e3
Use AC_SEARCH_LIBS instead of AC_CHECK_LIB so we don't pull in librt
...
unless we actually need it.
2014-10-30 14:32:46 +00:00
Dag-Erling Smørgrav
86e7cd9eb1
Fix the checks for the unaligned encoding / decoding functions, as
...
they can be macros or inline functions in either <endian.h> or
<sys/endian.h>.
2014-10-30 13:24:53 +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
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