Commit Graph

355 Commits

Author SHA1 Message Date
James Prestwood 05dcbfd982 unit: update AKM values to 32 bits in test-ie 2019-04-04 16:11:32 -05:00
James Prestwood 5338904824 unit: add check for SHA256/HMAC in SAE test 2019-04-04 11:43:01 -05:00
Marcel Holtmann ea074ffe67 build: Create ELL_UNIT_TEST_DATA define for certificate directory 2019-04-03 19:16:29 +02:00
Denis Kenzior f8af73f2c7 unit: Use l_container_of 2019-04-03 11:49:36 -05:00
Tim Kourt 2a104185a0 unit: Rename EAP TLS type 2019-04-02 14:34:43 -05:00
Andrew Zaborowski 7031045dfb unit: Update mschapv2 test to use mschap_nt_password_hash 2019-03-19 11:34:46 -05:00
James Prestwood 8fbd0870fc unit: fix test-sae to use new status codes 2019-02-27 16:16:03 -06:00
Denis Kenzior c638fd50c8 unit: Add IWD_TLS_DEBUG environment variable handling 2019-02-22 14:48:44 -06:00
James Prestwood 08b6f4c432 unit: fix test-sae bad group test
When this test was written only group 19 was supported. The 'bad_group'
test used, at the time, unsupported group 20. Now group 20 is supported
so this test was expecting a failure. This updates the test to use group
0xff, which is not a valid ECC group and should always fail.
2019-02-07 12:16:14 -06:00
Denis Kenzior 3cf0184089 unit: Add another test with an out-of-order tag 2019-02-07 10:44:37 -06:00
Andrew Zaborowski 62851b9e47 unit: Fix usage of sizeof(struct eapol_key) in test-eapol 2019-01-22 11:40:47 -06:00
James Prestwood f6013d8730 unit: update test-eapol to work with crypto/eapol changes 2019-01-17 15:20:28 -06:00
James Prestwood 79f7cb85c3 unit: update test-crypto to work with eapol/crypto changes 2019-01-17 15:20:28 -06:00
Denis Kenzior 6bf7e638b0 unit: Fix asan warning
==24642==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe00450850 at pc 0x7f2043eef5e3 bp 0x7ffe00450660 sp 0x7ffe0044fdf0
WRITE of size 3 at 0x7ffe00450850 thread T0
    #0 0x7f2043eef5e2 in __interceptor_vsprintf /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:1522
    #1 0x7f2043eef956 in __interceptor_sprintf /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:1553
    #2 0x4026f1 in prf_test unit/test-prf-sha1.c:64
    #3 0x407478 in l_test_run ell/test.c:83
    #4 0x4029e3 in main unit/test-prf-sha1.c:130
    #5 0x7f2042dd9ed9 in __libc_start_main (/lib64/libc.so.6+0x20ed9)
    #6 0x401f79 in _start (/home/denkenz/iwd-master/unit/test-prf-sha1+0x401f79)
2019-01-11 11:34:49 -06:00
Tim Kourt 58f7b06c01 unit: Switch eap-mschapv2 test to use mschaputil 2019-01-10 17:04:57 -06:00
Denis Kenzior 9b722197ba ecc: Remove remaining ECC/ECDH files
ECC primitives have now been fully converted / moved to ell.
2019-01-10 16:27:09 -06:00
James Prestwood e5cf66ddb2 unit: fix test-sae to use a valid peer point
Now that the peer element is validated we must send valid point data.
This should have been done in the beginning anyways, but since the
point data was not previously validated this test still passed.

