Skip to content

Commit 7677389

Browse files
fix spelling in comments, make fd use more clear, update to macro guards
1 parent 7bb6161 commit 7677389

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

examples/posix/wh_posix_client/wh_posix_client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ void Usage(const char* exeName)
161161
WOLFHSM_CFG_PRINTF("Usage: %s --type <type> --test\n", exeName);
162162
WOLFHSM_CFG_PRINTF("Example: %s --type tcp\n", exeName);
163163
WOLFHSM_CFG_PRINTF("type: tcp (default), shm");
164-
#ifndef WOLFHSM_CFG_NO_CRYPTO
164+
#ifdef WOLFHSM_CFG_TLS
165165
WOLFHSM_CFG_PRINTF(", tls");
166-
#endif
167-
#ifndef NO_PSK
166+
#if !defined(NO_PSK)
168167
WOLFHSM_CFG_PRINTF(", psk");
169168
#endif
169+
#endif /* WOLFHSM_CFG_TLS */
170170
#ifdef WOLFSSL_STATIC_MEMORY
171171
WOLFHSM_CFG_PRINTF(", dma");
172172
#endif

port/posix/posix_transport_tls.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ int posixTransportTls_SendRequest(void* context, uint16_t size,
205205
* is not listening yet, thats why we need to wait to set the fd in
206206
* wolfSSL until after the connect() has completed) */
207207
if (ctx->ssl == NULL) {
208+
int fd;
209+
208210
if (posixTransportTcp_GetConnectFd(
209-
(void*)&ctx->tcpCtx, &ctx->connect_fd_p1) != WH_ERROR_OK) {
211+
(void*)&ctx->tcpCtx, &fd) != WH_ERROR_OK) {
210212
return WH_ERROR_NOTREADY;
211213
}
212-
ctx->connect_fd_p1++;
214+
ctx->connect_fd_p1 = fd + 1; /* follow +1 convetions, 0 is invalid */
213215

214216
ctx->ssl = wolfSSL_new(ctx->ssl_ctx);
215217
if (!ctx->ssl) {
@@ -218,7 +220,7 @@ int posixTransportTls_SendRequest(void* context, uint16_t size,
218220
}
219221

220222
/* Set the current socket file descriptor */
221-
rc = wolfSSL_set_fd(ctx->ssl, ctx->connect_fd_p1 - 1);
223+
rc = wolfSSL_set_fd(ctx->ssl, fd);
222224
if (rc != WOLFSSL_SUCCESS) {
223225
wolfSSL_free(ctx->ssl);
224226
ctx->ssl = NULL;

test/wh_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* WOLFHSM_CFG_TEST_POSIX : Run tests using POSIX transport
2626
*
2727
* WOLFHSM_CFG_TEST_CLIENT_ONLY : Run client-only tests connecting to a running
28-
* server. The default is using a TCP trasnport
28+
* server. The default is using a TCP transport
2929
* connection. When another specific transports
3030
* are enabled then they will be used instead i.e
3131
* WOLFHSM_CFG_TLS will use TLS transport.

0 commit comments

Comments
 (0)