From 96059a7c75a21b20efd0f53bbcb68cc8e2681c1c Mon Sep 17 00:00:00 2001 From: Emman Date: Fri, 31 Dec 2021 13:16:15 +0800 Subject: [PATCH] check result --- sm4/cipher_asm_fuzzy_test.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sm4/cipher_asm_fuzzy_test.go b/sm4/cipher_asm_fuzzy_test.go index 1e142da..a390971 100644 --- a/sm4/cipher_asm_fuzzy_test.go +++ b/sm4/cipher_asm_fuzzy_test.go @@ -5,12 +5,12 @@ package sm4 import ( "crypto/rand" + "fmt" "io" - "reflect" "testing" - "time" ) +/* func TestExpandKey(t *testing.T) { key := make([]byte, 16) @@ -43,3 +43,18 @@ func TestExpandKey(t *testing.T) { } } } +*/ + +func TestExpandKeySimple(t *testing.T) { + key := make([]byte, 16) + + encRes1 := make([]uint32, 32) + decRes1 := make([]uint32, 32) + encRes2 := make([]uint32, 32) + decRes2 := make([]uint32, 32) + io.ReadFull(rand.Reader, key) + expandKeyGo(key, encRes1, decRes1) + expandKeyAsm(&key[0], &ck[0], &encRes2[0], &decRes2[0]) + fmt.Printf("expected=%v, result=%v\n", encRes1, encRes2) + fmt.Printf("expected=%v, result=%v\n", decRes1, decRes2) +}