mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
sm3: arm64 sm3ni change slice to array
This commit is contained in:
parent
dee08a50f3
commit
34a6ad2fc0
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
var useSM3NI = cpu.ARM64.HasSM3 && os.Getenv("DISABLE_SM3NI") != "1"
|
var useSM3NI = cpu.ARM64.HasSM3 && os.Getenv("DISABLE_SM3NI") != "1"
|
||||||
|
|
||||||
var t = []uint32{
|
var t = [...]uint32{
|
||||||
0x79cc4519,
|
0x79cc4519,
|
||||||
0x9d8a7a87,
|
0x9d8a7a87,
|
||||||
}
|
}
|
||||||
@ -18,13 +18,13 @@ var t = []uint32{
|
|||||||
func blockARM64(dig *digest, p []byte)
|
func blockARM64(dig *digest, p []byte)
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func blockSM3NI(h []uint32, p []byte, t []uint32)
|
func blockSM3NI(h []uint32, p []byte, t *uint32)
|
||||||
|
|
||||||
func block(dig *digest, p []byte) {
|
func block(dig *digest, p []byte) {
|
||||||
if !useSM3NI {
|
if !useSM3NI {
|
||||||
blockARM64(dig, p)
|
blockARM64(dig, p)
|
||||||
} else {
|
} else {
|
||||||
h := dig.h[:]
|
h := dig.h[:]
|
||||||
blockSM3NI(h, p, t)
|
blockSM3NI(h, p, &t[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
// func blockSM3NI(h []uint32, p []byte, t []uint32)
|
// func blockSM3NI(h []uint32, p []byte, t *uint32)
|
||||||
TEXT ·blockSM3NI(SB), 0, $0
|
TEXT ·blockSM3NI(SB), 0, $0
|
||||||
MOVD h_base+0(FP), R0 // Hash value first address
|
MOVD h_base+0(FP), R0 // Hash value first address
|
||||||
MOVD p_base+24(FP), R1 // message first address
|
MOVD p_base+24(FP), R1 // message first address
|
||||||
MOVD p_len+32(FP), R3 // message length
|
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)
|
VLD1 (R0), [V8.S4, V9.S4] // load h(a,b,c,d,e,f,g,h)
|
||||||
VREV64 V8.S4, V8.S4
|
VREV64 V8.S4, V8.S4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user