mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
fix compile error when disabled SCEPROTECT
This commit is contained in:
@ -75,6 +75,6 @@
|
||||
#define WOLF_CRYPTO_CB
|
||||
/* Enable SCEKEY_INSTALLED if keys are installed */
|
||||
#define SCEKEY_INSTALLED
|
||||
#if defined(SCEKEY_INSTALLED)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) && defined(SCEKEY_INSTALLED)
|
||||
#define HAVE_RENESAS_SYNC
|
||||
#endif
|
||||
|
@ -59,7 +59,7 @@
|
||||
#endif
|
||||
|
||||
void wolfSSL_TLS_client_init();
|
||||
void wolfSSL_TLS_client();
|
||||
uint32_t wolfSSL_TLS_client();
|
||||
|
||||
static void util_Cleanup(xSocket_t xSock, WOLFSSL_CTX *ctx, WOLFSSL *ssl) {
|
||||
printf("Cleaning up socket and wolfSSL objects.\n");
|
||||
|
@ -24,7 +24,10 @@
|
||||
#include "stdint.h"
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#include <wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h>
|
||||
User_SCEPKCbInfo guser_PKCbInfo;
|
||||
#endif
|
||||
#include <wolfssl_demo.h>
|
||||
#include "key_data.h"
|
||||
|
||||
@ -34,7 +37,7 @@ void abort(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
User_SCEPKCbInfo guser_PKCbInfo;
|
||||
|
||||
|
||||
#if defined(TLS_CLIENT) || defined(TLS_SERVER) || defined(EXTRA_SCE_TSIP_TEST)
|
||||
|
||||
@ -117,7 +120,7 @@ void sce_test(void)
|
||||
#include "r_sce.h"
|
||||
|
||||
printf("Prepare Installed key\n");
|
||||
#if defined(SCEKEY_INSTALLED)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) && defined(SCEKEY_INSTALLED)
|
||||
/* aes 256 */
|
||||
memcpy(guser_PKCbInfo.sce_wrapped_key_aes256.value,
|
||||
(uint32_t *)DIRECT_KEY_ADDRESS, HW_SCE_AES256_KEY_INDEX_WORD_SIZE*4);
|
||||
@ -135,22 +138,22 @@ void sce_test(void)
|
||||
#include "hal_data.h"
|
||||
#include "r_sce.h"
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(USE_CERT_BUFFERS_256)
|
||||
#ifdef TEST_CIPHER_SPECIFIED
|
||||
#if defined(TEST_CIPHER_SPECIFIED)
|
||||
const char* cipherlist[] = {
|
||||
"ECDHE-ECDSA-AES128-SHA256",
|
||||
"ECDHE-ECDSA-AES128-GCM-SHA256"
|
||||
};
|
||||
const int cipherlist_sz = 2;
|
||||
#else
|
||||
#else
|
||||
const char* cipherlist[] = {
|
||||
NULL
|
||||
};
|
||||
const int cipherlist_sz = 1;
|
||||
#endif
|
||||
#endif /* TEST_CIPHER_SPECIFIED */
|
||||
|
||||
#else
|
||||
#ifdef TEST_CIPHER_SPECIFIED
|
||||
#if defined(TEST_CIPHER_SPECIFIED)
|
||||
const char* cipherlist[] = {
|
||||
"AES128-SHA256",
|
||||
"AES256-SHA256",
|
||||
@ -158,34 +161,42 @@ void sce_test(void)
|
||||
"ECDHE-RSA-AES128-GCM-SHA256"
|
||||
};
|
||||
const int cipherlist_sz = 4;
|
||||
#else
|
||||
#else
|
||||
const char* cipherlist[] = {
|
||||
NULL
|
||||
};
|
||||
const int cipherlist_sz = 1;
|
||||
#endif
|
||||
#endif /* TEST_CIPHER_SPECIFIED */
|
||||
#endif
|
||||
#else
|
||||
const char* cipherlist[] = { NULL };
|
||||
const int cipherlist_sz = 0;
|
||||
|
||||
#endif
|
||||
int i = 0;
|
||||
|
||||
int j = 0;
|
||||
uint32_t elapsed_time_total = 0;
|
||||
uint32_t elapsed_time = 0.0;
|
||||
const int benchmark_times = 1;
|
||||
|
||||
SetScetlsKey();
|
||||
|
||||
TCPInit();
|
||||
|
||||
do {
|
||||
if(cipherlist_sz > 0 && cipherlist[i] != NULL ) printf("cipher : %s\n", cipherlist[i]);
|
||||
if(cipherlist_sz > 0 && cipherlist[i] != NULL )
|
||||
printf("cipher : %s\n", cipherlist[i]);
|
||||
|
||||
wolfSSL_TLS_client_init(cipherlist[i]);
|
||||
|
||||
wolfSSL_TLS_client();
|
||||
elapsed_time_total = 0;
|
||||
for(j = 0; j < benchmark_times; j++){
|
||||
wolfSSL_TLS_client_init(cipherlist[i]);
|
||||
elapsed_time = wolfSSL_TLS_client();
|
||||
elapsed_time_total += elapsed_time;
|
||||
printf("elapsed_time(%d) %d mS\n", j, elapsed_time);
|
||||
}
|
||||
if(cipherlist_sz > 0 && i < cipherlist_sz && cipherlist[i] != NULL ) {
|
||||
printf("cipher : %s took %d mS for TLS connection(%d times).\n\n", cipherlist[i],
|
||||
elapsed_time_total, benchmark_times);
|
||||
}
|
||||
|
||||
i++;
|
||||
} while (i < cipherlist_sz);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include "wolfssl/wolfcrypt/settings.h"
|
||||
#include "wolfssl/ssl.h"
|
||||
#include "wolfssl/certs_test.h"
|
||||
@ -44,6 +45,13 @@ static const byte ucDNSServerAddress[4] = { 192, 168, 11, 1 };
|
||||
|
||||
#define FR_SOCKET_SUCCESS 0
|
||||
|
||||
static uint32_t TimeNowInMilliseconds(void)
|
||||
{
|
||||
return (unsigned int)(((float)xTaskGetTickCount()) /
|
||||
(configTICK_RATE_HZ / 1000));
|
||||
}
|
||||
|
||||
|
||||
void TCPInit( )
|
||||
{
|
||||
BaseType_t fr_status;
|
||||
@ -88,7 +96,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
||||
printf("ERROR: failed to create WOLFSSL_CTX\n");
|
||||
return;
|
||||
}
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT_ECC)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
/* set callback functions for ECC */
|
||||
sce_set_callbacks(client_ctx);
|
||||
#endif
|
||||
@ -112,11 +120,11 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
|
||||
}
|
||||
}
|
||||
|
||||
void wolfSSL_TLS_client( )
|
||||
uint32_t wolfSSL_TLS_client( )
|
||||
{
|
||||
int ret;
|
||||
/* FreeRTOS+TCP Objects */
|
||||
|
||||
uint32_t elipsed_time = 0;
|
||||
socklen_t xSize = sizeof(struct freertos_sockaddr);
|
||||
xSocket_t xClientSocket = NULL;
|
||||
struct freertos_sockaddr xRemoteAddress;
|
||||
@ -151,9 +159,9 @@ void wolfSSL_TLS_client( )
|
||||
|
||||
if((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
printf("ERROR wolfSSL_new: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
return elipsed_time;
|
||||
}
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT_ECC)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
/* set callback ctx */
|
||||
sce_set_callback_ctx(ssl, (void*)&guser_PKCbInfo);
|
||||
#endif
|
||||
@ -163,20 +171,22 @@ void wolfSSL_TLS_client( )
|
||||
printf("Error [%d]: wolfSSL_set_fd.\n",ret);
|
||||
util_inf_loop(xClientSocket, ctx, ssl);
|
||||
}
|
||||
|
||||
|
||||
elipsed_time = TimeNowInMilliseconds( );
|
||||
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
|
||||
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
return elipsed_time;;
|
||||
}
|
||||
elipsed_time = TimeNowInMilliseconds( ) - elipsed_time;
|
||||
|
||||
if (wolfSSL_write(ssl, sendBuff, strlen(sendBuff)) != strlen(sendBuff)) {
|
||||
printf("ERROR SSL write: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
return elipsed_time;;
|
||||
}
|
||||
|
||||
if ((ret=wolfSSL_read(ssl, rcvBuff, BUFF_SIZE)) < 0) {
|
||||
printf("ERROR SSL read: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
return elipsed_time;;
|
||||
}
|
||||
|
||||
rcvBuff[ret] = '\0' ;
|
||||
@ -188,5 +198,5 @@ void wolfSSL_TLS_client( )
|
||||
wolfSSL_Cleanup();
|
||||
|
||||
|
||||
return;
|
||||
return elipsed_time;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || defined(WOLFSSL_RENESAS_TSIP_TLS)
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#include <wolfssl/wolfcrypt/port/Renesas/renesas-sce-crypt.h>
|
||||
#elif defined(WOLFSSL_RENESAS_TSIP_TLS)
|
||||
@ -802,4 +804,4 @@ int Renesas_cmn_SigPkCbEccVerify(const unsigned char* sig, unsigned int sigSz,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* SCEPROTECT || TSIP */
|
||||
|
Reference in New Issue
Block a user