kdf-sm3: debug words

This commit is contained in:
Sun Yimin 2024-05-21 14:17:16 +08:00 committed by GitHub
parent baa098db08
commit 0ab5fb5baa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 3 deletions

View File

@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4
- name: Test
run: go test -v -short ./...
run: go test -v -short ./sm3/...
env:
DISABLE_SM3NI: 1
DISABLE_SM4NI: 1

View File

@ -112,11 +112,11 @@
VST1.P [V11.S4], 16(wordPtr) \
#define ROUND_12_15(index, const, a, b, c, d, e, f, g, h) \
MESSAGE_SCHEDULE(index) \
MESSAGE_SCHEDULE(index) \
ROUND_00_11(index, const, a, b, c, d, e, f, g, h) \
#define ROUND_16_63(index, const, a, b, c, d, e, f, g, h) \
MESSAGE_SCHEDULE(index); \ // V11 is Wt+4 now, Pls do not use it
MESSAGE_SCHEDULE(index) \ // V11 is Wt+4 now, Pls do not use it
PROLD(a, V12, 12) \
VMOV V12.B16, V13.B16 \
LOAD_T(const, tmp1) \

View File

@ -3,6 +3,7 @@
package sm3
import (
"encoding/binary"
"fmt"
"testing"
)
@ -53,6 +54,13 @@ func TestBlockMultBy4(t *testing.T) {
buffer := make([]byte, 1216)
blockMultBy4(&digs[0], &p[0], &buffer[0], 1)
expected := "[66c7f0f4 62eeedd9 d1f2d46b dc10e4e2 4167c487 5cf2f7a2 297da02b 8f4ba8e0]"
for i := 128; i < 128+68*4*4; i += 64 {
fmt.Printf("%08x %08x %08x %08x ", binary.LittleEndian.Uint32(buffer[i:]), binary.LittleEndian.Uint32(buffer[i+4:]), binary.LittleEndian.Uint32(buffer[i+8:]), binary.LittleEndian.Uint32(buffer[i+12:]))
fmt.Printf("%08x %08x %08x %08x ", binary.LittleEndian.Uint32(buffer[i+16:]), binary.LittleEndian.Uint32(buffer[i+20:]), binary.LittleEndian.Uint32(buffer[i+24:]), binary.LittleEndian.Uint32(buffer[i+28:]))
fmt.Printf("%08x %08x %08x %08x ", binary.LittleEndian.Uint32(buffer[i+32:]), binary.LittleEndian.Uint32(buffer[i+36:]), binary.LittleEndian.Uint32(buffer[i+40:]), binary.LittleEndian.Uint32(buffer[i+44:]))
fmt.Printf("%08x %08x %08x %08x ", binary.LittleEndian.Uint32(buffer[i+48:]), binary.LittleEndian.Uint32(buffer[i+52:]), binary.LittleEndian.Uint32(buffer[i+56:]), binary.LittleEndian.Uint32(buffer[i+60:]))
fmt.Println()
}
s := fmt.Sprintf("%x", digs[0][:])
if s != expected {
t.Errorf("digs[0] got %s", s)