diff --git a/tests/suites/test_suite_des.data b/tests/suites/test_suite_des.data index 729164905..559d5de8e 100644 --- a/tests/suites/test_suite_des.data +++ b/tests/suites/test_suite_des.data @@ -1,3 +1,15 @@ +DES check weak key #1 +des_check_weak:"0101010101010101":1 + +DES check weak key #2 +des_check_weak:"FEE0FEE0FEF1FEF1":1 + +DES check weak key #3 +des_check_weak:"0101010101010100":0 + +DES check weak key #4 +des_check_weak:"EEE0FEE0FEF1FEF1":0 + DES Encrypt OpenSSL Test Vector #1 des_encrypt_ecb:"0000000000000000":"0000000000000000":"8CA64DE9C1B123A7" diff --git a/tests/suites/test_suite_des.function b/tests/suites/test_suite_des.function index ee327c917..d5d0f11ed 100644 --- a/tests/suites/test_suite_des.function +++ b/tests/suites/test_suite_des.function @@ -7,6 +7,19 @@ * END_DEPENDENCIES */ +/* BEGIN_CASE */ +void des_check_weak( char *key_hex, int ret ) +{ + unsigned char key[DES_KEY_SIZE]; + + memset( key, 0, sizeof key ); + + unhexify( key, key_hex ); + + TEST_ASSERT( des_key_check_weak( key ) == ret ); +} +/* END_CASE */ + /* BEGIN_CASE */ void des_encrypt_ecb( char *hex_key_string, char *hex_src_string, char *hex_dst_string )