Merge branch '2.5.x'
[catacomb] / symm / t / poly1305
index 6f74396..b03a0a8 100644 (file)
@@ -1,4 +1,20 @@
 poly1305-hash {
+  ## The tests from Danial J. Bernstein, `The Poly1305-AES message-
+  ## authentication code', 2005-03-29, Appendix B,
+  ## https://cr.yp.to/mac/poly1305-20050329.pdf
+  851fc40c3467ac0be05cc20404f3f700 580b3b0f9447bb1e69d095b5928b6dbc
+    f3f6
+    f4c633c3044fc145f84f335cb81953de;
+  a0f3080000f46400d0c7e9076c834403 dd3fab2251f11ac759f0887129cc2ee7
+    ""
+    dd3fab2251f11ac759f0887129cc2ee7;
+  48443d0bb0d21109c89a100b5ce2c208 83149c69b561dd88298a1798b10716ef
+    663cea190ffb83d89593f3f476b6bc24d7e679107ea26adb8caf6652d0656136
+    0ee1c16bb73f0f4fd19881753c01cdbe;
+  12976a08c4426d0ce8a82407c4f48207 80f8c20aa71202d1e29179cbcb555a57
+    ab0812724a7f1e342742cbed374d94d136c6b8795d45b3819830f2c04491faf0990c62e48b8018b2c3e4a0fa3134cb67fa83e158c994d961c4cb21095c1bf9
+    5154ad0d2cb26e01274fc51148491f1b;
+
   ## This one's from Daniel J. Bernstein, `Cryptography in NaCL', 2009-03-10,
   ## https://cr.yp.to/highspeed/naclcrypto-20090310.pdf
   eea6a7251c1e72916d11c2cb214d3c25 2539121d8e234e652d651fa4c8cff880
@@ -59,3 +75,38 @@ poly1305-cat {
     7973f622a43d14a6599b1f654cb45a74e355a5
     f3ffc7703f9400e52a7dfb4b3d3305d9;
 }
+
+poly1305-mct {
+  ## Monte-Carlo test from https://cr.yp.to/mac/test.html.
+  ## Rather than check MD5 hashes of transcripts, I check the final tag
+  ## value.  These were calculated from transcripts of a scratch
+  ## implementation (utils/poly1305-mct.c) which I checked against the
+  ## reference hashes.
+  ##
+  ## [universe /tmp/mdw]{ ./poly1305-mct | tee >(md5sum >&3) | tail -n1; } 3>&1
+  ## 3ceb64843c00984c5c2b7897f499141b  -
+  ## df62013a9d388ea6e82cb7295fa706ec
+
+  00000000000000000000000000000000
+    00000000000000000000000000000000
+    00000000000000000000000000000000
+    1 596382b2c34704b87e291250fcb927fd;
+  00000000000000000000000000000000
+    00000000000000000000000000000000
+    00000000000000000000000000000000
+    10 7f1d971da577bdd6fb24437aaac845f5;
+  00000000000000000000000000000000
+    00000000000000000000000000000000
+    00000000000000000000000000000000
+    100 e1cb88ba2c498ade2091ab06cefa24fd;
+  00000000000000000000000000000000
+    00000000000000000000000000000000
+    00000000000000000000000000000000
+    1000 f7064b7217e8a6b74b381c58175d9ff2;
+
+  ## The full test.  This takes aaaaages.
+  ##00000000000000000000000000000000
+  ##  00000000000000000000000000000000
+  ##  00000000000000000000000000000000
+  ##  1000000 df62013a9d388ea6e82cb7295fa706ec;
+}