From 88293ffd8c09b32972f53a37cdb6a3f7dda60105 Mon Sep 17 00:00:00 2001 From: LI Chen Date: Mon, 23 Jul 2018 10:09:16 +0800 Subject: [PATCH] fix: zero length NULL can not be used for sm3 digest update. --- crypto/evp/m_sm3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/evp/m_sm3.c b/crypto/evp/m_sm3.c index 35f0f211..942f4258 100644 --- a/crypto/evp/m_sm3.c +++ b/crypto/evp/m_sm3.c @@ -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);