From: Dmitry Belyavskiy Date: Mon, 4 May 2020 20:01:48 +0000 (+0300) Subject: Fix coverity issue 300458 X-Git-Tag: v3.0.0~154 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=d19a1a820d7be62647bbdd7448d851498bf18968;p=openssl-gost%2Fengine.git Fix coverity issue 300458 --- diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c index 4a0eb82..2b4a96e 100644 --- a/gost_ec_keyx.c +++ b/gost_ec_keyx.c @@ -86,10 +86,15 @@ int VKO_compute_key(unsigned char *shared_key, GOSTerr(GOST_F_VKO_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); goto err; } - EVP_MD_CTX_init(mdctx); - EVP_DigestInit_ex(mdctx, md, NULL); - EVP_DigestUpdate(mdctx, databuf, buf_len); - EVP_DigestFinal_ex(mdctx, shared_key, NULL); + + if (EVP_MD_CTX_init(mdctx) == 0 + || EVP_DigestInit_ex(mdctx, md, NULL) == 0 + || EVP_DigestUpdate(mdctx, databuf, buf_len) == 0 + || EVP_DigestFinal_ex(mdctx, shared_key, NULL) == 0) { + GOSTerr(GOST_F_VKO_COMPUTE_KEY, ERR_R_EVP_LIB); + goto err; + } + ret = (EVP_MD_size(md) > 0) ? EVP_MD_size(md) : 0; err: