Fix post-condition in algorithm_do_this
authorTodd Short <tshort@akamai.com>
Tue, 1 Sep 2020 18:50:03 +0000 (14:50 -0400)
committerBenjamin Kaduk <bkaduk@akamai.com>
Wed, 2 Sep 2020 22:21:11 +0000 (15:21 -0700)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/12760)

crypto/core_algorithm.c

index f4a20cb2d1c166054afbf5317111af24f735e962..68d6129598fbbe37da8f2905ef63cb3da3e59344 100644 (file)
@@ -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;