Files
2026-05-27 23:03:00 +08:00

24 lines
598 B
Go

//go:build amd64 || arm64
// +build amd64 arm64
package sm4
import "crypto/cipher"
/*TODO use aesni to improve performance */
type sm4CipherGCM struct {
sm4CipherAsm
}
// NewGCM returns the SM4 cipher wrapped in Galois Counter Mode. This is only
// called by crypto/cipher.NewGCM via the gcmAble interface.
//
// 调用crypto/cipher.NewGCM的时候在回调sm4CipherGCM.NewGCM
func (c *sm4CipherGCM) NewGCM(nonceSize, tagSize int) (cipher.AEAD, error) {
// TODO 判断size,先返回错误
// 现在是默认实现-sm4CipherAsm没有gcmAble接口
return cipher.NewGCM(&c.sm4CipherAsm)
}