From: Niels Möller Date: Sun, 14 Oct 2001 21:30:13 +0000 (+0200) Subject: * testsuite/des-test.m4: Added testcase taken from applied X-Git-Tag: nettle_1.5_release_20020131~127 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b896557157b4527bfd10e9180caf23683ab61d5e;p=thirdparty%2Fnettle.git * testsuite/des-test.m4: Added testcase taken from applied cryptography. Rev: src/nettle/testsuite/des-test.m4:1.2 --- diff --git a/testsuite/des-test.m4 b/testsuite/des-test.m4 index 9d2c40cb..8b75aff2 100644 --- a/testsuite/des-test.m4 +++ b/testsuite/des-test.m4 @@ -8,6 +8,23 @@ uint8_t msg[DES_BLOCK_SIZE]; uint8_t cipher[DES_BLOCK_SIZE]; uint8_t clear[DES_BLOCK_SIZE]; +/* From Applied Cryptography */ +H(msg, "01234567 89ABCDE7"); + +if (!des_set_key(&ctx, H("01234567 89ABCDEF"))) + FAIL; + +des_encrypt(&ctx, DES_BLOCK_SIZE, cipher, msg); + +if (!MEMEQ(DES_BLOCK_SIZE, cipher, + H("C9574425 6A5ED31D"))) + FAIL; + +des_decrypt(&ctx, DES_BLOCK_SIZE, clear, cipher); +if (!MEMEQ(DES_BLOCK_SIZE, msg, clear)) + FAIL; + + H(msg, "00 00 00 00 00 00 00 00"); if (!des_set_key(&ctx, H("01 01 01 01 01 01 01 80")))