From 7682e7e3945130cf3cde089834664f68afdd1523 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Mon, 3 Oct 2016 13:54:26 -0700 Subject: [PATCH] poly1305: add test for carry edge-case. This change adds a test that catches the bug which existed in [https://go-review.googlesource.com/#/c/29993/, /30101/). Change-Id: I71177fec0fcbca0dcec7fb11d3ad0a48df1e0b82 Reviewed-on: https://go-review.googlesource.com/30214 Reviewed-by: Brad Fitzpatrick --- poly1305/poly1305_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/poly1305/poly1305_test.go b/poly1305/poly1305_test.go index b3e9231..91b8e2b 100644 --- a/poly1305/poly1305_test.go +++ b/poly1305/poly1305_test.go @@ -33,6 +33,12 @@ var testData = []struct { make([]byte, 32), make([]byte, 16), }, + { + // This test triggers an edge-case. See https://go-review.googlesource.com/#/c/30101/. + []byte{0x81, 0xd8, 0xb2, 0xe4, 0x6a, 0x25, 0x21, 0x3b, 0x58, 0xfe, 0xe4, 0x21, 0x3a, 0x2a, 0x28, 0xe9, 0x21, 0xc1, 0x2a, 0x96, 0x32, 0x51, 0x6d, 0x3b, 0x73, 0x27, 0x27, 0x27, 0xbe, 0xcf, 0x21, 0x29}, + []byte{0x3b, 0x3a, 0x29, 0xe9, 0x3b, 0x21, 0x3a, 0x5c, 0x5c, 0x3b, 0x3b, 0x05, 0x3a, 0x3a, 0x8c, 0x0d}, + []byte{0x6d, 0xc1, 0x8b, 0x8c, 0x34, 0x4c, 0xd7, 0x99, 0x27, 0x11, 0x8b, 0xbe, 0x84, 0xb7, 0xf3, 0x14}, + }, } func testSum(t *testing.T, unaligned bool) {