Since this particular unit test is really testing timeouts we can just
use the commit buffer for other tests since it contains a valid scalar
and point.
2019-01-10 16:26:29 -06:00
Andrew Zaborowski 1578a37ac2 unit: Call the new l_tls_start in eap-tls test 2018-12-19 10:05:38 -06:00
James Prestwood c2094c5e04 ecdh: remove ECDH and unit tests
ECDH was moved into ell and is no longer needed in IWD
2018-12-12 11:12:27 -06:00
James Prestwood 007d972046 unit: allow ECDH test vector to run without l_getrandom
Using the gcc wrap feature, l_getrandom was redefined to use a known
good, hardcoded random value. The two other tests were also disabled
if l_getrandom is not supported since these do require randomness
for proper testing.
2018-11-20 17:28:44 -06:00
James Prestwood 44c4074c35 unit: add ECDH test vector
RFC 5114 defines a test vector for each ECP group. These values were
hard coded into a new ECDH unit test.
2018-11-19 13:46:34 -06:00
Andrew Zaborowski 8c333a585a unit: Update for l_tls API changes 2018-11-19 13:04:30 -06:00
James Prestwood dddbf22ab7 unit: added ECDH unit tests 2018-11-16 16:25:20 -06:00
Marcel Holtmann 16824cad05 unit: Use L_ARRAY_SIZE instead own version of it 2018-11-09 14:49:33 +01:00
Tim Kourt f369c9006e unit: use new setting key name for EAP-MD5 2018-10-29 18:46:07 -05:00
Tim Kourt 949e672b75 unit: Fix TTLS test
Single AVP should not be padded with zeros as padding is only
used to separate AVPs in a sequence.

RFC 5281 Section 10.2.  AVP Sequences

   Data encapsulated within the TLS record layer must consist entirely
   of a sequence of zero or more AVPs.  Each AVP must begin on a four-
   octet boundary relative to the first AVP in the sequence.  If an AVP
   is not a multiple of four octets, it must be padded with zeros to the
   next four-octet boundary.

   Note that the AVP Length does not include the padding.
2018-10-19 10:00:10 -05:00
Marcel Holtmann 8f8a214fbd build: Use new l_tls_prf_get_bytes and remove ell/tls-private.h usage 2018-10-19 09:30:59 +02:00
Marcel Holtmann 467d3958b4 build: Use l_tls_prf_get_bytes instead of tls_prf_get_bytes 2018-10-19 08:46:57 +02:00
Marcel Holtmann b27edce298 build: Use include "" instead of include <> for ell/tls-private.h 2018-10-19 08:24:57 +02:00
Denis Kenzior d22e57c994 treewide: Remove use of key-private.h 2018-10-19 00:31:41 -05:00
Andrew Zaborowski 6405f487c6 unit: Update handshake_state WPA/RSN IE setter names 2018-08-27 11:46:38 -05:00
James Prestwood 700b7de175 unit: check random support on test-sae 2018-08-23 14:55:10 -05:00
James Prestwood 801188885c unit: updated test-sae to use le API's following sae.c 2018-08-23 12:24:06 -05:00
James Prestwood 41d35e561a unit: fix buffer overrun in SAE test 2018-08-15 15:54:18 -05:00
James Prestwood 26246e75c8 unit: tests for SAE 2018-08-15 13:26:58 -05:00
Denis Kenzior db378dd2e8 unit: Fix compilation warning
Some compilers complained that:

../unit/test-ecc.c: In function ‘run_test’:
../unit/test-ecc.c:295:38: warning: ‘lres’ may be used uninitialized in
	this function [-Wmaybe-uninitialized]

assert(data->lres == lres);
                     ^
