diff options
Diffstat (limited to 'crypto/core_algorithm.c')
| -rw-r--r-- | crypto/core_algorithm.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/crypto/core_algorithm.c b/crypto/core_algorithm.c index c245c814d98c..2dc1ddf0d7d1 100644 --- a/crypto/core_algorithm.c +++ b/crypto/core_algorithm.c @@ -15,15 +15,15 @@ struct algorithm_data_st { OSSL_LIB_CTX *libctx; - int operation_id; /* May be zero for finding them all */ + int operation_id; /* May be zero for finding them all */ int (*pre)(OSSL_PROVIDER *, int operation_id, int no_store, void *data, - int *result); + int *result); int (*reserve_store)(int no_store, void *data); void (*fn)(OSSL_PROVIDER *, const OSSL_ALGORITHM *, int no_store, - void *data); + void *data); int (*unreserve_store)(void *data); int (*post)(OSSL_PROVIDER *, int operation_id, int no_store, void *data, - int *result); + int *result); void *data; }; @@ -40,7 +40,7 @@ struct algorithm_data_st { * 1 if successful so far, and adding should continue */ static int algorithm_do_map(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *map, - int cur_operation, int no_store, void *cbdata) + int cur_operation, int no_store, void *cbdata) { struct algorithm_data_st *data = cbdata; int ret = 0; @@ -54,7 +54,7 @@ static int algorithm_do_map(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *map, /* If there is no pre-condition function, assume "yes" */ ret = 1; } else if (!data->pre(provider, cur_operation, no_store, data->data, - &ret)) { + &ret)) { /* Error, bail out! */ ret = -1; goto end; @@ -82,12 +82,12 @@ static int algorithm_do_map(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *map, /* If there is no post-condition function, assume "yes" */ ret = 1; } else if (!data->post(provider, cur_operation, no_store, data->data, - &ret)) { + &ret)) { /* Error, bail out! */ ret = -1; } - end: +end: data->unreserve_store(data->data); return ret; @@ -111,14 +111,14 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata) first_operation = last_operation = data->operation_id; for (cur_operation = first_operation; - cur_operation <= last_operation; - cur_operation++) { - int no_store = 0; /* Assume caching is ok */ + cur_operation <= last_operation; + cur_operation++) { + int no_store = 0; /* Assume caching is ok */ const OSSL_ALGORITHM *map = NULL; int ret = 0; map = ossl_provider_query_operation(provider, cur_operation, - &no_store); + &no_store); ret = algorithm_do_map(provider, map, cur_operation, no_store, data); ossl_provider_unquery_operation(provider, cur_operation, map); @@ -135,19 +135,21 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata) } void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id, - OSSL_PROVIDER *provider, - int (*pre)(OSSL_PROVIDER *, int operation_id, - int no_store, void *data, int *result), - int (*reserve_store)(int no_store, void *data), - void (*fn)(OSSL_PROVIDER *provider, - const OSSL_ALGORITHM *algo, - int no_store, void *data), - int (*unreserve_store)(void *data), - int (*post)(OSSL_PROVIDER *, int operation_id, - int no_store, void *data, int *result), - void *data) + OSSL_PROVIDER *provider, + int (*pre)(OSSL_PROVIDER *, int operation_id, + int no_store, void *data, int *result), + int (*reserve_store)(int no_store, void *data), + void (*fn)(OSSL_PROVIDER *provider, + const OSSL_ALGORITHM *algo, + int no_store, void *data), + int (*unreserve_store)(void *data), + int (*post)(OSSL_PROVIDER *, int operation_id, + int no_store, void *data, int *result), + void *data) { - struct algorithm_data_st cbdata = { 0, }; + struct algorithm_data_st cbdata = { + 0, + }; cbdata.libctx = libctx; cbdata.operation_id = operation_id; @@ -169,7 +171,7 @@ void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id, * a programming error in the functions up the call stack. */ if (!ossl_assert(ossl_lib_ctx_get_concrete(libctx) - == ossl_lib_ctx_get_concrete(libctx2))) + == ossl_lib_ctx_get_concrete(libctx2))) return; cbdata.libctx = libctx2; |
