CORE: Fix a couple of bugs in algorithm_do_this()
authorRichard Levitte <levitte@openssl.org>
Fri, 15 May 2020 05:50:43 +0000 (07:50 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 16 May 2020 10:08:32 +0000 (12:08 +0200)
The call of ossl_provider_query_operation() used |data->operation_id|,
when |cur_operation| should be used.

If any ossl_provider_query_operation() call returned NULL, the loop
was stopped, when it should just continue on to the next operation.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11837)

crypto/core_algorithm.c

index 2973b37..79625fd 100644 (file)
@@ -37,11 +37,11 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata)
          cur_operation <= last_operation;
          cur_operation++) {
         const OSSL_ALGORITHM *map =
-            ossl_provider_query_operation(provider, data->operation_id,
+            ossl_provider_query_operation(provider, cur_operation,
                                           &no_store);
 
         if (map == NULL)
-            break;
+            continue;
 
         ok = 1;                  /* As long as we've found *something* */
         while (map->algorithm_names != NULL) {