From a39950ba66998b7166a37ddf878d0a414a267ea5 Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Fri, 15 Apr 2016 15:20:24 -0400 Subject: [PATCH] crypto/aes: delete TestEncryptBlock and TestDecryptBlock The encryptBlock and decryptBlock functions are already tested (via the public API) by TestCipherEncrypt and TestCipherDecrypt respectively. Both sets of tests check the output of the two functions against the same set of FIPS 197 examples. I therefore think it is safe to delete these two tests without losing any coverage. Deleting these two tests will make it easier to modify the internal API, which I am hoping to do in future CLs. Change-Id: I0dd568bc19f47b70ab09699b507833e527d39ba7 Reviewed-on: https://go-review.googlesource.com/22115 Reviewed-by: Adam Langley Run-TryBot: Adam Langley TryBot-Result: Gobot Gobot --- src/crypto/aes/aes_test.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/crypto/aes/aes_test.go b/src/crypto/aes/aes_test.go index 363180931c..28144968fc 100644 --- a/src/crypto/aes/aes_test.go +++ b/src/crypto/aes/aes_test.go @@ -280,42 +280,6 @@ var encryptTests = []CryptTest{ }, } -// Test encryptBlock against FIPS 197 examples. -func TestEncryptBlock(t *testing.T) { - for i, tt := range encryptTests { - n := len(tt.key) + 28 - enc := make([]uint32, n) - dec := make([]uint32, n) - expandKey(tt.key, enc, dec) - out := make([]byte, len(tt.in)) - encryptBlock(enc, out, tt.in) - for j, v := range out { - if v != tt.out[j] { - t.Errorf("encryptBlock %d: out[%d] = %#x, want %#x", i, j, v, tt.out[j]) - break - } - } - } -} - -// Test decryptBlock against FIPS 197 examples. -func TestDecryptBlock(t *testing.T) { - for i, tt := range encryptTests { - n := len(tt.key) + 28 - enc := make([]uint32, n) - dec := make([]uint32, n) - expandKey(tt.key, enc, dec) - plain := make([]byte, len(tt.in)) - decryptBlock(dec, plain, tt.out) - for j, v := range plain { - if v != tt.in[j] { - t.Errorf("decryptBlock %d: plain[%d] = %#x, want %#x", i, j, v, tt.in[j]) - break - } - } - } -} - // Test Cipher Encrypt method against FIPS 197 examples. func TestCipherEncrypt(t *testing.T) { for i, tt := range encryptTests {