Updated GCM for SM4 (markdown)

Sun Yimin 2022-07-22 16:48:55 +08:00
parent 971759d84c
commit 2a26029737

@ -1,5 +1,5 @@
为sm4实现的GCM汇编代码是从AES GCM实现中摘抄的。主要为以下三个函数 为sm4实现的GCM汇编代码是从AES GCM实现中摘抄的。主要为以下三个函数
``` ```golang
//go:noescape //go:noescape
func precomputeTableAsm(productTable *[256]byte, src *[16]byte) func precomputeTableAsm(productTable *[256]byte, src *[16]byte)
@ -20,7 +20,7 @@ func gcmSm4Finish(productTable *[256]byte, tagMask, T *[16]byte, pLen, dLen uint
1. AMD64同时支持AVX2和NON-AVX2代码量比较大比较复杂 1. AMD64同时支持AVX2和NON-AVX2代码量比较大比较复杂
1. 和GHASH的混合处理提高性能 1. 和GHASH的混合处理提高性能
计划先把下面方法转成ASM: 计划先把下面方法转成ASM:
``` ```golang
// counterCrypt crypts in to out using g.cipher in counter mode. // counterCrypt crypts in to out using g.cipher in counter mode.
func (g *gcm) counterCrypt(out, in []byte, counter *[gcmBlockSize]byte) { func (g *gcm) counterCrypt(out, in []byte, counter *[gcmBlockSize]byte) {
mask := make([]byte, g.cipher.blocksSize) mask := make([]byte, g.cipher.blocksSize)