Reformat files using uncrustify

Some of the commits, especially engine have not strictly used uncrustify
clean code. Rerun uncrustify to make them compliant again.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200626125332.15385-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20142.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Arne Schwabe 2020-06-26 14:53:32 +02:00 committed by Gert Doering
parent c67e93b252
commit c1ff8f247f
10 changed files with 119 additions and 96 deletions

View File

@ -1083,7 +1083,8 @@ ui_reader(UI *ui, UI_STRING *uis)
{
SSL_CTX *ctx = UI_get0_user_data(ui);
if (UI_get_string_type(uis) == UIT_PROMPT) {
if (UI_get_string_type(uis) == UIT_PROMPT)
{
pem_password_cb *cb = SSL_CTX_get_default_passwd_cb(ctx);
void *d = SSL_CTX_get_default_passwd_cb_userdata(ctx);
char password[64];
@ -1105,13 +1106,16 @@ engine_load_key(const char *file, SSL_CTX *ctx)
EVP_PKEY *pkey;
if (!engine_persist)
{
return NULL;
}
/* this will print out the error from BIO_read */
crypto_msg(M_INFO, "PEM_read_bio failed, now trying engine method to load private key");
ui = UI_create_method("openvpn");
if (!ui) {
if (!ui)
{
crypto_msg(M_FATAL, "Engine UI creation failed");
return NULL;
}
@ -1122,13 +1126,15 @@ engine_load_key(const char *file, SSL_CTX *ctx)
pkey = ENGINE_load_private_key(engine_persist, file, ui, ctx);
ENGINE_finish(engine_persist);
if (!pkey)
{
crypto_msg(M_FATAL, "Engine could not load key file");
}
UI_destroy_method(ui);
return pkey;
#else
#else /* if HAVE_OPENSSL_ENGINE */
return NULL;
#endif
#endif /* if HAVE_OPENSSL_ENGINE */
}
#endif /* ENABLE_CRYPTO_OPENSSL */

View File

@ -478,7 +478,6 @@ helper_client_server(struct options *o)
}
}
else
/*
* HELPER DIRECTIVE:
*

View File

@ -439,7 +439,7 @@ void management_notify_client_cr_response(unsigned mda_key_id,
const struct env_set *es,
const char *response);
#endif
#endif /* ifdef MANAGEMENT_DEF_AUTH */
char *management_query_pk_sig(struct management *man, const char *b64_data,
const char *algorithm);

View File

@ -683,9 +683,11 @@ ifconfig_pool_read(struct ifconfig_pool_persist *persist, struct ifconfig_pool *
* was not valid
*/
if (h < 0)
{
h = h6;
}
}
}
/* at the moment IPv4 and IPv6 share the same pool, therefore offsets
* have to match for the same client.

View File

@ -1930,7 +1930,8 @@ tls_session_generate_data_channel_keys(struct tls_session *session)
const struct session_id *server_sid = !session->opt->server ?
&ks->session_id_remote : &session->session_id;
if (!ks->authenticated) {
if (!ks->authenticated)
{
msg(D_TLS_ERRORS, "TLS Error: key_state not authenticated");
goto cleanup;
}

View File

@ -8,21 +8,24 @@ static char *engine_name = "Engine for testing openvpn engine key support";
static int is_initialized = 0;
static int engine_init(ENGINE *e)
static int
engine_init(ENGINE *e)
{
is_initialized = 1;
fprintf(stderr, "ENGINE: engine_init called\n");
return 1;
}
static int engine_finish(ENGINE *e)
static int
engine_finish(ENGINE *e)
{
fprintf(stderr, "ENGINE: engine_finsh called\n");
is_initialized = 0;
return 1;
}
static EVP_PKEY *engine_load_key(ENGINE *e, const char *key_id,
static EVP_PKEY *
engine_load_key(ENGINE *e, const char *key_id,
UI_METHOD *ui_method, void *cb_data)
{
BIO *b;
@ -33,12 +36,14 @@ static EVP_PKEY *engine_load_key(ENGINE *e, const char *key_id,
fprintf(stderr, "ENGINE: engine_load_key called\n");
if (!is_initialized) {
if (!is_initialized)
{
fprintf(stderr, "Load Key called without correct initialization\n");
return NULL;
}
b = BIO_new_file(key_id, "r");
if (!b) {
if (!b)
{
fprintf(stderr, "File %s does not exist or cannot be read\n", key_id);
return 0;
}
@ -48,7 +53,8 @@ static EVP_PKEY *engine_load_key(ENGINE *e, const char *key_id,
"TEST ENGINE KEY", b,
NULL, NULL, NULL);
BIO_free(b);
if (!p8inf) {
if (!p8inf)
{
fprintf(stderr, "Failed to read engine private key\n");
return NULL;
}
@ -59,18 +65,22 @@ static EVP_PKEY *engine_load_key(ENGINE *e, const char *key_id,
ui = UI_new();
if (ui_method)
{
UI_set_method(ui, ui_method);
}
UI_add_user_data(ui, cb_data);
if (UI_add_input_string(ui, "enter test engine key",
UI_INPUT_FLAG_DEFAULT_PWD,
auth, 0, sizeof(auth)) == 0) {
auth, 0, sizeof(auth)) == 0)
{
fprintf(stderr, "UI_add_input_string failed\n");
goto out;
}
if (UI_process(ui)) {
if (UI_process(ui))
{
fprintf(stderr, "UI_process failed\n");
goto out;
}
@ -84,16 +94,21 @@ static EVP_PKEY *engine_load_key(ENGINE *e, const char *key_id,
}
static int engine_bind_fn(ENGINE *e, const char *id)
static int
engine_bind_fn(ENGINE *e, const char *id)
{
if (id && strcmp(id, engine_id) != 0)
{
return 0;
if (!ENGINE_set_id(e, engine_id) ||
!ENGINE_set_name(e, engine_name) ||
!ENGINE_set_init_function(e, engine_init) ||
!ENGINE_set_finish_function(e, engine_finish) ||
!ENGINE_set_load_privkey_function(e, engine_load_key))
}
if (!ENGINE_set_id(e, engine_id)
|| !ENGINE_set_name(e, engine_name)
|| !ENGINE_set_init_function(e, engine_init)
|| !ENGINE_set_finish_function(e, engine_finish)
|| !ENGINE_set_load_privkey_function(e, engine_load_key))
{
return 0;
}
return 1;
}