forked from wolfSSL/wolfssl
Various typo and copy/paste cleanups.
This commit is contained in:
@ -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 */
|
/* see user_settings PROJECT_DH for HAVE_DH and HAVE_FFDHE_2048 */
|
||||||
#ifndef NO_DH
|
#ifndef NO_DH
|
||||||
ret = wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits);
|
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");
|
ESP_LOGE(TAG, "Error setting minimum DH key size");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -316,24 +316,28 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
|
|||||||
CTX_CLIENT_CERT,
|
CTX_CLIENT_CERT,
|
||||||
CTX_CLIENT_CERT_SIZE,
|
CTX_CLIENT_CERT_SIZE,
|
||||||
CTX_CLIENT_CERT_TYPE);
|
CTX_CLIENT_CERT_TYPE);
|
||||||
if (ret_i != SSL_SUCCESS) {
|
if (ret_i != WOLFSSL_SUCCESS) {
|
||||||
ESP_LOGE(TAG, "ERROR: failed to load chain %d, "
|
ESP_LOGE(TAG, "ERROR: failed to load our cert chain %d, "
|
||||||
"please check the file.", ret_i);
|
"please check the file.", ret_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load client certificates into WOLFSSL_CTX */
|
/* Load client certificates into WOLFSSL_CTX */
|
||||||
WOLFSSL_MSG("Loading...cert");
|
WOLFSSL_MSG("Loading... CA cert");
|
||||||
ret_i = wolfSSL_CTX_load_verify_buffer(ctx,
|
ret_i = wolfSSL_CTX_load_verify_buffer(ctx,
|
||||||
CTX_CA_CERT,
|
CTX_CA_CERT,
|
||||||
CTX_CA_CERT_SIZE,
|
CTX_CA_CERT_SIZE,
|
||||||
CTX_CA_CERT_TYPE);
|
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,
|
ret_i = wolfSSL_CTX_use_PrivateKey_buffer(ctx,
|
||||||
CTX_CLIENT_KEY,
|
CTX_CLIENT_KEY,
|
||||||
CTX_CLIENT_KEY_SIZE,
|
CTX_CLIENT_KEY_SIZE,
|
||||||
CTX_CLIENT_KEY_TYPE);
|
CTX_CLIENT_KEY_TYPE);
|
||||||
if(ret_i != SSL_SUCCESS) {
|
if (ret_i != WOLFSSL_SUCCESS) {
|
||||||
wolfSSL_CTX_free(ctx) ; ctx = NULL ;
|
|
||||||
ESP_LOGE(TAG, "ERROR: failed to load key %d, "
|
ESP_LOGE(TAG, "ERROR: failed to load key %d, "
|
||||||
"please check the file.\n", ret_i) ;
|
"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.");
|
ESP_LOGW(TAG, "WOLFSSL_HAVE_KYBER enabled but no key size available.");
|
||||||
ret_i = ESP_FAIL;
|
ret_i = ESP_FAIL;
|
||||||
#endif
|
#endif
|
||||||
if (ret_i == SSL_SUCCESS) {
|
if (ret_i == WOLFSSL_SUCCESS) {
|
||||||
ESP_LOGI(TAG, "UseKeyShare Kyber success");
|
ESP_LOGI(TAG, "UseKeyShare Kyber success");
|
||||||
}
|
}
|
||||||
else {
|
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",
|
ESP_LOGI(TAG, "tls_smp_client_task heap(3) @ %p = %d",
|
||||||
&this_heap, this_heap);
|
&this_heap, this_heap);
|
||||||
#endif
|
#endif
|
||||||
if (ret_i == SSL_SUCCESS) {
|
if (ret_i == WOLFSSL_SUCCESS) {
|
||||||
#ifdef DEBUG_WOLFSSL
|
#ifdef DEBUG_WOLFSSL
|
||||||
ShowCiphers(ssl);
|
ShowCiphers(ssl);
|
||||||
#endif
|
#endif
|
||||||
@ -534,7 +538,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
|
|||||||
ESP_LOGE(TAG, "Bidirectional shutdown failed\n");
|
ESP_LOGE(TAG, "Bidirectional shutdown failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* wolfSSL_connect(ssl) == SSL_SUCCESS) */
|
} /* wolfSSL_connect(ssl) == WOLFSSL_SUCCESS) */
|
||||||
else {
|
else {
|
||||||
ESP_LOGE(TAG, "ERROR: failed to connect to wolfSSL. "
|
ESP_LOGE(TAG, "ERROR: failed to connect to wolfSSL. "
|
||||||
"Error: %d\n", ret_i);
|
"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 */
|
/* 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)) {
|
if (TLS_SMP_CLIENT_TASK_BYTES < (6 * 1024)) {
|
||||||
/* Observed approximately 6KB limit for the RTOS task stack size.
|
/* 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");
|
ESP_LOGW(TAG, "Warning: TLS_SMP_CLIENT_TASK_BYTES < 6KB");
|
||||||
}
|
}
|
||||||
#ifndef WOLFSSL_SMALL_STACK
|
#ifndef WOLFSSL_SMALL_STACK
|
||||||
|
@ -104,12 +104,12 @@ WOLFSSL_CTX *wolfSSL_TLS_client_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NO_FILESYSTEM)
|
#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);
|
printf("ERROR: can't load \"%s\"\n", cert);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#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");
|
printf("ERROR: can't load certificate data\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -138,14 +138,14 @@ void wolfSSL_TLS_client(void *v_ctx, func_args *args)
|
|||||||
T_IPV4EP dst_addr;
|
T_IPV4EP dst_addr;
|
||||||
|
|
||||||
if(args->argc >= 2){
|
if(args->argc >= 2){
|
||||||
if((dst_addr.ipaddr = getIPaddr(args->argv[1])) == 0){
|
if((dst_addr.ipaddr = getIPaddr(args->argv[1])) == 0){
|
||||||
printf("ERROR: IP address\n");
|
printf("ERROR: IP address\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if((dst_addr.portno = getPort(args->argv[2])) == 0){
|
if((dst_addr.portno = getPort(args->argv[2])) == 0){
|
||||||
printf("ERROR: IP address\n");
|
printf("ERROR: Port number\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ercd = tcp_con_cep(cepid, &my_addr, &dst_addr, TMO_FEVR)) != E_OK) {
|
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)
|
|||||||
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
|
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
|
||||||
wolfSSL_SetIOWriteCtx(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));
|
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -117,12 +117,12 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NO_FILESYSTEM)
|
#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);
|
printf("ERROR: can't load \"%s\"\n", cert);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#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");
|
printf("ERROR: can't load certificate data\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ void wolfSSL_TLS_client( )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
||||||
printf("ERROR: IP address\n");
|
printf("ERROR: Port number\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ void wolfSSL_TLS_client( )
|
|||||||
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
|
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
|
||||||
wolfSSL_SetIOWriteCtx(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));
|
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ void wolfssl_thread_entry(void *pvParameters) {
|
|||||||
|
|
||||||
/* FreeRTOS+TCP Objects */
|
/* FreeRTOS+TCP Objects */
|
||||||
BaseType_t fr_status;
|
BaseType_t fr_status;
|
||||||
socklen_t xSize = sizeof(struct freertos_sockaddr);
|
|
||||||
xSocket_t xClientSocket = NULL;
|
xSocket_t xClientSocket = NULL;
|
||||||
struct freertos_sockaddr xRemoteAddress;
|
struct freertos_sockaddr xRemoteAddress;
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ void wolfssl_thread_entry(void *pvParameters) {
|
|||||||
FREERTOS_SOCK_STREAM,
|
FREERTOS_SOCK_STREAM,
|
||||||
FREERTOS_IPPROTO_TCP);
|
FREERTOS_IPPROTO_TCP);
|
||||||
configASSERT(xClientSocket != FREERTOS_INVALID_SOCKET);
|
configASSERT(xClientSocket != FREERTOS_INVALID_SOCKET);
|
||||||
FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xSize));
|
FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xRemoteAddress));
|
||||||
|
|
||||||
/* Client Socket Connect */
|
/* Client Socket Connect */
|
||||||
ret = FreeRTOS_connect(xClientSocket,
|
ret = FreeRTOS_connect(xClientSocket,
|
||||||
|
@ -151,7 +151,7 @@ void wolfssl_thread_entry(void *pvParameters) {
|
|||||||
|
|
||||||
/* Read the client data into our buff array */
|
/* Read the client data into our buff array */
|
||||||
if (ret != WOLFSSL_SUCCESS) {
|
if (ret != WOLFSSL_SUCCESS) {
|
||||||
printf("Error [%d]: wolfSSL_set_fd.\n",ret);
|
printf("Error [%d]: wolfSSL_accept.\n",ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memset(buff, 0, sizeof(buff));
|
memset(buff, 0, sizeof(buff));
|
||||||
|
@ -114,7 +114,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
|||||||
char *cert = "./certs/ca-cert.pem";
|
char *cert = "./certs/ca-cert.pem";
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if defined(USE_ECC_CERT) && defined(USE_CERT_BUFFERS_256)
|
#if defined(USE_ECC_CERT) && defined(USE_CERT_BUFFERS_256)
|
||||||
const unsigned char *cert = ca_ecc_cert_der_256;
|
const unsigned char *cert = ca_ecc_cert_der_256;
|
||||||
#define SIZEOF_CERT sizeof_ca_ecc_cert_der_256
|
#define SIZEOF_CERT sizeof_ca_ecc_cert_der_256
|
||||||
#else
|
#else
|
||||||
@ -137,7 +137,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
|||||||
if ((client_ctx = wolfSSL_CTX_new_ex(wolfSSLv23_client_method_ex(heapHint),
|
if ((client_ctx = wolfSSL_CTX_new_ex(wolfSSLv23_client_method_ex(heapHint),
|
||||||
heapHint)) == NULL) {
|
heapHint)) == NULL) {
|
||||||
printf("ERROR: failed to create WOLFSSL_CTX\n");
|
printf("ERROR: failed to create WOLFSSL_CTX\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((wolfSSL_CTX_load_static_memory(&client_ctx, NULL, heapBufIO,
|
if ((wolfSSL_CTX_load_static_memory(&client_ctx, NULL, heapBufIO,
|
||||||
@ -149,7 +149,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
/* Create and initialize WOLFSSL_CTX */
|
/* Create and initialize WOLFSSL_CTX */
|
||||||
if ((client_ctx =
|
if ((client_ctx =
|
||||||
wolfSSL_CTX_new(wolfSSLv23_client_method_ex((void *)NULL))) == NULL) {
|
wolfSSL_CTX_new(wolfSSLv23_client_method_ex((void *)NULL))) == NULL) {
|
||||||
printf("ERROR: failed to create WOLFSSL_CTX\n");
|
printf("ERROR: failed to create WOLFSSL_CTX\n");
|
||||||
return;
|
return;
|
||||||
@ -168,8 +168,8 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
|||||||
/* Root CA certificate */
|
/* Root CA certificate */
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
|
|
||||||
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert, SIZEOF_CERT,
|
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");
|
printf("ERROR: can't load certificate data\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -186,15 +186,15 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
|||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
|
|
||||||
/* use specific cipher */
|
/* use specific cipher */
|
||||||
if (cipherlist != NULL &&
|
if (cipherlist != NULL &&
|
||||||
wolfSSL_CTX_set_cipher_list(client_ctx, cipherlist) != WOLFSSL_SUCCESS) {
|
wolfSSL_CTX_set_cipher_list(client_ctx, cipherlist) != WOLFSSL_SUCCESS) {
|
||||||
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
|
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
|
||||||
printf("client can't set cipher list");
|
printf("client can't set cipher list");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WOLFSSL_TLS13)
|
#if defined(WOLFSSL_TLS13)
|
||||||
if (wolfSSL_CTX_UseSupportedCurve(client_ctx, WOLFSSL_ECC_SECP256R1)
|
if (wolfSSL_CTX_UseSupportedCurve(client_ctx, WOLFSSL_ECC_SECP256R1)
|
||||||
!= WOLFSSL_SUCCESS) {
|
!= WOLFSSL_SUCCESS) {
|
||||||
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
|
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
|
||||||
printf("client can't set use supported curves\n");
|
printf("client can't set use supported curves\n");
|
||||||
@ -213,11 +213,11 @@ void wolfSSL_TLS_client( )
|
|||||||
|
|
||||||
#define BUFF_SIZE 256
|
#define BUFF_SIZE 256
|
||||||
static const char sendBuff[]= "Hello Server\n" ;
|
static const char sendBuff[]= "Hello Server\n" ;
|
||||||
|
|
||||||
char rcvBuff[BUFF_SIZE] = {0};
|
char rcvBuff[BUFF_SIZE] = {0};
|
||||||
|
|
||||||
static T_IPV4EP my_addr = { 0, 0 };
|
static T_IPV4EP my_addr = { 0, 0 };
|
||||||
|
|
||||||
T_IPV4EP dst_addr;
|
T_IPV4EP dst_addr;
|
||||||
|
|
||||||
if((dst_addr.ipaddr = getIPaddr(SIMPLE_TLSSEVER_IP)) == 0){
|
if((dst_addr.ipaddr = getIPaddr(SIMPLE_TLSSEVER_IP)) == 0){
|
||||||
@ -225,7 +225,7 @@ void wolfSSL_TLS_client( )
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
||||||
printf("ERROR: IP address\n");
|
printf("ERROR: Port number\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,22 +256,22 @@ void wolfSSL_TLS_client( )
|
|||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
#ifdef USE_ECC_CERT
|
#ifdef USE_ECC_CERT
|
||||||
|
|
||||||
/* ECDSA client certificate */
|
/* ECDSA client certificate */
|
||||||
if (wolfSSL_use_certificate_buffer(ssl, cliecc_cert_der_256,
|
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",
|
printf("ERROR wolfSSL_use_certificate_buffer: %d\n",
|
||||||
wolfSSL_get_error(ssl, 0));
|
wolfSSL_get_error(ssl, 0));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* RSA client certificate */
|
/* RSA client certificate */
|
||||||
if (wolfSSL_use_certificate_buffer(ssl, client_cert_der_2048,
|
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",
|
printf("ERROR wolfSSL_use_certificate_buffer: %d\n",
|
||||||
wolfSSL_get_error(ssl, 0));
|
wolfSSL_get_error(ssl, 0));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USE_ECC_CERT */
|
#endif /* USE_ECC_CERT */
|
||||||
@ -292,17 +292,17 @@ void wolfSSL_TLS_client( )
|
|||||||
printf("ERROR tsip_use_PrivateKey_buffer_TLS\n");
|
printf("ERROR tsip_use_PrivateKey_buffer_TLS\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* DER format ECC private key */
|
/* DER format ECC private key */
|
||||||
if (wolfSSL_use_PrivateKey_buffer(ssl,
|
if (wolfSSL_use_PrivateKey_buffer(ssl,
|
||||||
ecc_clikey_der_256,
|
ecc_clikey_der_256,
|
||||||
sizeof_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",
|
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
|
||||||
wolfSSL_get_error(ssl, 0));
|
wolfSSL_get_error(ssl, 0));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -334,10 +334,10 @@ void wolfSSL_TLS_client( )
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
if (wolfSSL_use_PrivateKey_buffer(ssl, client_key_der_2048,
|
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",
|
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
|
||||||
wolfSSL_get_error(ssl, 0));
|
wolfSSL_get_error(ssl, 0));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WOLFSSL_RENESAS_TSIP_TLS */
|
#endif /* WOLFSSL_RENESAS_TSIP_TLS */
|
||||||
@ -356,7 +356,7 @@ void wolfSSL_TLS_client( )
|
|||||||
/* TLS handshake */
|
/* 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));
|
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ void wolfSSL_TLS_client( )
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
||||||
printf("ERROR: IP address\n");
|
printf("ERROR: Port number\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user