Skip to content

Commit 712ff0a

Browse files
Merge pull request #7537 from dgarske/cleanups_20240515
Various typo and copy/paste cleanups
2 parents 2120424 + 9166c1a commit 712ff0a

7 files changed

Lines changed: 56 additions & 53 deletions

File tree

IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
298298
/* see user_settings PROJECT_DH for HAVE_DH and HAVE_FFDHE_2048 */
299299
#ifndef NO_DH
300300
ret = wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits);
301-
if (ret != SSL_SUCCESS) {
301+
if (ret != WOLFSSL_SUCCESS) {
302302
ESP_LOGE(TAG, "Error setting minimum DH key size");
303303
}
304304
#endif
@@ -316,24 +316,28 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
316316
CTX_CLIENT_CERT,
317317
CTX_CLIENT_CERT_SIZE,
318318
CTX_CLIENT_CERT_TYPE);
319-
if (ret_i != SSL_SUCCESS) {
320-
ESP_LOGE(TAG, "ERROR: failed to load chain %d, "
319+
if (ret_i != WOLFSSL_SUCCESS) {
320+
ESP_LOGE(TAG, "ERROR: failed to load our cert chain %d, "
321321
"please check the file.", ret_i);
322322
}
323323

324324
/* Load client certificates into WOLFSSL_CTX */
325-
WOLFSSL_MSG("Loading...cert");
325+
WOLFSSL_MSG("Loading... CA cert");
326326
ret_i = wolfSSL_CTX_load_verify_buffer(ctx,
327327
CTX_CA_CERT,
328328
CTX_CA_CERT_SIZE,
329329
CTX_CA_CERT_TYPE);
330+
if (ret_i != WOLFSSL_SUCCESS) {
331+
ESP_LOGE(TAG, "ERROR: failed to load CA cert %d, "
332+
"please check the file.\n", ret_i) ;
333+
}
330334

335+
WOLFSSL_MSG("Loading... our key");
331336
ret_i = wolfSSL_CTX_use_PrivateKey_buffer(ctx,
332337
CTX_CLIENT_KEY,
333338
CTX_CLIENT_KEY_SIZE,
334339
CTX_CLIENT_KEY_TYPE);
335-
if(ret_i != SSL_SUCCESS) {
336-
wolfSSL_CTX_free(ctx) ; ctx = NULL ;
340+
if (ret_i != WOLFSSL_SUCCESS) {
337341
ESP_LOGE(TAG, "ERROR: failed to load key %d, "
338342
"please check the file.\n", ret_i) ;
339343
}
@@ -409,7 +413,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
409413
ESP_LOGW(TAG, "WOLFSSL_HAVE_KYBER enabled but no key size available.");
410414
ret_i = ESP_FAIL;
411415
#endif
412-
if (ret_i == SSL_SUCCESS) {
416+
if (ret_i == WOLFSSL_SUCCESS) {
413417
ESP_LOGI(TAG, "UseKeyShare Kyber success");
414418
}
415419
else {
@@ -462,7 +466,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
462466
ESP_LOGI(TAG, "tls_smp_client_task heap(3) @ %p = %d",
463467
&this_heap, this_heap);
464468
#endif
465-
if (ret_i == SSL_SUCCESS) {
469+
if (ret_i == WOLFSSL_SUCCESS) {
466470
#ifdef DEBUG_WOLFSSL
467471
ShowCiphers(ssl);
468472
#endif
@@ -534,7 +538,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
534538
ESP_LOGE(TAG, "Bidirectional shutdown failed\n");
535539
}
536540

537-
} /* wolfSSL_connect(ssl) == SSL_SUCCESS) */
541+
} /* wolfSSL_connect(ssl) == WOLFSSL_SUCCESS) */
538542
else {
539543
ESP_LOGE(TAG, "ERROR: failed to connect to wolfSSL. "
540544
"Error: %d\n", ret_i);
@@ -569,7 +573,7 @@ WOLFSSL_ESP_TASK tls_smp_client_init(void* args)
569573
/* See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html#functions */
570574
if (TLS_SMP_CLIENT_TASK_BYTES < (6 * 1024)) {
571575
/* Observed approximately 6KB limit for the RTOS task stack size.
572-
* Reminder parameter is bytes, not words as with generic FreeeRTOS. */
576+
* Reminder parameter is bytes, not words as with generic FreeRTOS. */
573577
ESP_LOGW(TAG, "Warning: TLS_SMP_CLIENT_TASK_BYTES < 6KB");
574578
}
575579
#ifndef WOLFSSL_SMALL_STACK

IDE/Renesas/cs+/Projects/t4_demo/wolf_client.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ WOLFSSL_CTX *wolfSSL_TLS_client_init()
104104
}
105105

106106
#if !defined(NO_FILESYSTEM)
107-
if (wolfSSL_CTX_load_verify_locations(ctx, cert, 0) != SSL_SUCCESS) {
107+
if (wolfSSL_CTX_load_verify_locations(ctx, cert, 0) != WOLFSSL_SUCCESS) {
108108
printf("ERROR: can't load \"%s\"\n", cert);
109109
return NULL;
110110
}
111111
#else
112-
if (wolfSSL_CTX_load_verify_buffer(ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != SSL_SUCCESS){
112+
if (wolfSSL_CTX_load_verify_buffer(ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS){
113113
printf("ERROR: can't load certificate data\n");
114114
return NULL;
115115
}
@@ -138,14 +138,14 @@ void wolfSSL_TLS_client(void *v_ctx, func_args *args)
138138
T_IPV4EP dst_addr;
139139

140140
if(args->argc >= 2){
141-
if((dst_addr.ipaddr = getIPaddr(args->argv[1])) == 0){
142-
printf("ERROR: IP address\n");
143-
return;
144-
}
145-
if((dst_addr.portno = getPort(args->argv[2])) == 0){
146-
printf("ERROR: IP address\n");
147-
return;
148-
}
141+
if((dst_addr.ipaddr = getIPaddr(args->argv[1])) == 0){
142+
printf("ERROR: IP address\n");
143+
return;
144+
}
145+
if((dst_addr.portno = getPort(args->argv[2])) == 0){
146+
printf("ERROR: Port number\n");
147+
return;
148+
}
149149
}
150150

151151
if((ercd = tcp_con_cep(cepid, &my_addr, &dst_addr, TMO_FEVR)) != E_OK) {
@@ -162,7 +162,7 @@ void wolfSSL_TLS_client(void *v_ctx, func_args *args)
162162
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
163163
wolfSSL_SetIOWriteCtx(ssl, (void *)&cepid);
164164

165-
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
165+
if(wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
166166
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
167167
return;
168168
}

IDE/Renesas/e2studio/Projects/test/src/wolf_client.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
117117
}
118118

119119
#if !defined(NO_FILESYSTEM)
120-
if (wolfSSL_CTX_load_verify_locations(client_ctx, cert, 0) != SSL_SUCCESS) {
120+
if (wolfSSL_CTX_load_verify_locations(client_ctx, cert, 0) != WOLFSSL_SUCCESS) {
121121
printf("ERROR: can't load \"%s\"\n", cert);
122122
return NULL;
123123
}
124124
#else
125-
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != SSL_SUCCESS){
125+
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS){
126126
printf("ERROR: can't load certificate data\n");
127127
return;
128128
}
@@ -157,7 +157,7 @@ void wolfSSL_TLS_client( )
157157
return;
158158
}
159159
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
160-
printf("ERROR: IP address\n");
160+
printf("ERROR: Port number\n");
161161
return;
162162
}
163163

@@ -175,7 +175,7 @@ void wolfSSL_TLS_client( )
175175
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
176176
wolfSSL_SetIOWriteCtx(ssl, (void *)&cepid);
177177

178-
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
178+
if(wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
179179
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
180180
return;
181181
}

IDE/Renesas/e2studio/RA6M3/client-wolfssl/src/wolfssl_thread_entry.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void wolfssl_thread_entry(void *pvParameters) {
5252

5353
/* FreeRTOS+TCP Objects */
5454
BaseType_t fr_status;
55-
socklen_t xSize = sizeof(struct freertos_sockaddr);
5655
xSocket_t xClientSocket = NULL;
5756
struct freertos_sockaddr xRemoteAddress;
5857

@@ -93,7 +92,7 @@ void wolfssl_thread_entry(void *pvParameters) {
9392
FREERTOS_SOCK_STREAM,
9493
FREERTOS_IPPROTO_TCP);
9594
configASSERT(xClientSocket != FREERTOS_INVALID_SOCKET);
96-
FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xSize));
95+
FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xRemoteAddress));
9796

9897
/* Client Socket Connect */
9998
ret = FreeRTOS_connect(xClientSocket,

IDE/Renesas/e2studio/RA6M3/server-wolfssl/src/wolfssl_thread_entry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void wolfssl_thread_entry(void *pvParameters) {
151151

152152
/* Read the client data into our buff array */
153153
if (ret != WOLFSSL_SUCCESS) {
154-
printf("Error [%d]: wolfSSL_set_fd.\n",ret);
154+
printf("Error [%d]: wolfSSL_accept.\n",ret);
155155
break;
156156
}
157157
memset(buff, 0, sizeof(buff));

IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolf_client.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
114114
char *cert = "./certs/ca-cert.pem";
115115
#endif
116116
#else
117-
#if defined(USE_ECC_CERT) && defined(USE_CERT_BUFFERS_256)
117+
#if defined(USE_ECC_CERT) && defined(USE_CERT_BUFFERS_256)
118118
const unsigned char *cert = ca_ecc_cert_der_256;
119119
#define SIZEOF_CERT sizeof_ca_ecc_cert_der_256
120120
#else
@@ -137,7 +137,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
137137
if ((client_ctx = wolfSSL_CTX_new_ex(wolfSSLv23_client_method_ex(heapHint),
138138
heapHint)) == NULL) {
139139
printf("ERROR: failed to create WOLFSSL_CTX\n");
140-
return;
140+
return;
141141
}
142142

143143
if ((wolfSSL_CTX_load_static_memory(&client_ctx, NULL, heapBufIO,
@@ -149,7 +149,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
149149
#else
150150

151151
/* Create and initialize WOLFSSL_CTX */
152-
if ((client_ctx =
152+
if ((client_ctx =
153153
wolfSSL_CTX_new(wolfSSLv23_client_method_ex((void *)NULL))) == NULL) {
154154
printf("ERROR: failed to create WOLFSSL_CTX\n");
155155
return;
@@ -168,8 +168,8 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
168168
/* Root CA certificate */
169169
/*---------------------------------------------*/
170170

171-
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT,
172-
SSL_FILETYPE_ASN1) != SSL_SUCCESS){
171+
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT,
172+
SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS){
173173
printf("ERROR: can't load certificate data\n");
174174
return;
175175
}
@@ -186,15 +186,15 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
186186
/*---------------------------------------------*/
187187

188188
/* use specific cipher */
189-
if (cipherlist != NULL &&
189+
if (cipherlist != NULL &&
190190
wolfSSL_CTX_set_cipher_list(client_ctx, cipherlist) != WOLFSSL_SUCCESS) {
191191
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
192192
printf("client can't set cipher list");
193193
return;
194194
}
195-
195+
196196
#if defined(WOLFSSL_TLS13)
197-
if (wolfSSL_CTX_UseSupportedCurve(client_ctx, WOLFSSL_ECC_SECP256R1)
197+
if (wolfSSL_CTX_UseSupportedCurve(client_ctx, WOLFSSL_ECC_SECP256R1)
198198
!= WOLFSSL_SUCCESS) {
199199
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
200200
printf("client can't set use supported curves\n");
@@ -213,19 +213,19 @@ void wolfSSL_TLS_client( )
213213

214214
#define BUFF_SIZE 256
215215
static const char sendBuff[]= "Hello Server\n" ;
216-
216+
217217
char rcvBuff[BUFF_SIZE] = {0};
218-
218+
219219
static T_IPV4EP my_addr = { 0, 0 };
220-
220+
221221
T_IPV4EP dst_addr;
222222

223223
if((dst_addr.ipaddr = getIPaddr(SIMPLE_TLSSEVER_IP)) == 0){
224224
printf("ERROR: IP address\n");
225225
goto out;
226226
}
227227
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
228-
printf("ERROR: IP address\n");
228+
printf("ERROR: Port number\n");
229229
goto out;
230230
}
231231

@@ -256,22 +256,22 @@ void wolfSSL_TLS_client( )
256256
/*---------------------------------------------*/
257257
#ifdef USE_ECC_CERT
258258

259-
/* ECDSA client certificate */
259+
/* ECDSA client certificate */
260260
if (wolfSSL_use_certificate_buffer(ssl, cliecc_cert_der_256,
261-
sizeof_cliecc_cert_der_256, WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
261+
sizeof_cliecc_cert_der_256, WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
262262
printf("ERROR wolfSSL_use_certificate_buffer: %d\n",
263263
wolfSSL_get_error(ssl, 0));
264-
goto out;
264+
goto out;
265265
}
266266

267267
#else
268268

269269
/* RSA client certificate */
270270
if (wolfSSL_use_certificate_buffer(ssl, client_cert_der_2048,
271-
sizeof_client_cert_der_2048, WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
271+
sizeof_client_cert_der_2048, WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
272272
printf("ERROR wolfSSL_use_certificate_buffer: %d\n",
273273
wolfSSL_get_error(ssl, 0));
274-
goto out;
274+
goto out;
275275
}
276276

277277
#endif /* USE_ECC_CERT */
@@ -292,17 +292,17 @@ void wolfSSL_TLS_client( )
292292
printf("ERROR tsip_use_PrivateKey_buffer_TLS\n");
293293
goto out;
294294
}
295-
295+
296296
#else
297297

298298
/* DER format ECC private key */
299299
if (wolfSSL_use_PrivateKey_buffer(ssl,
300300
ecc_clikey_der_256,
301-
sizeof_ecc_clikey_der_256,
302-
WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
301+
sizeof_ecc_clikey_der_256,
302+
WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
303303
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
304304
wolfSSL_get_error(ssl, 0));
305-
goto out;
305+
goto out;
306306
}
307307

308308
#endif
@@ -334,10 +334,10 @@ void wolfSSL_TLS_client( )
334334
#else
335335

336336
if (wolfSSL_use_PrivateKey_buffer(ssl, client_key_der_2048,
337-
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
337+
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
338338
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
339339
wolfSSL_get_error(ssl, 0));
340-
goto out;
340+
goto out;
341341
}
342342

343343
#endif /* WOLFSSL_RENESAS_TSIP_TLS */
@@ -356,7 +356,7 @@ void wolfSSL_TLS_client( )
356356
/* TLS handshake */
357357
/*---------------------------------------------*/
358358

359-
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
359+
if(wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
360360
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
361361
goto out;
362362
}

IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/src/client/simple_tls_tsip_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void wolfSSL_TLS_client( )
216216
goto out;
217217
}
218218
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
219-
printf("ERROR: IP address\n");
219+
printf("ERROR: Port number\n");
220220
goto out;
221221
}
222222

0 commit comments

Comments
 (0)