- Support for DES weak keys and parity bits added
diff --git a/tests/suites/test_suite_des.function b/tests/suites/test_suite_des.function
index 59458b8..ab957a6 100644
--- a/tests/suites/test_suite_des.function
+++ b/tests/suites/test_suite_des.function
@@ -255,6 +255,49 @@
END_CASE
BEGIN_CASE
+des_key_parity_run:
+{
+ int i, j, cnt;
+ unsigned char key[DES_KEY_SIZE];
+ unsigned int parity;
+
+ memset( key, 0, DES_KEY_SIZE );
+ cnt = 0;
+
+ // Iterate through all possible byte values
+ //
+ for( i = 0; i < 32; i++ )
+ {
+ for( j = 0; j < 8; j++ )
+ key[j] = cnt++;
+
+ // Set the key parity according to the table
+ //
+ des_key_set_parity( key );
+
+ // Check the parity with a function
+ //
+ for( j = 0; j < 8; j++ )
+ {
+ parity = key[j] ^ ( key[j] >> 4 );
+ parity = parity ^
+ ( parity >> 1 ) ^
+ ( parity >> 2 ) ^
+ ( parity >> 3 );
+ parity &= 1;
+
+ if( parity != 1 )
+ TEST_ASSERT( 0 );
+ }
+
+ // Check the parity with the table
+ //
+ TEST_ASSERT( des_key_check_key_parity( key ) == 0 );
+ }
+}
+END_CASE
+
+BEGIN_CASE
des_selftest:
{
TEST_ASSERT( des_self_test( 0 ) == 0 );