diff options
Diffstat (limited to 'crypto/ex_data.c')
| -rw-r--r-- | crypto/ex_data.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 13b928899456..2835b2a5f1db 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -41,7 +41,7 @@ static EX_CALLBACKS *get_and_lock(OSSL_EX_DATA_GLOBAL *global, int class_index) * If we get here, someone (who?) cleaned up the lock, so just * treat it as an error. */ - return NULL; + return NULL; } if (!CRYPTO_THREAD_write_lock(global->ex_data_lock)) @@ -80,24 +80,23 @@ void ossl_crypto_cleanup_all_ex_data_int(OSSL_LIB_CTX *ctx) global->ex_data_lock = NULL; } - /* * Unregister a new index by replacing the callbacks with no-ops. * Any in-use instances are leaked. */ static void dummy_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, - long argl, void *argp) + long argl, void *argp) { } static void dummy_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, - long argl, void *argp) + long argl, void *argp) { } static int dummy_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, - void **from_d, int idx, - long argl, void *argp) + void **from_d, int idx, + long argl, void *argp) { return 1; } @@ -139,11 +138,11 @@ int CRYPTO_free_ex_index(int class_index, int idx) * Register a new index. */ int ossl_crypto_get_ex_new_index_ex(OSSL_LIB_CTX *ctx, int class_index, - long argl, void *argp, - CRYPTO_EX_new *new_func, - CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func, - int priority) + long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func, + int priority) { int toret = -1; EX_CALLBACK *a; @@ -190,17 +189,17 @@ int ossl_crypto_get_ex_new_index_ex(OSSL_LIB_CTX *ctx, int class_index, toret = sk_EX_CALLBACK_num(ip->meth) - 1; (void)sk_EX_CALLBACK_set(ip->meth, toret, a); - err: +err: CRYPTO_THREAD_unlock(global->ex_data_lock); return toret; } int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, - CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func) + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func) { return ossl_crypto_get_ex_new_index_ex(NULL, class_index, argl, argp, - new_func, dup_func, free_func, 0); + new_func, dup_func, free_func, 0); } /* @@ -211,7 +210,7 @@ int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, * to the global "ex_data" state (ie. class definitions), not 'ad' itself. */ int ossl_crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj, - CRYPTO_EX_DATA *ad) + CRYPTO_EX_DATA *ad) { int mx, i; void *ptr; @@ -249,7 +248,7 @@ int ossl_crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj, if (storage[i] != NULL && storage[i]->new_func != NULL) { ptr = CRYPTO_get_ex_data(ad, i); storage[i]->new_func(obj, ptr, ad, i, - storage[i]->argl, storage[i]->argp); + storage[i]->argl, storage[i]->argp); } } if (storage != stack) @@ -267,7 +266,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) * for each index in the class used by this variable */ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, - const CRYPTO_EX_DATA *from) + const CRYPTO_EX_DATA *from) { int mx, j, i; void *ptr; @@ -325,12 +324,12 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, ptr = CRYPTO_get_ex_data(from, i); if (storage[i] != NULL && storage[i]->dup_func != NULL) if (!storage[i]->dup_func(to, from, &ptr, i, - storage[i]->argl, storage[i]->argp)) + storage[i]->argl, storage[i]->argp)) goto err; CRYPTO_set_ex_data(to, i, ptr); } toret = 1; - err: +err: if (storage != stack) OPENSSL_free(storage); return toret; @@ -408,7 +407,7 @@ void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) if (storage != stack) OPENSSL_free(storage); - err: +err: sk_void_free(ad->sk); ad->sk = NULL; ad->ctx = NULL; @@ -419,7 +418,7 @@ void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) * function */ int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad, - int idx) + int idx) { void *curval; @@ -432,7 +431,7 @@ int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad, } int ossl_crypto_alloc_ex_data_intern(int class_index, void *obj, - CRYPTO_EX_DATA *ad, int idx) + CRYPTO_EX_DATA *ad, int idx) { EX_CALLBACK *f; EX_CALLBACKS *ip; |
