Pārlūkot izejas kodu

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 <bradfitz@golang.org>
Adam Langley 9 gadi atpakaļ
vecāks
revīzija
7682e7e394
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      poly1305/poly1305_test.go

+ 6 - 0
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) {