diff options
author | Rich Salz <rsalz@akamai.com> | 2021-05-19 17:09:49 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-05-28 10:04:31 +0200 |
commit | a935791d54078f43209ffbc1886ac5e68772ce34 (patch) | |
tree | 3f130fe3e12b6671584ff421984542579d5268a8 /crypto/engine | |
parent | Fix doc typos. (diff) | |
download | openssl-a935791d54078f43209ffbc1886ac5e68772ce34.tar.xz openssl-a935791d54078f43209ffbc1886ac5e68772ce34.zip |
Rework and make DEBUG macros consistent.
Remove unused -DCONF_DEBUG and -DBN_CTX_DEBUG.
Rename REF_PRINT to REF_DEBUG for consistency, and add a new
tracing category and use it for printing reference counts.
Rename -DDEBUG_UNUSED to -DUNUSED_RESULT_DEBUG
Fix BN_DEBUG_RAND so it compiles and, when set, force DEBUG_RAND to
be set also.
Rename engine_debug_ref to be ENGINE_REF_PRINT also for consistency.
Fixes #15357
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15353)
Diffstat (limited to 'crypto/engine')
-rw-r--r-- | crypto/engine/eng_init.c | 6 | ||||
-rw-r--r-- | crypto/engine/eng_lib.c | 4 | ||||
-rw-r--r-- | crypto/engine/eng_list.c | 12 | ||||
-rw-r--r-- | crypto/engine/eng_local.h | 12 | ||||
-rw-r--r-- | crypto/engine/tb_asnmth.c | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/crypto/engine/eng_init.c b/crypto/engine/eng_init.c index 20147a5263..c204eb1899 100644 --- a/crypto/engine/eng_init.c +++ b/crypto/engine/eng_init.c @@ -34,8 +34,8 @@ int engine_unlocked_init(ENGINE *e) */ e->struct_ref++; e->funct_ref++; - engine_ref_debug(e, 0, 1); - engine_ref_debug(e, 1, 1); + ENGINE_REF_PRINT(e, 0, 1); + ENGINE_REF_PRINT(e, 1, 1); } return to_return; } @@ -57,7 +57,7 @@ int engine_unlocked_finish(ENGINE *e, int unlock_for_handlers) * to 0 without either calling finish(). */ e->funct_ref--; - engine_ref_debug(e, 1, -1); + ENGINE_REF_PRINT(e, 1, -1); if ((e->funct_ref == 0) && e->finish) { if (unlock_for_handlers) CRYPTO_THREAD_unlock(global_engine_lock); diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index a022fc1d54..44e997e77b 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -34,7 +34,7 @@ ENGINE *ENGINE_new(void) return NULL; } ret->struct_ref = 1; - engine_ref_debug(ret, 0, 1); + ENGINE_REF_PRINT(ret, 0, 1); if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data)) { OPENSSL_free(ret); return NULL; @@ -77,7 +77,7 @@ int engine_free_util(ENGINE *e, int not_locked) CRYPTO_DOWN_REF(&e->struct_ref, &i, global_engine_lock); else i = --e->struct_ref; - engine_ref_debug(e, 0, -1); + ENGINE_REF_PRINT(e, 0, -1); if (i > 0) return 1; REF_ASSERT_ISNT(i < 0); diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c index 7ea1ef675a..fec0ef7129 100644 --- a/crypto/engine/eng_list.c +++ b/crypto/engine/eng_list.c @@ -91,7 +91,7 @@ static int engine_list_add(ENGINE *e) * Having the engine in the list assumes a structural reference. */ e->struct_ref++; - engine_ref_debug(e, 0, 1); + ENGINE_REF_PRINT(e, 0, 1); /* However it came to be, e is the last item in the list. */ engine_list_tail = e; e->next = NULL; @@ -143,7 +143,7 @@ ENGINE *ENGINE_get_first(void) ret = engine_list_head; if (ret) { ret->struct_ref++; - engine_ref_debug(ret, 0, 1); + ENGINE_REF_PRINT(ret, 0, 1); } CRYPTO_THREAD_unlock(global_engine_lock); return ret; @@ -163,7 +163,7 @@ ENGINE *ENGINE_get_last(void) ret = engine_list_tail; if (ret) { ret->struct_ref++; - engine_ref_debug(ret, 0, 1); + ENGINE_REF_PRINT(ret, 0, 1); } CRYPTO_THREAD_unlock(global_engine_lock); return ret; @@ -183,7 +183,7 @@ ENGINE *ENGINE_get_next(ENGINE *e) if (ret) { /* Return a valid structural reference to the next ENGINE */ ret->struct_ref++; - engine_ref_debug(ret, 0, 1); + ENGINE_REF_PRINT(ret, 0, 1); } CRYPTO_THREAD_unlock(global_engine_lock); /* Release the structural reference to the previous ENGINE */ @@ -204,7 +204,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e) if (ret) { /* Return a valid structural reference to the next ENGINE */ ret->struct_ref++; - engine_ref_debug(ret, 0, 1); + ENGINE_REF_PRINT(ret, 0, 1); } CRYPTO_THREAD_unlock(global_engine_lock); /* Release the structural reference to the previous ENGINE */ @@ -316,7 +316,7 @@ ENGINE *ENGINE_by_id(const char *id) } } else { iterator->struct_ref++; - engine_ref_debug(iterator, 0, 1); + ENGINE_REF_PRINT(iterator, 0, 1); } } CRYPTO_THREAD_unlock(global_engine_lock); diff --git a/crypto/engine/eng_local.h b/crypto/engine/eng_local.h index ef96a5769f..9f5840e837 100644 --- a/crypto/engine/eng_local.h +++ b/crypto/engine/eng_local.h @@ -20,14 +20,14 @@ extern CRYPTO_RWLOCK *global_engine_lock; /* - * This prints the engine's pointer address (truncated to unsigned int), - * "struct" or "funct" to indicate the reference type, the before and after - * reference count, and the file:line-number pair. The "engine_ref_debug" - * statements must come *after* the change. + * This prints the engine's pointer address, "struct" or "funct" to + * indicate the reference type, the before and after reference count, and + * the file:line-number pair. The "ENGINE_REF_PRINT" statements must come + * *after* the change. */ -# define engine_ref_debug(e, isfunct, diff) \ +# define ENGINE_REF_PRINT(e, isfunct, diff) \ OSSL_TRACE6(ENGINE_REF_COUNT, \ - "engine: %p %s from %d to %d (%s:%d)\n", \ + "engine: %p %s from %d to %d (%s:%d)\n", \ (void *)(e), (isfunct ? "funct" : "struct"), \ ((isfunct) \ ? ((e)->funct_ref - (diff)) \ diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c index fffd4888f9..e3a5c82e99 100644 --- a/crypto/engine/tb_asnmth.c +++ b/crypto/engine/tb_asnmth.c @@ -206,7 +206,7 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, /* If found obtain a structural reference to engine */ if (fstr.e) { fstr.e->struct_ref++; - engine_ref_debug(fstr.e, 0, 1); + ENGINE_REF_PRINT(fstr.e, 0, 1); } *pe = fstr.e; CRYPTO_THREAD_unlock(global_engine_lock); |