]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* testsuite/des-test.m4: Added testcase taken from applied
authorNiels Möller <nisse@lysator.liu.se>
Sun, 14 Oct 2001 21:30:13 +0000 (23:30 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 14 Oct 2001 21:30:13 +0000 (23:30 +0200)
cryptography.

Rev: src/nettle/testsuite/des-test.m4:1.2

testsuite/des-test.m4

index 9d2c40cba4039de935f232fbf1e383b1ce76caf2..8b75aff212a2418b3c22b1af3098a020dde3b919 100644 (file)
@@ -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")))