GmSSL icon indicating copy to clipboard operation
GmSSL copied to clipboard

封装和加密 KDF判断全0的代码实现和文档说明不一致

Open Hugo-Henry opened this issue 3 years ago • 0 comments

SM9_encrypt(加密) 调用 SM9_wrap_key(封装) ,入参keylen = inlen + EVP_MD_size(md); 根据《GM∕T 0044.4-2016 SM9标识密码算法 第4部分:密钥封装机制和公钥加密算法.pdf 》 文档中封装是整个k是否为0,加密只需要k的mlen部分不全为0 实际加密代码SM9_encrypt没有判断mlen而是和封装一样判断k了 详见下面文档和代码截图。

封装的流程 image 加密的流程 image

代码:sm9_enc.c 封装判断非0 image 加密判断非0的长度入参 image

Hugo-Henry avatar Apr 29 '22 06:04 Hugo-Henry