fix: zero length NULL can not be used for sm3 digest update.

This commit is contained in:
LI Chen
2018-07-23 10:09:16 +08:00
parent 9d6ad55623
commit 88293ffd8c

View File

@@ -68,7 +68,7 @@ static int init(EVP_MD_CTX *ctx)
static int update(EVP_MD_CTX *ctx, const void *in, size_t inlen)
{
if (!ctx || !EVP_MD_CTX_md_data(ctx) || !in) {
if (!ctx || !EVP_MD_CTX_md_data(ctx) || (!in && inlen != 0)) {
return 0;
}
sm3_update(EVP_MD_CTX_md_data(ctx), in, inlen);