]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* testsuite/des3-test.m4: New testcase.
authorNiels Möller <nisse@lysator.liu.se>
Sat, 8 Sep 2001 22:30:04 +0000 (00:30 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sat, 8 Sep 2001 22:30:04 +0000 (00:30 +0200)
Rev: src/nettle/testsuite/des3-test.m4:1.1

testsuite/des3-test.m4 [new file with mode: 0644]

diff --git a/testsuite/des3-test.m4 b/testsuite/des3-test.m4
new file mode 100644 (file)
index 0000000..7baa2cf
--- /dev/null
@@ -0,0 +1,27 @@
+#include "des.h"
+
+BEGIN_TEST
+
+struct des3_ctx ctx;
+
+uint8_t msg[DES3_BLOCK_SIZE] = "Now is t";
+uint8_t cipher[DES3_BLOCK_SIZE];
+uint8_t clear[DES3_BLOCK_SIZE];
+
+/* Intermediate values: "cd ea 2a 20 c2 e0 9e 48"
+ *                      "69 52 6e 95 8b ea 49 bd"
+ */
+if (!des3_set_key(&ctx, H("3e 0b 10 b0 5d 49 c2 54"
+                         "6b 46 e0 75 8a 91 61 85"
+                         "cb 04 07 d3 20 16 cb a2")))
+  FAIL;
+
+des3_encrypt(&ctx, DES_BLOCK_SIZE, cipher, msg);
+
+if (!MEMEQ(DES_BLOCK_SIZE, cipher,
+       H("0a 5d b5 2d 85 74 d1 c9")))
+  FAIL;
+
+des3_decrypt(&ctx, DES_BLOCK_SIZE, clear, cipher);
+if (!MEMEQ(DES_BLOCK_SIZE, msg, clear))
+  FAIL;