From: Dmitry Belyavskiy Date: Sat, 22 Aug 2020 15:42:56 +0000 (+0300) Subject: Fix Coverity #305800 X-Git-Tag: v3.0.0~72 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=4c5220630d819eb91a78bb9f7717335fb3e49c8c;p=openssl-gost%2Fengine.git Fix Coverity #305800 Plus some minor style fix --- diff --git a/benchmark/sign.c b/benchmark/sign.c index 7696b91..d9b08bb 100644 --- a/benchmark/sign.c +++ b/benchmark/sign.c @@ -40,27 +40,24 @@ static EVP_PKEY *create_key(const char *algname, const char *param) EVP_PKEY *key1 = EVP_PKEY_new(), *newkey = NULL; EVP_PKEY_CTX *ctx = NULL; - if(EVP_PKEY_set_type_str(key1, algname, strlen(algname)) <= 0) - { - goto err; - } - if(!(ctx = EVP_PKEY_CTX_new(key1, NULL))) - { - goto err; - } - EVP_PKEY_keygen_init(ctx); - if(ERR_peek_last_error()) - { - goto err; - } - if(EVP_PKEY_CTX_ctrl_str(ctx, "paramset", param) <= 0) - { - goto err; - } - if(EVP_PKEY_keygen(ctx, &newkey) <= 0) - { - goto err; - } + if (EVP_PKEY_set_type_str(key1, algname, strlen(algname)) <= 0) + goto err; + + if (!(ctx = EVP_PKEY_CTX_new(key1, NULL))) + goto err; + + if (EVP_PKEY_keygen_init(ctx) == 0) + goto err; + + if (ERR_peek_last_error()) + goto err; + + if (EVP_PKEY_CTX_ctrl_str(ctx, "paramset", param) <= 0) + goto err; + + if (EVP_PKEY_keygen(ctx, &newkey) <= 0) + goto err; + err: if(ctx) EVP_PKEY_CTX_free(ctx);