2018-08-10 14:46:03 -05:00
James Prestwood c629d71427 unit: updated eapol test to reflect API changes
verify/calculate_mic and key decryption API's now take the AKM suite
2018-08-09 15:06:44 -05:00
James Prestwood 99d1e0595e unit: added test for vli_legendre 2018-08-08 16:06:29 -05:00
Denis Kenzior 412a03f236 unit: drop unit tests for removed functions 2018-07-30 08:59:55 -05:00
Tim Kourt 243a574d75 unit: add client token finder test 2018-07-25 11:47:49 -05:00
Denis Kenzior 41361053b3 unit: Print tls_alert 2018-06-28 13:23:29 -05:00
Denis Kenzior 5446389d32 unit: Store handshake_failed in test_handshake_state
Instead of using a global variable
2018-06-27 17:01:22 -05:00
James Prestwood 5d31fc25d7 unit: updated unit test with eapol deauth removal 2018-06-27 16:45:53 -05:00
Denis Kenzior 7c0bc22b7c unit: Update to the new API 2018-06-21 20:10:07 -05:00
Denis Kenzior 180a893c0c unit: Update to the new EAP API 2018-06-14 20:01:22 -05:00
Tim Kourt c23849adf6 unit: add include for the changed public func 2018-05-31 19:39:42 -05:00
Denis Kenzior 5616962bb2 unit: Update scan_get_security usage to new API 2018-05-24 19:22:16 -05:00
James Prestwood d810e7ab45 unit: updated ecc unit tests to use byte conversion 2018-05-04 19:33:55 -05:00
James Prestwood 49d313ab68 unit: Add ECC math sanity tests 2018-05-03 10:48:46 -05:00
Denis Kenzior 736db5c27c unit: update to the new API 2018-05-01 16:19:38 -05:00
Tim Kourt 7501d9372b unit: network args parser validation 2018-03-28 14:33:00 -05:00
Andrew Zaborowski b1356680b7 unit: Update handshake_state_set_pmk parameters 2018-03-15 11:40:17 -05:00
Denis Kenzior 973b7b4555 unit: Additional support checks for WSC tests 2018-01-24 11:07:36 -06:00
Denis Kenzior 9e0d11f948 unit: pin generation test depends on getrandom
Turn this test off if the kernel doesn't have it
2018-01-24 09:17:00 -06:00
Denis Kenzior f91380c195 unit: Skip EAPoL tests when kernel features are missing 2018-01-23 15:50:35 -06:00
Denis Kenzior b64efb83bc unit: Don't run WSC tests if kernel features missing
WSC uses Diffie-Hellman and AES-CBC, so don't bother running the tests
that need these in case the feature is not present in the kernel.
2018-01-23 15:50:32 -06:00
Denis Kenzior a1f4a9901d unit: Add EAPoL retransmission test 2017-10-19 16:47:35 -05:00
Andrew Zaborowski 525ecbb113 unit: Remove pbkdf2_sha1 tests
They can now be moved to ELL.
2017-10-09 14:34:31 -05:00
Andrew Zaborowski 47ae1c2f06 unit: Add IE order tests in test-mpdu 2017-09-22 12:15:37 -05:00
Andrew Zaborowski 786b93ffc4 unit: Add Extended Element ID tests in test-ie 2017-09-22 12:00:15 -05:00
Andrew Zaborowski fd661d5e9f unit: Use new mpdu.h structs 2017-08-31 15:13:31 -05:00
Denis Kenzior da029bead8 unit: Use overlapped in/out buffers
Since aes_wrap & aes_unwrap advertise support for overlapped in/out
buffers, make sure that the unit test actually tests this as well.
valgrind will complain if the memory is overlapped and memcpy is used
instead of memmove.
2017-08-31 13:16:28 -05:00
Denis Kenzior 9da2d64980 unit: Add check that AES is present 2017-08-31 13:15:15 -05:00
Andrew Zaborowski ef652642b5 unit: Test aes_wrap and aed_unwrap in test-crypto 2017-08-31 13:10:47 -05:00
James Prestwood 83995b5099 unit: update SIM unit tests to derive MAC changes 2017-08-30 17:31:43 -05:00
James Prestwood 8b575103b6 unit: Added unit tests for EAP-AKA' API's
This adds unit tests for the new key derivation functions
in simutil.c. The test data was obtained from RFC 5448
(case 1 and 2).
2017-08-30 16:39:10 -05:00
James Prestwood b2fe7fe230 unit: EAP-SIM unit tests
Several unit tests for EAP-SIM functionality:
 - Get/Add attributes
 - MAC calculation
 - PRNG test
2017-08-21 18:03:13 -05:00
Denis Kenzior 23d9b4c089 unit: Only run tests if checksum is available 2017-06-01 16:30:14 -05:00
Andrew Zaborowski e05bfc5f98 unit: Update tests to pass ETH_P_PAE to __eapol_rx_packet 2017-04-18 11:43:19 -05:00
Julien Massot dc3b17f496 unit: fix ie test comparison
Most likely here we want to compare the variable
not doing an assignment.

