mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-11 03:26:17 +08:00
Updated GCM for SM4 (markdown)
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user