Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1435)

Delta Between Two Patch Sets: src/pkg/crypto/aes/aes_test.go

Issue 6549055: code review 6549055: crypto/aes: speed up using AES-NI on amd64 (Closed)
Left Patch Set: diff -r 29cff1e8de4e https://code.google.com/p/go Created 11 years, 6 months ago
Right Patch Set: diff -r c2719ae32b09 https://code.google.com/p/go/ Created 11 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/crypto/aes/asm_amd64.s » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package aes 5 package aes
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 ) 9 )
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 // Test key expansion against FIPS 197 examples. 215 // Test key expansion against FIPS 197 examples.
216 func TestExpandKey(t *testing.T) { 216 func TestExpandKey(t *testing.T) {
217 L: 217 L:
218 for i, tt := range keyTests { 218 for i, tt := range keyTests {
219 enc := make([]uint32, len(tt.enc)) 219 enc := make([]uint32, len(tt.enc))
220 var dec []uint32 220 var dec []uint32
221 if tt.dec != nil { 221 if tt.dec != nil {
222 dec = make([]uint32, len(tt.dec)) 222 dec = make([]uint32, len(tt.dec))
223 } 223 }
224 » » expandKey(tt.key, enc, dec) 224 » » // This test could only test Go version of expandKey because asm
225 » » // version might use different memory layout for expanded keys
226 » » // This is OK because we don't expose expanded keys to the outsi de
227 » » expandKeyGo(tt.key, enc, dec)
225 for j, v := range enc { 228 for j, v := range enc {
226 if v != tt.enc[j] { 229 if v != tt.enc[j] {
227 t.Errorf("key %d: enc[%d] = %#x, want %#x", i, j , v, tt.enc[j]) 230 t.Errorf("key %d: enc[%d] = %#x, want %#x", i, j , v, tt.enc[j])
228 continue L 231 continue L
229 } 232 }
230 } 233 }
231 if dec != nil { 234 if dec != nil {
232 for j, v := range dec { 235 for j, v := range dec {
233 if v != tt.dec[j] { 236 if v != tt.dec[j] {
234 t.Errorf("key %d: dec[%d] = %#x, want %# x", i, j, v, tt.dec[j]) 237 t.Errorf("key %d: dec[%d] = %#x, want %# x", i, j, v, tt.dec[j])
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 384
382 func BenchmarkExpand(b *testing.B) { 385 func BenchmarkExpand(b *testing.B) {
383 tt := encryptTests[0] 386 tt := encryptTests[0]
384 n := len(tt.key) + 28 387 n := len(tt.key) + 28
385 c := &aesCipher{make([]uint32, n), make([]uint32, n)} 388 c := &aesCipher{make([]uint32, n), make([]uint32, n)}
386 b.ResetTimer() 389 b.ResetTimer()
387 for i := 0; i < b.N; i++ { 390 for i := 0; i < b.N; i++ {
388 expandKey(tt.key, c.enc, c.dec) 391 expandKey(tt.key, c.enc, c.dec)
389 } 392 }
390 } 393 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b