unit/test-ie.c:227:2: error: suggest parentheses around
assignment used as truth value [-Werror=parentheses]
assert(expected_len = final_len);
^~~~~~
2017-04-10 09:46:10 -05:00
Denis Kenzior 15308201f9 unit: Add test for wsc_pin_generate 2017-02-17 12:27:27 -06:00
Denis Kenzior 40013e9981 unit: Add sanity check for wsc_pin_is_checksum_valid 2017-02-13 20:27:49 -06:00
Denis Kenzior 5a8d573ae4 unit: squash memory leak 2017-02-13 19:42:35 -06:00
Denis Kenzior 11f4ff2e25 unit: Add sanity check for wsc_is_pin_valid 2017-02-13 19:40:23 -06:00
Denis Kenzior 3d4da25b6c unit: Tweak style 2016-12-14 23:09:55 -06:00
Markus Ongyerth dfc852dd3e unit: Add tests for eap-mschapv2 functions 2016-12-14 22:47:00 -06:00
Rahul Rahul 0453b4e52f unit/test-eapol: fixed handshake frame in tls test
eapol_sm_test_tls was using an incorrect frame in
handshake_state_set_own_wpa.
2016-12-02 10:05:50 -06:00
Rahul Rahul 71932acd2d unit/test-eapol: igtk test with mfp enabled
This is the first version of the test
2016-12-02 09:45:42 -06:00
Tim Kourt eeb4f35bcb unit: WSC unfragmented retransmission 2016-12-01 11:33:39 -06:00
Denis Kenzior d26e224bfc unit: Update to new eap_init API 2016-11-15 16:44:24 -06:00
Andrew Zaborowski ea08bcd8fd unit: Fix eapol TLS test after handshake_state changes 2016-11-14 11:20:20 -06:00
Andrew Zaborowski 73e61fa787 unit: Update wsc test with eapol API changes 2016-11-03 10:24:22 -05:00
Andrew Zaborowski f74e6f4261 unit: Update eapol test with eapol API changes 2016-11-03 10:24:12 -05:00
Andrew Zaborowski 955ba74d2d unit: FT 4-Way Handshake eapol test
This also tests that the FT crypto functions work.  For the record
these are the values of the intermediate keys in this test:

