Merge pull request #7537 from dgarske/cleanups_20240515

Various typo and copy/paste cleanups
This commit is contained in:
JacobBarthelmeh
2024-05-16 09:38:38 -06:00
committed by GitHub
7 changed files with 56 additions and 53 deletions

View File

@ -298,7 +298,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
/* see user_settings PROJECT_DH for HAVE_DH and HAVE_FFDHE_2048 */
#ifndef NO_DH
ret = wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits);
if (ret != SSL_SUCCESS) {
if (ret != WOLFSSL_SUCCESS) {
ESP_LOGE(TAG, "Error setting minimum DH key size");
}
#endif
@ -316,24 +316,28 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
CTX_CLIENT_CERT,
CTX_CLIENT_CERT_SIZE,
CTX_CLIENT_CERT_TYPE);
if (ret_i != SSL_SUCCESS) {
ESP_LOGE(TAG, "ERROR: failed to load chain %d, "
if (ret_i != WOLFSSL_SUCCESS) {
ESP_LOGE(TAG, "ERROR: failed to load our cert chain %d, "
"please check the file.", ret_i);
}
/* Load client certificates into WOLFSSL_CTX */
WOLFSSL_MSG("Loading...cert");
WOLFSSL_MSG("Loading... CA cert");
ret_i = wolfSSL_CTX_load_verify_buffer(ctx,
CTX_CA_CERT,
CTX_CA_CERT_SIZE,
CTX_CA_CERT_TYPE);
if (ret_i != WOLFSSL_SUCCESS) {
ESP_LOGE(TAG, "ERROR: failed to load CA cert %d, "
"please check the file.\n", ret_i) ;
}
WOLFSSL_MSG("Loading... our key");
ret_i = wolfSSL_CTX_use_PrivateKey_buffer(ctx,
CTX_CLIENT_KEY,
CTX_CLIENT_KEY_SIZE,
CTX_CLIENT_KEY_TYPE);
if(ret_i != SSL_SUCCESS) {
wolfSSL_CTX_free(ctx) ; ctx = NULL ;
if (ret_i != WOLFSSL_SUCCESS) {
ESP_LOGE(TAG, "ERROR: failed to load key %d, "
"please check the file.\n", ret_i) ;
}
@ -409,7 +413,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
ESP_LOGW(TAG, "WOLFSSL_HAVE_KYBER enabled but no key size available.");
ret_i = ESP_FAIL;
#endif
if (ret_i == SSL_SUCCESS) {
if (ret_i == WOLFSSL_SUCCESS) {
ESP_LOGI(TAG, "UseKeyShare Kyber success");
}
else {
@ -462,7 +466,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
ESP_LOGI(TAG, "tls_smp_client_task heap(3) @ %p = %d",
&this_heap, this_heap);
#endif
if (ret_i == SSL_SUCCESS) {
if (ret_i == WOLFSSL_SUCCESS) {
#ifdef DEBUG_WOLFSSL
ShowCiphers(ssl);
#endif
@ -534,7 +538,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
ESP_LOGE(TAG, "Bidirectional shutdown failed\n");
}
} /* wolfSSL_connect(ssl) == SSL_SUCCESS) */
} /* wolfSSL_connect(ssl) == WOLFSSL_SUCCESS) */
else {
ESP_LOGE(TAG, "ERROR: failed to connect to wolfSSL. "
"Error: %d\n", ret_i);
@ -569,7 +573,7 @@ WOLFSSL_ESP_TASK tls_smp_client_init(void* args)
/* See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html#functions */
if (TLS_SMP_CLIENT_TASK_BYTES < (6 * 1024)) {
/* Observed approximately 6KB limit for the RTOS task stack size.
* Reminder parameter is bytes, not words as with generic FreeeRTOS. */
* Reminder parameter is bytes, not words as with generic FreeRTOS. */
ESP_LOGW(TAG, "Warning: TLS_SMP_CLIENT_TASK_BYTES < 6KB");
}
#ifndef WOLFSSL_SMALL_STACK

View File

@ -104,12 +104,12 @@ WOLFSSL_CTX *wolfSSL_TLS_client_init()
}
#if !defined(NO_FILESYSTEM)
if (wolfSSL_CTX_load_verify_locations(ctx, cert, 0) != SSL_SUCCESS) {
if (wolfSSL_CTX_load_verify_locations(ctx, cert, 0) != WOLFSSL_SUCCESS) {
printf("ERROR: can't load \"%s\"\n", cert);
return NULL;
}
#else
if (wolfSSL_CTX_load_verify_buffer(ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != SSL_SUCCESS){
if (wolfSSL_CTX_load_verify_buffer(ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS){
printf("ERROR: can't load certificate data\n");
return NULL;
}
@ -143,7 +143,7 @@ void wolfSSL_TLS_client(void *v_ctx, func_args *args)
return;
}
if((dst_addr.portno = getPort(args->argv[2])) == 0){
printf("ERROR: IP address\n");
printf("ERROR: Port number\n");
return;
}
}
@ -162,7 +162,7 @@ void wolfSSL_TLS_client(void *v_ctx, func_args *args)
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
wolfSSL_SetIOWriteCtx(ssl, (void *)&cepid);
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
if(wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
return;
}

View File

@ -117,12 +117,12 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
}
#if !defined(NO_FILESYSTEM)
if (wolfSSL_CTX_load_verify_locations(client_ctx, cert, 0) != SSL_SUCCESS) {
if (wolfSSL_CTX_load_verify_locations(client_ctx, cert, 0) != WOLFSSL_SUCCESS) {
printf("ERROR: can't load \"%s\"\n", cert);
return NULL;
}
#else
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != SSL_SUCCESS){
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT, SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS){
printf("ERROR: can't load certificate data\n");
return;
}
@ -157,7 +157,7 @@ void wolfSSL_TLS_client( )
return;
}
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
printf("ERROR: IP address\n");
printf("ERROR: Port number\n");
return;
}
@ -175,7 +175,7 @@ void wolfSSL_TLS_client( )
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
wolfSSL_SetIOWriteCtx(ssl, (void *)&cepid);
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
if(wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
return;
}

View File

@ -52,7 +52,6 @@ void wolfssl_thread_entry(void *pvParameters) {
/* FreeRTOS+TCP Objects */
BaseType_t fr_status;
socklen_t xSize = sizeof(struct freertos_sockaddr);
xSocket_t xClientSocket = NULL;
struct freertos_sockaddr xRemoteAddress;
@ -93,7 +92,7 @@ void wolfssl_thread_entry(void *pvParameters) {
FREERTOS_SOCK_STREAM,
FREERTOS_IPPROTO_TCP);
configASSERT(xClientSocket != FREERTOS_INVALID_SOCKET);
FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xSize));
FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xRemoteAddress));
/* Client Socket Connect */
ret = FreeRTOS_connect(xClientSocket,

View File

@ -151,7 +151,7 @@ void wolfssl_thread_entry(void *pvParameters) {
/* Read the client data into our buff array */
if (ret != WOLFSSL_SUCCESS) {
printf("Error [%d]: wolfSSL_set_fd.\n",ret);
printf("Error [%d]: wolfSSL_accept.\n",ret);
break;
}
memset(buff, 0, sizeof(buff));

View File

@ -169,7 +169,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
/*---------------------------------------------*/
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT,
SSL_FILETYPE_ASN1) != SSL_SUCCESS){
SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS){
printf("ERROR: can't load certificate data\n");
return;
}
@ -225,7 +225,7 @@ void wolfSSL_TLS_client( )
goto out;
}
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
printf("ERROR: IP address\n");
printf("ERROR: Port number\n");
goto out;
}
@ -258,7 +258,7 @@ void wolfSSL_TLS_client( )
/* ECDSA client certificate */
if (wolfSSL_use_certificate_buffer(ssl, cliecc_cert_der_256,
sizeof_cliecc_cert_der_256, WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
sizeof_cliecc_cert_der_256, WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("ERROR wolfSSL_use_certificate_buffer: %d\n",
wolfSSL_get_error(ssl, 0));
goto out;
@ -268,7 +268,7 @@ void wolfSSL_TLS_client( )
/* RSA client certificate */
if (wolfSSL_use_certificate_buffer(ssl, client_cert_der_2048,
sizeof_client_cert_der_2048, WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
sizeof_client_cert_der_2048, WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("ERROR wolfSSL_use_certificate_buffer: %d\n",
wolfSSL_get_error(ssl, 0));
goto out;
@ -299,7 +299,7 @@ void wolfSSL_TLS_client( )
if (wolfSSL_use_PrivateKey_buffer(ssl,
ecc_clikey_der_256,
sizeof_ecc_clikey_der_256,
WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
wolfSSL_get_error(ssl, 0));
goto out;
@ -334,7 +334,7 @@ void wolfSSL_TLS_client( )
#else
if (wolfSSL_use_PrivateKey_buffer(ssl, client_key_der_2048,
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
wolfSSL_get_error(ssl, 0));
goto out;
@ -356,7 +356,7 @@ void wolfSSL_TLS_client( )
/* TLS handshake */
/*---------------------------------------------*/
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
if(wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
goto out;
}

View File

@ -216,7 +216,7 @@ void wolfSSL_TLS_client( )
goto out;
}
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
printf("ERROR: IP address\n");
printf("ERROR: Port number\n");
goto out;
}