github.com/emmansun/gmsm@v0.29.1/sm3/sm3block_arm64.go (about)

     1  //go:build !purego
     2  
     3  package sm3
     4  
     5  import (
     6  	"os"
     7  	"golang.org/x/sys/cpu"
     8  )
     9  
    10  var useSM3NI = cpu.ARM64.HasSM3 && os.Getenv("DISABLE_SM3NI") != "1"
    11  
    12  var t = []uint32{
    13  	0x79cc4519,
    14  	0x9d8a7a87,
    15  }
    16  
    17  //go:noescape
    18  func blockARM64(dig *digest, p []byte)
    19  
    20  //go:noescape
    21  func blockSM3NI(h []uint32, p []byte, t []uint32)
    22  
    23  func block(dig *digest, p []byte) {
    24  	if !useSM3NI {
    25  		blockARM64(dig, p)
    26  	} else {
    27  		h := dig.h[:]
    28  		blockSM3NI(h, p, t)
    29  	}
    30  }