mirror of
https://github.com/golang/go.git
synced 2024-09-29 06:17:11 +00:00
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 <agl@golang.org> Run-TryBot: Adam Langley <agl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
3e9264c9ae
commit
a39950ba66
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user