Tobias Brunner
0737e936e0
unit-tests: Additional test cases to increase coverage
2015-08-27 11:47:36 +02:00
Tobias Brunner
520fba4899
identification: Add hash() method
...
Compared to hashing the encoding we can ignore string types of RDNs when
hashing DNs, making hash() compatible to equals() that does the same.
Fixes #991 .
2015-08-06 17:22:32 +02:00
Tobias Brunner
d29a4a5e20
unit-tests: Add unit tests for settings_t.load_string[_section]
2015-07-28 13:27:32 +02:00
Tobias Brunner
764960e8b9
settings: Add support for multi-line strings
...
Unterminated strings are now an error.
2015-07-28 13:27:32 +02:00
Tobias Brunner
65579569ad
host: Properly handle NULL in host_create_from_string[_and_family]
2015-07-27 11:53:26 +02:00
Martin Willi
80d7f44198
unit-tests: Increase failure message buffer to hold larger hex dumps
2015-07-12 13:25:50 +02:00
Martin Willi
ee9f691915
unit-tests: Forward variable argument list in TEST_SUITE_DEPEND
...
For some plugin features, such as crypters or AEADs, we have some additional
feature arguments, such as the key size.
2015-07-12 13:25:50 +02:00
Tobias Brunner
523ea82ed5
unit-tests: Add tests for iv_gen_seq_t
2015-06-05 13:44:42 +02:00
Martin Willi
31a171f5c4
unit-tests: Further increase the test vector testing timeout
...
Some build bots running make check seem to have longer for the DH testing.
2015-04-16 10:15:13 +02:00
Martin Willi
432d712048
unit-tests: Set test verbosity just after test suite loading
...
We see any plugin startup messages during suite configuration, where
initialization is called once to query plugin features. No need to be verbose
and show these messages once again in the first test.
2015-04-15 14:38:43 +02:00
Martin Willi
e507c48e8d
unit-tests: Use progressive testing of transforms with test vectors
...
This allows us to show which transform from which plugin failed. Also, we use
the new cleanup handler functionality that allows proper deinitialization on
failure or timeout.
2015-04-15 14:38:43 +02:00
Martin Willi
de1c492a0f
enum-names: Fail gracefully when passing a NULL value as enum names
2015-04-15 14:38:43 +02:00
Martin Willi
30003bc51a
unit-tests: Invoke all registered thread cleanup handlers on test failure
...
If a test fails in a timeout or a test failure, longjmp() is used to restore
the thread context and handle test failure. However, there might be unreleased
resources, namely locks, which prevent the library to clean up properly after
finishing the test.
By using thread cleanup handlers, we can release any test subject internal or
test specific external resources on test failure. We do so by calling all
registered cleanup handlers.
2015-04-15 14:38:43 +02:00
Martin Willi
d36b30803e
thread: Add a function to pop and call all registered cleanup handlers
2015-04-15 14:38:43 +02:00
Martin Willi
162252aca9
unit-tests: Add a TESTS_PLUGINS environment variable
...
This is often more convenient than specifying plugins in a configuration file.
2015-04-15 14:38:42 +02:00
Martin Willi
26c215e818
unit-tests: Use a larger timeout for test vector testing
...
As we test DH calculations this now takes more time. If multiple DH backends
are enabled, we likely hit the default test timeout.
2015-04-15 14:38:42 +02:00
Martin Willi
2b40c9646c
unit-tests: Pass stringyfied assertion statement as non-format string argument
...
If the assertion contains a modulo (%) operation, test_fail_msg() handles
this as printf() format specifier. Pass the assertion string as argument for
an explicit "%s" in the format string, instead.
2015-04-15 13:44:40 +02:00
Martin Willi
f206bb7444
utils: Add malloc/free wrappers returning aligned data
...
While we could use posix_memalign(3), that is not fully portable. Further, it
might be difficult on some platforms to properly catch it in leak-detective,
which results in invalid free()s when releasing such memory.
We instead use a simple wrapper, which allocates larger data, and saves the
padding size in the allocated header. This requires that memory is released
using a dedicated function.
To reduce the risk of invalid free() when working on corrupted data, we fill up
all the padding with the padding length, and verify it during free_align().
2015-04-15 13:44:40 +02:00
Martin Willi
9d6e952201
utils: Add a constant time chunk_equals() variant for cryptographic purposes
2015-04-14 12:02:48 +02:00
Martin Willi
b833963270
utils: Add a constant time memeq() variant for cryptographic purposes
2015-04-14 11:51:54 +02:00
Martin Willi
a777155ffe
diffie-hellman: Add a bool return value to set_other_public_value()
2015-03-23 17:54:03 +01:00
Martin Willi
42431690e0
diffie-hellman: Add a bool return value to get_my_public_value()
2015-03-23 17:54:03 +01:00
Martin Willi
bace1d6479
diffie-hellman: Use bool instead of status_t as get_shared_secret() return value
...
While such a change is not unproblematic, keeping status_t makes the API
inconsistent once we introduce return values for the public value operations.
2015-03-23 17:54:02 +01:00
Tobias Brunner
cb461de2a2
unit-tests: Fix settings test after merging multi-line strings
2015-03-23 10:46:32 +01:00
Martin Willi
e284a861b8
unit-tests: Depend on SHA1/SHA256 features for mgf1 test cases
2015-03-23 09:53:34 +01:00
Tobias Brunner
1f648d756b
public-key: Add helper to determine acceptable signature schemes for keys
2015-03-04 13:54:10 +01:00
Thomas Egerer
4dc72f5e57
enum: Extend printf hook to print flags
...
Signed-off-by: Thomas Egerer <[email protected] >
2015-03-03 13:41:49 +01:00
Martin Willi
53013b5f0c
unit-tests: Don't fail host_create_from_dns() test if IPv6 not supported
...
On some systems, such as the Ubuntu daily build machine, localhost does not
resolve to an IPv6 address. Accept such a lookup failure.
2015-03-02 14:05:44 +01:00
Andreas Steffen
27bd0fed93
Allow SHA256 and SHA384 data hash for BLISS signatures.
...
The default is SHA512 since this hash function is also
used for the c_indices random oracle.
2015-02-26 08:56:12 +01:00
Martin Willi
0ae862efd1
unit-tests: Add host_create_from_dns() test cases resolving "localhost"
2015-02-24 15:56:37 +01:00
Martin Willi
67a9744bb9
unit-tests: Accept numerical protocol/port numbers in traffic selector tests
2015-02-23 18:44:26 +01:00
Martin Willi
fc978f192f
unit-tests: Add an initial set of traffic selector unit tests
2015-02-20 13:34:48 +01:00
Andreas Steffen
ee3b135687
unit-tests: Adapted to coverity fixes
2014-12-23 15:40:01 +01:00
Andreas Steffen
72bb7eec9c
Implemented get_byte() method for mgf1_bitspender class
...
The new get_byte() method returns a pseudo-random byte at a time.
Changed the get_bits() interface to the same interface as get_byte().
Updated the mgf1 unit-tests accordingly.
2014-11-29 14:51:16 +01:00
Andreas Steffen
37bfe44358
unit-tests: Created separate mgf1 test suite
2014-11-29 14:51:16 +01:00
Andreas Steffen
1d3e080877
Moved mgf1 class to libstrongswan/crypto/mgf1
2014-11-29 14:51:15 +01:00
Martin Willi
f518b52c2d
unit-tests: Test cancellability of some cancellation points we rely on
2014-11-21 12:02:07 +01:00
Tobias Brunner
cd67cd70c8
host: Ignore spaces around - when parsing ranges
2014-10-30 12:32:45 +01:00
Tobias Brunner
82be444eb9
host: Add function to create two hosts from a range definition
2014-10-30 12:32:45 +01:00
Martin Willi
a6c8647eca
constraints: Add permitted/excludedNameConstraints check
2014-10-30 11:40:48 +01:00
Martin Willi
6733109d0e
constraints: Add requireExplicitPolicy tests
2014-10-30 11:40:47 +01:00
Martin Willi
3b25be0e57
constraints: Add inhibitAnyPolicy tests
2014-10-30 11:40:47 +01:00
Martin Willi
af37fac9a8
constraints: Add inhibitPolicyMapping tests
2014-10-30 11:40:47 +01:00
Martin Willi
885646acd3
constraints: Add certificate policy and policy mapping unit tests
2014-10-30 11:32:19 +01:00
Martin Willi
6528338753
identification: Support custom types in string constructor prefixes
2014-10-30 11:07:08 +01:00
Martin Willi
c0da835a9f
identification: Support prefixes in string constructors for an explicit type
2014-10-30 11:05:44 +01:00
Martin Willi
46001e1131
unit-tests: Re-align identification_create_from_string() unit test table data
2014-10-30 11:03:48 +01:00
Martin Willi
6a3f0467e4
threading: Add a more explicit rwlock try_write_lock() testing
2014-10-30 10:45:24 +01:00
Tobias Brunner
e7c582e652
unit-tests: Fix internet checksum tests on big-endian systems
...
We actually need to do a byte-swap, which ntohs() only does on
little-endian systems.
Fixes #747 .
2014-10-23 11:13:54 +02:00
Martin Willi
784916e28d
process: Don't use the shells built-in echo in tests
...
On OS X, the /bin/sh built-in echo does not support -n.
2014-10-14 16:33:10 +02:00