wond4

Results 2 issues of wond4

近期在做国密密码机对接,发现 sm4 库 gcm 模式下计算出的密文和密码机一致,但是鉴别TAG不同。 系统测试后发现密码机、[GmSSL](https://github.com/guanzhi/GmSSL)和[在线验证](https://const.net.cn/tool/sm4/sm4-gcm-encrypt/)结果一致,基本确定本库实现有问题。验证截图如下: ![image](https://user-images.githubusercontent.com/38349899/195540970-5f6c8287-8287-48b8-994f-c91969c30e3c.png) ![image](https://user-images.githubusercontent.com/38349899/195541115-1fbde82c-73ac-42e8-8bd4-9ad05e55903a.png)

问题描述请参考 #178 经排查是 GHASH 函数未对A、C长度移位,已修复。 修复后运行截图如下: ![image](https://user-images.githubusercontent.com/38349899/195542608-8f6c3ad0-871c-4e7a-bc68-ba8e95f7e611.png) ![image](https://user-images.githubusercontent.com/38349899/195541115-1fbde82c-73ac-42e8-8bd4-9ad05e55903a.png) PS: 增加了 GHASH 函数的单元测试(来自[GMSSL测试代码](https://github.com/guanzhi/GmSSL/blob/master/tests/gcmtest.c))