From: Todd Short Date: Tue, 1 Sep 2020 18:50:03 +0000 (-0400) Subject: Fix post-condition in algorithm_do_this X-Git-Tag: openssl-3.0.0-alpha7~417 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1010e4ac9743a273d12e4f7c49959607aa4f6403;p=thirdparty%2Fopenssl.git Fix post-condition in algorithm_do_this Reviewed-by: Richard Levitte Reviewed-by: Matt Caswell Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/12760) --- diff --git a/crypto/core_algorithm.c b/crypto/core_algorithm.c index f4a20cb2d1c..68d6129598f 100644 --- a/crypto/core_algorithm.c +++ b/crypto/core_algorithm.c @@ -31,7 +31,7 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata) int first_operation = 1; int last_operation = OSSL_OP__HIGHEST; int cur_operation; - int ok = 0; + int ok = 1; if (data->operation_id != 0) first_operation = last_operation = data->operation_id; @@ -77,9 +77,9 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata) return 0; } - /* If post-condition fulfilled, set general success */ - if (ret) - ok = 1; + /* If post-condition not fulfilled, set general failure */ + if (!ret) + ok = 0; } return ok;