next-> gcm arm64

This commit is contained in:
emmansun 2022-01-01 21:35:49 +08:00
parent 00454701b6
commit c0fca30844

View File

@ -12,7 +12,7 @@ import (
var supportSM4 = cpu.ARM64.HasSM4 var supportSM4 = cpu.ARM64.HasSM4
var supportsAES = cpu.X86.HasAES || cpu.ARM64.HasAES var supportsAES = cpu.X86.HasAES || cpu.ARM64.HasAES
var supportsGFMUL = cpu.X86.HasPCLMULQDQ var supportsGFMUL = cpu.X86.HasPCLMULQDQ // || cpu.ARM64.HasPMULL
//go:noescape //go:noescape
func encryptBlocksAsm(xk *uint32, dst, src *byte) func encryptBlocksAsm(xk *uint32, dst, src *byte)
@ -33,9 +33,9 @@ func newCipher(key []byte) (cipher.Block, error) {
} }
c := sm4CipherAsm{sm4Cipher{make([]uint32, rounds), make([]uint32, rounds)}} c := sm4CipherAsm{sm4Cipher{make([]uint32, rounds), make([]uint32, rounds)}}
expandKeyAsm(&key[0], &ck[0], &c.enc[0], &c.dec[0]) expandKeyAsm(&key[0], &ck[0], &c.enc[0], &c.dec[0])
//if supportsAES && supportsGFMUL { if supportsAES && supportsGFMUL {
// return &sm4CipherGCM{c}, nil return &sm4CipherGCM{c}, nil
//} }
return &c, nil return &c, nil
} }