github.com/emmansun/gmsm@v0.29.1/zuc/eia_asm.go (about)

     1  //go:build (amd64 || arm64 || ppc64 || ppc64le) && !purego
     2  
     3  package zuc
     4  
     5  import (
     6  	"github.com/emmansun/gmsm/internal/cpuid"
     7  	"golang.org/x/sys/cpu"
     8  )
     9  
    10  var supportsAES = cpuid.HasAES
    11  var supportsGFMUL = cpuid.HasGFMUL || cpuid.HasVPMSUMD
    12  var useAVX = cpu.X86.HasAVX
    13  
    14  //go:noescape
    15  func eia3Round16B(t *uint32, keyStream *uint32, p *byte, tagSize int)
    16  
    17  func block(m *ZUC128Mac, p []byte) {
    18  	if supportsGFMUL {
    19  		for len(p) >= chunk {
    20  			m.genKeywords(m.k0[4:])
    21  			eia3Round16B(&m.t, &m.k0[0], &p[0], m.tagSize)
    22  			p = p[chunk:]
    23  		}
    24  	} else {
    25  		blockGeneric(m, p)
    26  	}
    27  }