Add test for des_key_check_weak()

This commit is contained in:
Manuel Pégourié-Gonnard 2014-03-29 17:06:43 +01:00
parent 3fec220a33
commit 9ce7e8414a
2 changed files with 25 additions and 0 deletions

View File

@ -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"

View File

@ -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 )