ANonce: 33 b2 74 a0 ae c9 e8 5d 61 11 8f 1b 6b 97 77 4e 5b 75 08 37 45
77 dc 14 08 a5 f1 80 c5 d2 e9 fd
SNonce: ac 1e b2 c7 0b 20 8c e6 0a e2 07 b2 38 9e 44 1f ff 39 86 3d 44
9f 81 24 6f e3 6e de 0f 1f 56 ce
PMK-R0: ad b8 81 bf 50 11 1c fd 0b 5c 87 23 42 bf 3b 54 3e 81 d6 3f 3e
18 cf 0a 8d 3d 85 4f d8 07 ad d5
PMKR0Name: cc 62 4a e8 6e 0c 85 25 06 02 22 15 f7 3d 0d 01
PMK-R1: 17 6a 37 92 25 28 72 9f 40 18 06 20 b4 2d 34 2a 7b 8d da 09 4c
a9 cf 84 bd 55 4a 39 bc 5d c1 61
PMKR1Name: de ce 50 a0 9e f0 8c 4e be f2 f1 db e9 67 b4 d4
KCK: e4 2d ee 98 f9 9d fb f8 32 9f 50 41 05 58 35 a2
KEK: 34 5e 22 4e 91 73 8a 97 dd c4 19 53 c5 c8 d7 29
TK: 7c ff bd 35 ce 11 c5 75 1d 4c c6 7a df c2 a2 78
PTKName: 31 e4 94 a6 96 a5 c3 7e 2f 33 9c 47 04 dc ae 05
2016-11-03 10:06:01 -05:00
Andrew Zaborowski c3efd80dd0 unit: Update eapol_sm_set_ap/own_rsn/wpa parameters 2016-10-29 23:09:15 -05:00
Andrew Zaborowski bf65ce9096 unit: Update eapol and WSC tests for new eapol calls 2016-10-15 16:26:41 -05:00
Denis Kenzior 25fb91034a unit: update to the new eapol_start API 2016-09-13 17:38:16 -05:00
Denis Kenzior dc37dca24b unit: Add testing of credential obtained events 2016-09-13 13:33:18 -05:00
Denis Kenzior fb446dcb9f unit: Update to the new EAPoL api 2016-09-12 10:03:37 -05:00
Denis Kenzior e48220c7a6 unit: Verify M8 & EAP-Fail processing 2016-09-09 12:36:49 -05:00
Denis Kenzior 8cd797dced unit: Add test for wsc_build_wsc_done 2016-09-08 21:28:38 -05:00
Denis Kenzior 588f8a555d unit: Add test for wsc_parse_wsc_done 2016-09-08 21:28:26 -05:00
Denis Kenzior 70d3a01bda unit: Add parsing of wsc_credential 2016-08-31 22:36:50 -05:00
Denis Kenzior 4f582753b5 unit: Add test for wsc_parse_m8_encrypted_settings 2016-08-31 22:00:52 -05:00
Denis Kenzior fa8cbeea7c unit: Add test for wsc_build_m8 2016-08-31 14:15:16 -05:00
Denis Kenzior a2b740f161 unit: Add test for wsc_parse_m8 2016-08-31 14:15:11 -05:00
Denis Kenzior 387af676cf unit: Add M6/M7 exchange test 2016-08-31 12:50:53 -05:00
Denis Kenzior f542a18f4f unit: Simplify verification 2016-08-31 12:37:30 -05:00
Denis Kenzior 9353da8bf3 unit: Add test for wsc_build_m7 2016-08-31 11:38:35 -05:00
Denis Kenzior 82b007f7b5 unit: Add test fo wsc_parse_m7 2016-08-31 11:38:22 -05:00
Denis Kenzior f8eb76a93a unit: Add test for wsc_build_m6_encrypted_settings 2016-08-31 11:16:30 -05:00
Denis Kenzior 2f09fbc348 unit: Add test for wsc_parse_m6_encrypted_settings 2016-08-31 11:16:15 -05:00
Denis Kenzior 11cb6e5d35 unit: Add test for wsc_build_m6 2016-08-31 11:14:48 -05:00
Denis Kenzior 6e9b5c912c unit: Add test for wsc_parse_m6 2016-08-31 11:14:48 -05:00
Denis Kenzior 97771f80f1 unit: Add M4/M5 pair to end-to-end wsc test 2016-08-30 23:20:43 -05:00
Denis Kenzior 1820d7c33e merge: M5 parse test 2016-08-30 23:18:19 -05:00
Denis Kenzior ba8e0cd6b7 unit: Add test for wsc_build_m4_encrypted_settings 2016-08-30 13:58:32 -05:00
Denis Kenzior f8af4886c4 unit: Add test for wsc_parse_m4_encrypted_settings 2016-08-30 13:58:06 -05:00
Denis Kenzior a4bf3f3280 unit: Add M5 builder unit test 2016-08-30 09:46:33 -05:00
Denis Kenzior 5c88de6e65 unit: Add M5 parser unit test 2016-08-30 09:46:20 -05:00
Denis Kenzior be1b2a3281 unit: Add end-to-end WSC handshake test
This only checks M1 & M3 message generation for now
2016-08-30 09:22:35 -05:00
Denis Kenzior f05ed4683c unit: Fix up EAP packet identifiers
Reset these to start at a sane value
2016-08-24 21:30:25 -05:00
Denis Kenzior 89207a4c81 unit: Add testing of Authenticator
Just to make sure our private/public/shared and KDF utilities work
properly.
2016-08-23 15:44:45 -05:00
Denis Kenzior 28a57b2eca unit: Make valgrind happy 2016-08-19 16:16:16 -05:00
Denis Kenzior 76e1c73fd3 unit: Add M4 builder test 2016-08-19 15:25:05 -05:00
Denis Kenzior 5322daa79a unit: Add M4 parser unit test 2016-08-19 15:15:53 -05:00
Denis Kenzior 61047664c9 unit: Add M3 builder unit test 2016-08-18 17:59:15 -05:00
Denis Kenzior 951eb26ec0 unit: Add M3 parser unit test 2016-08-18 17:48:42 -05:00
Denis Kenzior b80254375b unit: Add another M2 parser test 2016-08-18 17:29:47 -05:00
Denis Kenzior 2ec8f0e17d unit: Add another M1 build test 2016-08-18 16:36:07 -05:00
Denis Kenzior 8e6c2cea65 unit: Add another M1 parser test 2016-08-18 16:32:06 -05:00
Denis Kenzior 038341edcd unit: Add another DH generator test 2016-08-18 16:25:27 -05:00
Denis Kenzior 84be16c76f unit: Add test for M2 builder 2016-08-17 22:20:46 -05:00
Denis Kenzior ed6e5665d4 unit: Add M2 parser unit test 2016-08-17 22:20:44 -05:00
Denis Kenzior b8e54d2834 unit: Add M1 builder unit test 2016-08-16 15:28:48 -05:00
Denis Kenzior 1c5988b0b8 unit: Update to new wscutil api 2016-08-16 12:31:23 -05:00
Denis Kenzior 62e485839f unit: compare public key to expected value as well 2016-08-15 10:56:37 -05:00
Denis Kenzior a5d3e583ff unit: Add DH5 pubkey generation test 2016-08-15 10:52:44 -05:00
Denis Kenzior 2a4398847c unit: Add test for M1 parser 2016-08-15 10:47:33 -05:00
Denis Kenzior a22e3394fc unit: Update to eapol's protocol version changes 2016-08-10 16:34:19 -05:00
Denis Kenzior 86ad3c4e03 unit: Fix style 2016-08-10 16:31:35 -05:00
Denis Kenzior a5c79de774 unit: Silence some benign warnings 2016-08-10 16:31:04 -05:00
Mat Martineau 9112f7e18e unit: Use PKCS8 private keys
ELL's TLS implementation is being converted to keyctl crypto, which
currently requires PKCS8 formatted keys.
2016-08-10 12:15:41 -05:00
Mat Martineau 60a9638f51 unit: Fix uninitialized variable 2016-08-10 12:14:42 -05:00
Denis Kenzior 63878a84c1 unit: Update to the new eapol api 2016-06-28 18:18:50 -05:00
Denis Kenzior a3820a6f41 unit: Update to the new API 2016-05-11 15:54:16 -05:00
Denis Kenzior 0fde36b0af unit: Update to the new API 2016-02-10 16:55:26 -06:00
Denis Kenzior 98b580a224 unit: Add SHA-256 based KDF unit test 2016-02-10 16:31:01 -06:00
Denis Kenzior fa852d1c48 unit: Remove references to sha1.h 2016-02-10 14:36:27 -06:00
Denis Kenzior 752981fdd8 unit: Update include for pbkdf2_sha1 2016-02-10 14:33:30 -06:00
Denis Kenzior b190283be7 unit: Update header for prf_sha1 2016-02-10 14:17:01 -06:00
Denis Kenzior 694ed08e30 unit: Update header for hmac_sha1 2016-02-10 14:13:25 -06:00
Andrew Zaborowski f23499cc3e unit: Add an EAPoL+EAP failure test 2015-11-02 21:51:07 -06:00
Andrew Zaborowski 4c04db5618 unit: Add an EAPOL+EAP-TTLS+EAP-MD5 scenario test 2015-11-02 21:51:07 -06:00
Andrew Zaborowski 13e4432b5e unit: Add an EAPOL+EAP-TLS test 2015-11-02 21:51:07 -06:00
Andrew Zaborowski 2bccb7e7dc eapol: Remove user_data from __eapol_rx_packet args
Instead of passing the user_data parameter in every __eapol_rx_packet
call to be used by EAPOL in all tx_packet calls, add
eapol_sm_set_tx_user_data function that sets the value of user_data for
all subsequent tx_packet calls.  This way tx_packet can be called from
places that are not necessarily inside an __eapol_rx_packet call.
2015-11-02 21:40:21 -06:00
Andrew Zaborowski ef9b6f41ce eapol: Separate EAPOL header from struct eapol_key
This is needed so we can better handle sending and receiving EAPoL
packets other than EAPoL-Key.
2015-11-02 21:40:21 -06:00
Denis Kenzior d377b4c31f unit: Add unit test for wsc_uuid_from_addr 2015-09-18 17:16:28 -05:00
Denis Kenzior e055460709 wsc: Rename wsc.[ch] to wscutil.[ch] 2015-09-10 23:07:34 -05:00
Denis Kenzior 6a368c0f6e unit: Add ie encapsulation for wsc test 2015-09-10 22:47:50 -05:00