mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
kdf-sm3: debug words
This commit is contained in:
parent
baa098db08
commit
0ab5fb5baa
2
.github/workflows/test_qemu.yml
vendored
2
.github/workflows/test_qemu.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v -short ./...
|
run: go test -v -short ./sm3/...
|
||||||
env:
|
env:
|
||||||
DISABLE_SM3NI: 1
|
DISABLE_SM3NI: 1
|
||||||
DISABLE_SM4NI: 1
|
DISABLE_SM4NI: 1
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
ROUND_00_11(index, const, a, b, c, d, e, f, g, h) \
|
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) \
|
#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) \
|
PROLD(a, V12, 12) \
|
||||||
VMOV V12.B16, V13.B16 \
|
VMOV V12.B16, V13.B16 \
|
||||||
LOAD_T(const, tmp1) \
|
LOAD_T(const, tmp1) \
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
package sm3
|
package sm3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@ -53,6 +54,13 @@ func TestBlockMultBy4(t *testing.T) {
|
|||||||
buffer := make([]byte, 1216)
|
buffer := make([]byte, 1216)
|
||||||
blockMultBy4(&digs[0], &p[0], &buffer[0], 1)
|
blockMultBy4(&digs[0], &p[0], &buffer[0], 1)
|
||||||
expected := "[66c7f0f4 62eeedd9 d1f2d46b dc10e4e2 4167c487 5cf2f7a2 297da02b 8f4ba8e0]"
|
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][:])
|
s := fmt.Sprintf("%x", digs[0][:])
|
||||||
if s != expected {
|
if s != expected {
|
||||||
t.Errorf("digs[0] got %s", s)
|
t.Errorf("digs[0] got %s", s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user