From 716237c5dd08e6318d6dc4832c376563703716d4 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 21 Jun 2021 15:09:39 -0700 Subject: [PATCH] Fix minor line length and spelling. --- examples/client/client.c | 19 +++++++++++++------ examples/server/server.c | 13 +++++++++---- wolfssl/test.h | 14 ++++++++------ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/examples/client/client.c b/examples/client/client.c index d305a4082..9ede92d1b 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -1156,7 +1156,8 @@ static const char* client_usage_msg[][68] = { " ln -s ca-cert.pem `openssl x509 -in ca-cert.pem -hash -noout`.0\n", /* 67 */ #endif -#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && \ + !defined(WOLFSENTRY_NO_JSON) "--wolfsentry-config Path for JSON wolfSentry config\n", /* 68 */ #endif @@ -1346,7 +1347,8 @@ static const char* client_usage_msg[][68] = { " ln -s ca-cert.pem `openssl x509 -in ca-cert.pem -hash -noout`.0\n", /* 67 */ #endif -#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && \ + !defined(WOLFSENTRY_NO_JSON) "--wolfsentry-config wolfSentry コンフィグファイル\n", /* 68 */ #endif @@ -1528,7 +1530,8 @@ static void Usage(void) !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR) printf("%s", msg[++msgid]); /* -9 */ #endif -#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && \ + !defined(WOLFSENTRY_NO_JSON) printf("%s", msg[++msgid]); /* --wolfsentry-config */ #endif } @@ -1563,7 +1566,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #ifndef WOLFSSL_VXWORKS int ch; static const struct mygetopt_long_config long_options[] = { -#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && \ + !defined(WOLFSENTRY_NO_JSON) { "wolfsentry-config", 1, 256 }, #endif { "help", 0, 257 }, @@ -2563,14 +2567,17 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #ifdef WOLFSSL_WOLFSENTRY_HOOKS - if (wolfsentry_setup(&wolfsentry, wolfsentry_config_path, WOLFSENTRY_ROUTE_FLAG_DIRECTION_OUT) < 0) + if (wolfsentry_setup(&wolfsentry, wolfsentry_config_path, + WOLFSENTRY_ROUTE_FLAG_DIRECTION_OUT) < 0) { err_sys("unable to initialize wolfSentry"); + } if (wolfSSL_CTX_set_ConnectFilter( ctx, (NetworkFilterCallback_t)wolfSentry_NetworkFilterCallback, - wolfsentry) < 0) + wolfsentry) < 0) { err_sys("unable to install wolfSentry_NetworkFilterCallback"); + } #endif if (cipherList && !useDefCipherList) { diff --git a/examples/server/server.c b/examples/server/server.c index b20f2d43d..a1956f395 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -1099,7 +1099,8 @@ static void Usage(void) !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR) printf("%s", msg[++msgId]); /* -9 */ #endif -#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && \ + !defined(WOLFSENTRY_NO_JSON) printf("%s", msg[++msgId]); /* --wolfsentry-config */ #endif } @@ -1123,7 +1124,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) #ifndef WOLFSSL_VXWORKS int ch; static const struct mygetopt_long_config long_options[] = { -#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(NO_FILESYSTEM) && \ + !defined(WOLFSENTRY_NO_JSON) { "wolfsentry-config", 1, 256 }, #endif { "help", 0, 257 }, @@ -1979,15 +1981,18 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) err_sys_ex(catastrophic, "unable to get ctx"); #ifdef WOLFSSL_WOLFSENTRY_HOOKS - if (wolfsentry_setup(&wolfsentry, wolfsentry_config_path, WOLFSENTRY_ROUTE_FLAG_DIRECTION_IN) < 0) + if (wolfsentry_setup(&wolfsentry, wolfsentry_config_path, + WOLFSENTRY_ROUTE_FLAG_DIRECTION_IN) < 0) { err_sys("unable to initialize wolfSentry"); + } if (wolfSSL_CTX_set_AcceptFilter( ctx, (NetworkFilterCallback_t)wolfSentry_NetworkFilterCallback, - wolfsentry) < 0) + wolfsentry) < 0) { err_sys_ex(catastrophic, "unable to install wolfSentry_NetworkFilterCallback"); + } #endif if (simulateWantWrite) diff --git a/wolfssl/test.h b/wolfssl/test.h index 1246ec5dd..3d12e5e4f 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -663,7 +663,8 @@ struct mygetopt_long_config { * present. * @return Option letter in argument */ -static WC_INLINE int mygetopt_long(int argc, char** argv, const char* optstring, const struct mygetopt_long_config *longopts, int *longindex) +static WC_INLINE int mygetopt_long(int argc, char** argv, const char* optstring, + const struct mygetopt_long_config *longopts, int *longindex) { static char* next = NULL; @@ -1374,7 +1375,7 @@ static int wolfsentry_setup( fprintf(stderr, "wolfsentry_config_json_init() returned " WOLFSENTRY_ERROR_FMT "\n", WOLFSENTRY_ERROR_FMT_ARGS(ret)); - err_sys("error while initlalizing wolfSentry config parser"); + err_sys("error while initializing wolfSentry config parser"); } for (;;) { @@ -1400,7 +1401,7 @@ static int wolfsentry_setup( } } else -#endif /* !defined(NO_FILESYSTEM) && !defined(WOLFSENTRY_NO_JSON) */ +#endif /* !NO_FILESYSTEM && !WOLFSENTRY_NO_JSON */ { struct wolfsentry_route_table *table; @@ -1559,7 +1560,7 @@ static WC_INLINE int tcp_connect_with_wolfSentry( &wolfsentry_data->local, wolfsentry_data->flags, NULL /* event_label */, - 0 /* event_label_len */, + 0 /* event_label_len */, NULL /* caller_context */, NULL /* id */, NULL /* inexact_matches */, @@ -1592,7 +1593,7 @@ static WC_INLINE int tcp_connect_with_wolfSentry( decision, decision == WOLFSSL_NETFILTER_REJECT ? "REJECT" : decision == WOLFSSL_NETFILTER_ACCEPT ? "ACCEPT" : - decision == WOLFSSL_NETFILTER_PASS ? "PASS" : + decision == WOLFSSL_NETFILTER_PASS ? "PASS" : "???"); if (decision == WOLFSSL_NETFILTER_REJECT) @@ -1611,7 +1612,8 @@ static WC_INLINE int tcp_connect_with_wolfSentry( return WOLFSSL_SUCCESS; } -#define tcp_connect(sockfd, ip, port, udp, sctp, ssl) tcp_connect_with_wolfSentry(sockfd, ip, port, udp, sctp, ssl, wolfsentry) +#define tcp_connect(sockfd, ip, port, udp, sctp, ssl) \ + tcp_connect_with_wolfSentry(sockfd, ip, port, udp, sctp, ssl, wolfsentry) #else /* !WOLFSSL_WOLFSENTRY_HOOKS */