sm3: arm64 sm3ni change slice to array

This commit is contained in:
Sun Yimin 2024-11-14 08:40:53 +08:00 committed by GitHub
parent dee08a50f3
commit 34a6ad2fc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ import (
var useSM3NI = cpu.ARM64.HasSM3 && os.Getenv("DISABLE_SM3NI") != "1"
var t = []uint32{
var t = [...]uint32{
0x79cc4519,
0x9d8a7a87,
}
@ -18,13 +18,13 @@ var t = []uint32{
func blockARM64(dig *digest, p []byte)
//go:noescape
func blockSM3NI(h []uint32, p []byte, t []uint32)
func blockSM3NI(h []uint32, p []byte, t *uint32)
func block(dig *digest, p []byte) {
if !useSM3NI {
blockARM64(dig, p)
} else {
h := dig.h[:]
blockSM3NI(h, p, t)
blockSM3NI(h, p, &t[0])
}
}

View File

@ -3,12 +3,12 @@
#include "textflag.h"
// func blockSM3NI(h []uint32, p []byte, t []uint32)
// func blockSM3NI(h []uint32, p []byte, t *uint32)
TEXT ·blockSM3NI(SB), 0, $0
MOVD h_base+0(FP), R0 // Hash value first address
MOVD p_base+24(FP), R1 // message first address
MOVD p_len+32(FP), R3 // message length
MOVD t_base+48(FP), R2 // t constants first address
MOVD t+48(FP), R2 // t constants first address
VLD1 (R0), [V8.S4, V9.S4] // load h(a,b,c,d,e,f,g,h)
VREV64 V8.S4, V8.S4