mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Use clang-tidy to add curly braces around one-line statements
The command used to reformat the files in this commit was: ./util/run-clang-tidy \ -clang-tidy-binary clang-tidy-11 -clang-apply-replacements-binary clang-apply-replacements-11 \ -checks=-*,readability-braces-around-statements \ -j 9 \ -fix \ -format \ -style=file \ -quiet clang-format -i --style=format $(git ls-files '*.c' '*.h') uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h') clang-format -i --style=format $(git ls-files '*.c' '*.h')
This commit is contained in:
@@ -42,16 +42,17 @@ static isc_mem_t *dst__mctx = NULL;
|
||||
|
||||
#if !defined(OPENSSL_NO_ENGINE)
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#endif /* if !defined(OPENSSL_NO_ENGINE) */
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
static isc_mutex_t *locks = NULL;
|
||||
static int nlocks;
|
||||
#endif
|
||||
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
||||
* defined(LIBRESSL_VERSION_NUMBER) */
|
||||
|
||||
#if !defined(OPENSSL_NO_ENGINE)
|
||||
static ENGINE *e = NULL;
|
||||
#endif
|
||||
#endif /* if !defined(OPENSSL_NO_ENGINE) */
|
||||
|
||||
static void
|
||||
enable_fips_mode(void)
|
||||
@@ -77,12 +78,14 @@ lock_callback(int mode, int type, const char *file, int line)
|
||||
{
|
||||
UNUSED(file);
|
||||
UNUSED(line);
|
||||
if ((mode & CRYPTO_LOCK) != 0)
|
||||
if ((mode & CRYPTO_LOCK) != 0) {
|
||||
LOCK(&locks[type]);
|
||||
else
|
||||
} else {
|
||||
UNLOCK(&locks[type]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
||||
* defined(LIBRESSL_VERSION_NUMBER) */
|
||||
|
||||
#if defined(LIBRESSL_VERSION_NUMBER)
|
||||
static unsigned long
|
||||
@@ -90,7 +93,7 @@ id_callback(void)
|
||||
{
|
||||
return ((unsigned long)isc_thread_self());
|
||||
}
|
||||
#endif
|
||||
#endif /* if defined(LIBRESSL_VERSION_NUMBER) */
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
static void
|
||||
@@ -98,7 +101,7 @@ _set_thread_id(CRYPTO_THREADID *id)
|
||||
{
|
||||
CRYPTO_THREADID_set_numeric(id, (unsigned long)isc_thread_self());
|
||||
}
|
||||
#endif
|
||||
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L */
|
||||
|
||||
isc_result_t
|
||||
dst__openssl_init(isc_mem_t *mctx, const char *engine)
|
||||
@@ -110,7 +113,7 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine)
|
||||
|
||||
#if defined(OPENSSL_NO_ENGINE)
|
||||
UNUSED(engine);
|
||||
#endif
|
||||
#endif /* if defined(OPENSSL_NO_ENGINE) */
|
||||
|
||||
enable_fips_mode();
|
||||
|
||||
@@ -123,14 +126,15 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine)
|
||||
CRYPTO_set_id_callback(id_callback);
|
||||
#elif OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
CRYPTO_THREADID_set_callback(_set_thread_id);
|
||||
#endif
|
||||
#endif /* if defined(LIBRESSL_VERSION_NUMBER) */
|
||||
ERR_load_crypto_strings();
|
||||
#endif
|
||||
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
||||
* defined(LIBRESSL_VERSION_NUMBER) */
|
||||
|
||||
#if !defined(OPENSSL_NO_ENGINE)
|
||||
#if !defined(CONF_MFLAGS_DEFAULT_SECTION)
|
||||
OPENSSL_config(NULL);
|
||||
#else
|
||||
#else /* if !defined(CONF_MFLAGS_DEFAULT_SECTION) */
|
||||
/*
|
||||
* OPENSSL_config() can only be called a single time as of
|
||||
* 1.0.2e so do the steps individually.
|
||||
@@ -141,10 +145,11 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine)
|
||||
CONF_modules_load_file(NULL, NULL,
|
||||
CONF_MFLAGS_DEFAULT_SECTION |
|
||||
CONF_MFLAGS_IGNORE_MISSING_FILE);
|
||||
#endif
|
||||
#endif /* if !defined(CONF_MFLAGS_DEFAULT_SECTION) */
|
||||
|
||||
if (engine != NULL && *engine == '\0')
|
||||
if (engine != NULL && *engine == '\0') {
|
||||
engine = NULL;
|
||||
}
|
||||
|
||||
if (engine != NULL) {
|
||||
e = ENGINE_by_id(engine);
|
||||
@@ -173,16 +178,18 @@ dst__openssl_init(isc_mem_t *mctx, const char *engine)
|
||||
|
||||
#if !defined(OPENSSL_NO_ENGINE)
|
||||
cleanup_rm:
|
||||
if (e != NULL)
|
||||
if (e != NULL) {
|
||||
ENGINE_free(e);
|
||||
}
|
||||
e = NULL;
|
||||
#endif
|
||||
#endif /* if !defined(OPENSSL_NO_ENGINE) */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
isc_mutexblock_destroy(locks, nlocks);
|
||||
isc_mem_free(dst__mctx, locks);
|
||||
locks = NULL;
|
||||
#endif
|
||||
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
||||
* defined(LIBRESSL_VERSION_NUMBER) */
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -197,23 +204,24 @@ dst__openssl_destroy(void)
|
||||
OBJ_cleanup();
|
||||
EVP_cleanup();
|
||||
#if !defined(OPENSSL_NO_ENGINE)
|
||||
if (e != NULL)
|
||||
if (e != NULL) {
|
||||
ENGINE_free(e);
|
||||
}
|
||||
e = NULL;
|
||||
ENGINE_cleanup();
|
||||
#endif
|
||||
#endif /* if !defined(OPENSSL_NO_ENGINE) */
|
||||
CRYPTO_cleanup_all_ex_data();
|
||||
ERR_clear_error();
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
ERR_remove_thread_state(NULL);
|
||||
#elif defined(LIBRESSL_VERSION_NUMBER)
|
||||
ERR_remove_state(0);
|
||||
#endif
|
||||
#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L */
|
||||
ERR_free_strings();
|
||||
|
||||
#ifdef DNS_CRYPTO_LEAKS
|
||||
CRYPTO_mem_leaks_fp(stderr);
|
||||
#endif
|
||||
#endif /* ifdef DNS_CRYPTO_LEAKS */
|
||||
|
||||
if (locks != NULL) {
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
@@ -221,7 +229,8 @@ dst__openssl_destroy(void)
|
||||
isc_mem_free(dst__mctx, locks);
|
||||
locks = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
|
||||
* defined(LIBRESSL_VERSION_NUMBER) */
|
||||
isc_mem_detach(&dst__mctx);
|
||||
}
|
||||
|
||||
@@ -232,7 +241,7 @@ toresult(isc_result_t fallback)
|
||||
unsigned long err = ERR_peek_error();
|
||||
#if defined(ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED)
|
||||
int lib = ERR_GET_LIB(err);
|
||||
#endif
|
||||
#endif /* if defined(ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED) */
|
||||
int reason = ERR_GET_REASON(err);
|
||||
|
||||
switch (reason) {
|
||||
@@ -250,7 +259,7 @@ toresult(isc_result_t fallback)
|
||||
result = ISC_R_NOENTROPY;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif /* if defined(ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED) */
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -290,13 +299,15 @@ dst__openssl_toresult3(isc_logcategory_t *category, const char *funcname,
|
||||
isc_log_write(dns_lctx, category, DNS_LOGMODULE_CRYPTO, ISC_LOG_WARNING,
|
||||
"%s failed (%s)", funcname, isc_result_totext(result));
|
||||
|
||||
if (result == ISC_R_NOMEMORY)
|
||||
if (result == ISC_R_NOMEMORY) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
err = ERR_get_error_line_data(&file, &line, &data, &flags);
|
||||
if (err == 0U)
|
||||
if (err == 0U) {
|
||||
goto done;
|
||||
}
|
||||
ERR_error_string_n(err, buf, sizeof(buf));
|
||||
isc_log_write(dns_lctx, category, DNS_LOGMODULE_CRYPTO,
|
||||
ISC_LOG_INFO, "%s:%s:%d:%s", buf, file, line,
|
||||
@@ -312,14 +323,17 @@ done:
|
||||
ENGINE *
|
||||
dst__openssl_getengine(const char *engine)
|
||||
{
|
||||
if (engine == NULL)
|
||||
if (engine == NULL) {
|
||||
return (NULL);
|
||||
if (e == NULL)
|
||||
}
|
||||
if (e == NULL) {
|
||||
return (NULL);
|
||||
if (strcmp(engine, ENGINE_get_id(e)) == 0)
|
||||
}
|
||||
if (strcmp(engine, ENGINE_get_id(e)) == 0) {
|
||||
return (e);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
#endif /* if !defined(OPENSSL_NO_ENGINE) */
|
||||
|
||||
/*! \file */
|
||||
|
Reference in New Issue
Block a user