mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-10 16:14:42 +02:00
Merge pull request #9047 from miyazakh/rz_update
Update Renesas RZ examples
This commit is contained in:
@@ -212,6 +212,7 @@ ESP_PLATFORM
|
||||
ESP_TASK_MAIN_STACK
|
||||
ETHERNET_AVAILABLE
|
||||
EV_TRIGGER
|
||||
EXTERNAL_LOADER_APP
|
||||
FORCE_FAILURE_GETRANDOM
|
||||
FP_ECC_CONTROL
|
||||
FREERTOS_TCP_WINSIM
|
||||
|
@@ -150,18 +150,27 @@ void Clr_CallbackCtx(FSPSM_ST *g)
|
||||
{
|
||||
(void) g;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT_CRYPTONLY)
|
||||
XFREE(g->wrapped_key_rsapri2048, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (g == NULL) return;
|
||||
|
||||
XFREE(g->wrapped_key_rsapub2048, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (g->wrapped_key_aes256 != NULL)
|
||||
g->wrapped_key_aes256 = NULL;
|
||||
|
||||
XFREE(g->wrapped_key_rsapri1024, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (g->wrapped_key_aes128 != NULL)
|
||||
g->wrapped_key_aes128 = NULL;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
|
||||
if (g->wrapped_key_rsapri2048 != NULL)
|
||||
g->wrapped_key_rsapri2048 = NULL;
|
||||
|
||||
if (g->wrapped_key_rsapub2048 != NULL)
|
||||
XFREE(g->wrapped_key_rsapub1024,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
g->wrapped_key_rsapub2048 = NULL;
|
||||
|
||||
if (g->wrapped_key_rsapri1024 != NULL)
|
||||
g->wrapped_key_rsapri1024 = NULL;
|
||||
|
||||
if (g->wrapped_key_rsapub2048 != NULL)
|
||||
g->wrapped_key_rsapub2048 = NULL;
|
||||
#endif
|
||||
XMEMSET(g, 0, sizeof(FSPSM_ST));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -262,9 +271,6 @@ void sce_test(void)
|
||||
benchmark_test(NULL);
|
||||
printf("End wolfCrypt Benchmark\n");
|
||||
|
||||
/* free */
|
||||
Clr_CallbackCtx(&guser_PKCbInfo);
|
||||
|
||||
#elif defined(TLS_CLIENT)
|
||||
#include "hal_data.h"
|
||||
#include "r_sce.h"
|
||||
|
@@ -37,8 +37,6 @@
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
static const int devId = 7890;
|
||||
|
||||
#ifndef NO_SHA
|
||||
int sha_test();
|
||||
#endif
|
||||
@@ -63,10 +61,9 @@ static byte Aes256_Cbc_multTst_rslt = 0;
|
||||
static byte Aes128_Gcm_multTst_rslt = 0;
|
||||
static byte Aes256_Gcm_multTst_rslt = 0;
|
||||
|
||||
int sce_crypt_AesCbc_multitest();
|
||||
int sce_crypt_AesGcm_multitest();
|
||||
int sce_crypt_Sha_AesCbcGcm_multitest();
|
||||
int sce_crypt_sha_multitest();
|
||||
int sce_crypt_AesCbc_multitest(int devId);
|
||||
int sce_crypt_AesGcm_multitest(int devId);
|
||||
int sce_crypt_Sha_AesCbcGcm_multitest(int devId);
|
||||
int sce_crypt_test();
|
||||
int sce_crypt_sha256_multitest();
|
||||
void tskSha256_Test1(void *pvParam);
|
||||
@@ -97,12 +94,13 @@ FSPSM_ST gCbInfo_a; /* for multi testing */
|
||||
#endif
|
||||
typedef struct tagInfo
|
||||
{
|
||||
int devId;
|
||||
sce_aes_wrapped_key_t aes_key;
|
||||
} Info;
|
||||
|
||||
#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
|
||||
|
||||
static int sce_aes_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
static int sce_aes_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key, int devId)
|
||||
{
|
||||
|
||||
Aes aes[1];
|
||||
@@ -171,7 +169,7 @@ static void tskAes128_Cbc_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = sce_aes_cbc_test(0, &p->aes_key);
|
||||
ret = sce_aes_cbc_test(0, &p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). sce_aes_cbc_test\n", ret);
|
||||
@@ -186,7 +184,7 @@ static void tskAes128_Cbc_Test(void *pvParam)
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_AES_256
|
||||
static int sce_aes256_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
static int sce_aes256_test(int prnt, FSPSM_AES_PWKEY aes_key, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
byte cipher[WC_AES_BLOCK_SIZE];
|
||||
@@ -269,7 +267,7 @@ static void tskAes256_Cbc_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = sce_aes256_test(0, &p->aes_key);
|
||||
ret = sce_aes256_test(0, &p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). sce_aes256_test\n", ret);
|
||||
@@ -284,7 +282,7 @@ static void tskAes256_Cbc_Test(void *pvParam)
|
||||
#endif /* WOLFSSL_AES_256 */
|
||||
|
||||
#if defined(WOLFSSL_AES_256)
|
||||
static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key)
|
||||
static int sce_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
Aes dec[1];
|
||||
@@ -451,7 +449,7 @@ static void tskAes256_Gcm_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = sce_aesgcm256_test(0, &p->aes_key);
|
||||
ret = sce_aesgcm256_test(0, &p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). sce_aesgcm256_test\n", ret);
|
||||
@@ -466,7 +464,7 @@ static void tskAes256_Gcm_Test(void *pvParam)
|
||||
|
||||
#if defined(WOLFSSL_AES_128)
|
||||
|
||||
static int sce_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key)
|
||||
static int sce_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
Aes dec[1];
|
||||
@@ -597,7 +595,7 @@ static void tskAes128_Gcm_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = sce_aesgcm128_test(0, &p->aes_key);
|
||||
ret = sce_aesgcm128_test(0, &p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). sce_aesgcm128_test\n", ret);
|
||||
@@ -619,7 +617,7 @@ static void tskAes128_Gcm_Test(void *pvParam)
|
||||
#define TEST_STRING_SZ 25
|
||||
#define RSA_TEST_BYTES 256 /* up to 2048-bit key */
|
||||
|
||||
static int sce_rsa_test(int prnt, int keySize)
|
||||
static int sce_rsa_test(int prnt, int keySize, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -654,7 +652,7 @@ static int sce_rsa_test(int prnt, int keySize)
|
||||
XMEMSET(out, 0, outSz);
|
||||
XMEMSET(out2, 0, outSz);
|
||||
|
||||
ret = wc_InitRsaKey_ex(key, NULL, 7890/* fixed devid for TSIP/SCE*/);
|
||||
ret = wc_InitRsaKey_ex(key, NULL, devId);
|
||||
if (ret != 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -699,7 +697,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sce_rsa_SignVerify_test(int prnt, int keySize)
|
||||
static int sce_rsa_SignVerify_test(int prnt, int keySize, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -730,7 +728,7 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize)
|
||||
XMEMCPY(in, inStr, inLen);
|
||||
XMEMCPY(in2, inStr2, inLen);
|
||||
|
||||
ret = wc_InitRsaKey_ex(key, NULL, 7890/* fixed devid for TSIP/SCE*/);
|
||||
ret = wc_InitRsaKey_ex(key, NULL, devId);
|
||||
if (ret != 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -781,6 +779,7 @@ static int sce_rsa_SignVerify_test(int prnt, int keySize)
|
||||
int sce_crypt_test()
|
||||
{
|
||||
int ret = 0;
|
||||
int devId = INVALID_DEVID;
|
||||
fsp_err_t err;
|
||||
|
||||
Clr_CallbackCtx(&gCbInfo);
|
||||
@@ -817,13 +816,14 @@ int sce_crypt_test()
|
||||
SCE_KeyGeneration(&gCbInfo_a);
|
||||
|
||||
ret = wc_CryptoCb_CryptInitRenesasCmn(NULL, &gCbInfo);
|
||||
if ( ret > 0)
|
||||
ret = 0;
|
||||
|
||||
if ( ret > 0) {
|
||||
devId = ret;
|
||||
ret = 0;
|
||||
}
|
||||
if (ret == 0) {
|
||||
printf(" sce_rsa_test(512)(this will be done"
|
||||
" by SW because SCE doesn't support 512 bits key size.)");
|
||||
ret = sce_rsa_test(1, 512);
|
||||
ret = sce_rsa_test(1, 512, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
@@ -833,13 +833,13 @@ int sce_crypt_test()
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 1;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 0;
|
||||
ret = sce_rsa_test(1, 1024);
|
||||
ret = sce_rsa_test(1, 1024, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
printf(" sce_rsa_SignVerify_test(1024)");
|
||||
ret = sce_rsa_SignVerify_test(1, 1024);
|
||||
ret = sce_rsa_SignVerify_test(1, 1024, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
@@ -849,13 +849,13 @@ int sce_crypt_test()
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 1;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 1;
|
||||
ret = sce_rsa_test(1, 2048);
|
||||
ret = sce_rsa_test(1, 2048, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
if (ret == 0 && err == FSP_SUCCESS) {
|
||||
printf(" sce_rsa_SignVerify_test(2048)");
|
||||
ret = sce_rsa_SignVerify_test(1, 2048);
|
||||
ret = sce_rsa_SignVerify_test(1, 2048, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
@@ -864,16 +864,16 @@ int sce_crypt_test()
|
||||
ret = sha256_test();
|
||||
RESULT_STR(ret)
|
||||
#endif
|
||||
ret = sce_aes_cbc_test(1, &g_user_aes128_key_index1);
|
||||
ret = sce_aes_cbc_test(1, &g_user_aes128_key_index1, devId);
|
||||
if (ret == 0) {
|
||||
ret = sce_aes256_test(1, &g_user_aes256_key_index1);
|
||||
ret = sce_aes256_test(1, &g_user_aes256_key_index1, devId);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = sce_aesgcm128_test(1, &g_user_aes128_key_index1);
|
||||
ret = sce_aesgcm128_test(1, &g_user_aes128_key_index1, devId);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = sce_aesgcm256_test(1, &g_user_aes256_key_index1);
|
||||
ret = sce_aesgcm256_test(1, &g_user_aes256_key_index1, devId);
|
||||
}
|
||||
printf(" \n");
|
||||
if (ret == 0) {
|
||||
@@ -882,22 +882,21 @@ int sce_crypt_test()
|
||||
}
|
||||
if (ret == 0) {
|
||||
printf(" multi Aes cbc thread test\n");
|
||||
ret = sce_crypt_AesCbc_multitest();
|
||||
ret = sce_crypt_AesCbc_multitest(devId);
|
||||
}
|
||||
if (ret == 0) {
|
||||
printf(" multi Aes Gcm thread test\n");
|
||||
ret = sce_crypt_AesGcm_multitest();
|
||||
ret = sce_crypt_AesGcm_multitest(devId);
|
||||
}
|
||||
if (ret == 0) {
|
||||
printf(" multi sha aescbc aesgcm thread test\n");
|
||||
sce_crypt_Sha_AesCbcGcm_multitest();
|
||||
sce_crypt_Sha_AesCbcGcm_multitest(devId);
|
||||
} else
|
||||
ret = -1;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
|
||||
Clr_CallbackCtx(&gCbInfo);
|
||||
Clr_CallbackCtx(&gCbInfo_a);
|
||||
#endif
|
||||
wc_CryptoCb_CleanupRenesasCmn(&devId);
|
||||
Clr_CallbackCtx(&gCbInfo);
|
||||
Clr_CallbackCtx(&gCbInfo_a);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -955,7 +954,7 @@ int sce_crypt_sha256_multitest()
|
||||
sha256_multTst_rslt1 = 0;
|
||||
sha256_multTst_rslt2 = 0;
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting(num, 0);
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
|
||||
#ifndef NO_SHA256
|
||||
@@ -994,7 +993,7 @@ int sce_crypt_sha256_multitest()
|
||||
}
|
||||
|
||||
|
||||
int sce_crypt_AesCbc_multitest()
|
||||
int sce_crypt_AesCbc_multitest(int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
int num = 0;
|
||||
@@ -1015,8 +1014,12 @@ int sce_crypt_AesCbc_multitest()
|
||||
Aes128_Cbc_multTst_rslt = 0;
|
||||
Aes256_Cbc_multTst_rslt = 0;
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting(num, 0);
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
info_aes1.devId = devId;
|
||||
info_aes2.devId = devId;
|
||||
info_aes256_1.devId = devId;
|
||||
info_aes256_2.devId = devId;
|
||||
|
||||
#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
|
||||
XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1,
|
||||
@@ -1075,7 +1078,7 @@ int sce_crypt_AesCbc_multitest()
|
||||
}
|
||||
|
||||
|
||||
int sce_crypt_AesGcm_multitest()
|
||||
int sce_crypt_AesGcm_multitest(int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
int num = 0;
|
||||
@@ -1097,9 +1100,12 @@ int sce_crypt_AesGcm_multitest()
|
||||
Aes128_Gcm_multTst_rslt = 0;
|
||||
Aes256_Gcm_multTst_rslt = 0;
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting(num, 0);
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
|
||||
info_aes1.devId = devId;
|
||||
info_aes2.devId = devId;
|
||||
info_aes256_1.devId = devId;
|
||||
info_aes256_2.devId = devId;
|
||||
#if defined(WOLFSSL_AES_128)
|
||||
XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1,
|
||||
sizeof(sce_aes_wrapped_key_t));
|
||||
@@ -1158,7 +1164,7 @@ int sce_crypt_AesGcm_multitest()
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sce_crypt_Sha_AesCbcGcm_multitest()
|
||||
int sce_crypt_Sha_AesCbcGcm_multitest(int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
int num = 0;
|
||||
@@ -1188,9 +1194,12 @@ int sce_crypt_Sha_AesCbcGcm_multitest()
|
||||
Aes128_Gcm_multTst_rslt = 0;
|
||||
Aes256_Gcm_multTst_rslt = 0;
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting(num, 0);
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
|
||||
info_aes128cbc.devId = devId;
|
||||
info_aes128gcm.devId = devId;
|
||||
info_aes256cbc.devId = devId;
|
||||
info_aes256gcm.devId = devId;
|
||||
#ifndef NO_SHA256
|
||||
xRet = xTaskCreate(tskSha256_Test1, "sha256_test1",
|
||||
STACK_SIZE, NULL, 3, NULL);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(SIMPLE_TLS_TSIP_CLIENT) || defined(SIMPLE_TLS_CLIENT)
|
||||
#define SIMPLE_TLSSEVER_IP "192.168.11.11"
|
||||
#define SIMPLE_TLSSEVER_IP "192.168.11.6"
|
||||
#define SIMPLE_TLSSERVER_PORT "11111"
|
||||
|
||||
ER t4_tcp_callback(ID cepid, FN fncd , VP p_parblk);
|
||||
@@ -308,10 +308,10 @@ void wolfSSL_TLS_client( )
|
||||
#else
|
||||
|
||||
if (ret == 0) {
|
||||
err = wolfSSL_use_PrivateKey_buffer(ssl, client_key_der_2048,
|
||||
ret = wolfSSL_use_PrivateKey_buffer(ssl, client_key_der_2048,
|
||||
sizeof_client_key_der_2048, WOLFSSL_FILETYPE_ASN1);
|
||||
|
||||
if (err != SSL_SUCCESS) {
|
||||
if (ret != SSL_SUCCESS) {
|
||||
printf("ERROR wolfSSL_use_PrivateKey_buffer: %d\n",
|
||||
wolfSSL_get_error(ssl, 0));
|
||||
ret = -1;
|
||||
|
@@ -1132,9 +1132,9 @@
|
||||
<configuration inuse="true" name="r_bsp">
|
||||
<component description="依存モジュール: なし The r_bsp package provides a foundation for code to be built on top of. It provides startup code, iodefines, and MCU information for different boards. There are 2 folders that make up the r_bsp package. The 'mcu' folder contains files that are common to a MCU group. These files provide functionality such as easy register access, CPU functions, and a file named 'mcu_info.h' for each MCU group. The 'mcu_info.h' file has information about the MCU on the board and is configured based on the information given in r_bsp_config.h. The information in 'mcu_info.h' is used to help configure Renesas middleware that uses the r_bsp package. The 'board' folder has a folder with startup code for each supported board. Which MCU and board is chosen is decided by the settings in 'platform.h'. The user can choose which board they are using by uncommenting the include path that applies to their board. For example, if you are using the RSK+RX64M then you would uncomment the #include "./board/generic_rx64m/r_bsp.h" include path. Users are encouraged to add their own boards to the 'board' directory. BSPs are configured by using the r_bsp_config.h file. Each board will have a reference configuration file named r_bsp_config_reference.h. The user should copy this file to their project, rename it to r_bsp_config.h, and use the options inside the file to configure the BSP for their project." detailDescription="Board Support Packages." display="r_bsp" id="r_bsp7.51" version="7.51">
|
||||
<gridItem id="BSP_CFG_USER_STACK_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_USTACK_BYTES" selectedIndex="0x4000"/>
|
||||
<gridItem id="BSP_CFG_USTACK_BYTES" selectedIndex="0x2000"/>
|
||||
<gridItem id="BSP_CFG_ISTACK_BYTES" selectedIndex="0x400"/>
|
||||
<gridItem id="BSP_CFG_HEAP_BYTES" selectedIndex="0xf000"/>
|
||||
<gridItem id="BSP_CFG_HEAP_BYTES" selectedIndex="0xff00"/>
|
||||
<gridItem id="BSP_CFG_IO_LIB_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARGET_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARGET_FUNCTION" selectedIndex="my_sw_charget_function"/>
|
||||
|
@@ -21,37 +21,49 @@ The example project summary is listed below and is relevant for every project.
|
||||
### Project Summary
|
||||
|Item|Name/Version|
|
||||
|:--|:--|
|
||||
|e2Studio|2025-04.1 (25.4.1)|
|
||||
|Board|RZN2L|
|
||||
|Device|R9A07G084M08GBG|
|
||||
|Toolchain|GCC for Renesas RZ|
|
||||
|Toolchain Version|10.3.1.20210824|
|
||||
|FSP Version|1.2.0|
|
||||
|FSP Version|2.0.0|
|
||||
|
||||
#### Selected software components
|
||||
|
||||
|Components|Version|Note|
|
||||
|:--|:--|:--|
|
||||
|Board Support Package Common Files|v1.20||
|
||||
|I/O Port|v1.2.0||
|
||||
|Arm CMSIS Version 5 - Core (M)|v5.7.0+renesas.1||
|
||||
|Board support package for R9A07G084M04GBG|v1.2.0|Note1|
|
||||
|Board support package for RZN2L|v1.2.0||
|
||||
|Board support package for RZN2L - FSP Data|v1.2.0||
|
||||
|RSK+RZN2L Board Support Files (RAM execution without flash memory)|v1.2.0||
|
||||
|FreeRTOS - Buffer Allocation 2|v1.2.0||
|
||||
|FreeRTOS - Memory Management - Heap 4|v1.2.0||
|
||||
|FreeRTOS+TCP|v1.2.0||
|
||||
|Ethernet PHY |v1.2.0||
|
||||
|Ethernet Selector|v1.2.0||
|
||||
|Ethernet|v1.2.0||
|
||||
|Ethernet Switch|v1.2.0||
|
||||
|SCI UART|v1.2.0||
|
||||
|r_ether to FreeRTOS+TCP Wrapper|v1.2.0||
|
||||
|Renesas Secure IP Driver|v1.3.0+fsp.1.2.0|Need to contact Renesas to get RSIP module|
|
||||
|RSIP Engine for RZ/N2L|v1.3.0+fsp.1.2.0|Need to contact Renesas to get RSIP module|
|
||||
|Board Support Package Common Files|v2.0.0||
|
||||
|I/O Port|v2.0.0||
|
||||
|Arm CMSIS Version 5 - Core (M)|v5.7.0+renesas.1.fsp.2.0.0||
|
||||
|Board support package for R9A07G084M04GBG|v2.0.0|Note1|
|
||||
|Board support package for RZN2L|v2.0.0||
|
||||
|Board support package for RZN2L - FSP Data|v2.0.0||
|
||||
|RSK+RZN2L Board Support Files (xSPI0 x1 boot mode)|v2.0.0||
|
||||
|FreeRTOS - Buffer Allocation 2|v2.0.0||
|
||||
|FreeRTOS - Memory Management - Heap 4|v2.0.0||
|
||||
|FreeRTOS+TCP|v2.0.0||
|
||||
|Ethernet PHY |v2.0.0||
|
||||
|Ethernet Selector|v2.0.0||
|
||||
|Ethernet|v2.0.0||
|
||||
|Ethernet Switch|v2.0.0||
|
||||
|SCI UART|v2.0.0||
|
||||
|r_ether to FreeRTOS+TCP Wrapper|v2.0.0||
|
||||
|Renesas Secure IP Driver|v1.5.0+fsp.1.3.0||
|
||||
|RSIP Engine for RZ/N2L|v1.5.0+fsp.1.3.0||
|
||||
|
||||
Note1:\
|
||||
To use RSIP driver, a device type should be `R9A07G084M04GBG`. However, choosing `R9A07G084M04GBG` won't allow to select `RSK+RZN2L` board. This example uses LED and external flash memory on `RSK + RZN2L` board. Therefore, the example temporary `R9A07G084M04GBG` for the device type. Updating e2studio or fsp could resolve the issue.
|
||||
To use RSIP driver, a device type should be `R9A07G084M08GBG`. However, choosing `R9A07G084M04GBG` won't allow to select `RSK+RZN2L` board. This example uses LED and external flash memory on `RSK + RZN2L` board. Therefore, the example temporary `R9A07G084M04GBG` for the device type. Updating e2studio or fsp could resolve the issue.
|
||||
|
||||
## Board Settings
|
||||
This example program uses `xSPI0 boot`. Therefore, the board's switch and jumper settings required to run the sample program from external flash are shown below. For details on each setting, see the Renesas Starter Kit+ for RZN2L User's Manual.
|
||||
|
||||
|Project|SW4-1|SW4-2|SW4-3|SW4-4|SW4-7|
|
||||
|:--|:--|:--|:--|:--|:--|
|
||||
|xSPI0 boot mode|ON|ON|ON|ON|OFF|
|
||||
|
||||
|Project|CN8|CN24|
|
||||
|:--|:--|:--|
|
||||
|xSPI0 boot mode|Short 2-3|Short2-3|
|
||||
|
||||
## Setup Steps and Build wolfSSL Library
|
||||
|
||||
@@ -63,7 +75,7 @@ Note1:\
|
||||
|
||||
+ Click File->New->`RZ/N C/C++ FSP Project`.
|
||||
+ Enter project name `dummy_application`.
|
||||
+ Select Board: to `RSK+RZN2L (RAM execution without flash memory)`.
|
||||
+ Select Board: to `RSK+RZN2L (xSPI0 x1 boot mode)`.
|
||||
+ Select Device: to `R9A07G084M04GBG`. Click Next.
|
||||
+ Check to `Executable`
|
||||
+ Select FreeRTOS from RTOS selection. Click Finish.
|
||||
@@ -93,31 +105,125 @@ Note1:\
|
||||
+ Click `Generate Project Content` on FSP configuration GUI
|
||||
|
||||
3.) Prepare UART to logging
|
||||
|
||||
+ Download Sample package from [BACnet Start-Up](https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-mpus/bacnet-start-rzn2l-rsk)
|
||||
+ Download Example packages from [RZ/N2L Group Example program](https://www.renesas.com/us/en/document/scd/rzn2l-group-example-program?r=1622651) and unzip the archived file.
|
||||
+ unzip RZN2L_RSK_sci_uart_Rev200.zip
|
||||
+ unzip RZN2L_RSK_sci_uart_Rev200/basis/gcc/RZN2L_RSK_sci_uart_Rev200a.zip
|
||||
+
|
||||
+ Copy the following C source files from the project to src/serial_io folder of `test_RZN2L`\
|
||||
um_serial_io_uart.c\
|
||||
um_serial_io_task_writer.c\
|
||||
um_serial_io_cfg.h\
|
||||
um_common_api.h\
|
||||
um_common_cfg.h\
|
||||
um_serial_io.c\
|
||||
um_serial_io.h\
|
||||
um_serial_io_api.h\
|
||||
um_serial_io_internal.h
|
||||
sio_char.h\
|
||||
siochar.c
|
||||
|
||||
4.) Prepare loader project
|
||||
+ Download Example packages from [RZ/N2L Group Example of separating loader program and application program projects](https://www.renesas.com/en/document/scd/11691006?language=en&r=1622651) and unzip the archived file.
|
||||
+ Unzip `RZN2L_loader_application\gcc\xspi0bootx1\Loader_application_projects.zip
|
||||
+ Copy `RZN2L_bsp_xspi0bootx1_loader` and `RZN2L_bsp_xspi0bootx1_app` to `<wolfSSL>\IDE\Renesas\e2studio\RZN2L` folder
|
||||
+ Import `RZN2L_bsp_xspi0bootx1_loader` from `e2studio`
|
||||
|
||||
+ Open um_serial_io_task_writer.c and re-name printf to uart_printf
|
||||
## Build `test_RZN2L`
|
||||
1). Modify `fsp/src/bsp/cmsis/Device/RENESAS/Source/cr/startup_core.c`:
|
||||
ORIGINAL
|
||||
```
|
||||
BSP_TARGET_ARM BSP_ATTRIBUTE_STACKLESS void __Vectors (void)
|
||||
{
|
||||
__asm volatile (
|
||||
" ldr pc,=Reset_Handler \n"
|
||||
```
|
||||
==>
|
||||
|
||||
3.) Build `test_RZN2L` project
|
||||
MODIFIED
|
||||
```
|
||||
BSP_TARGET_ARM BSP_ATTRIBUTE_STACKLESS void __Vectors (void)
|
||||
{
|
||||
__asm volatile (
|
||||
#if 0
|
||||
" ldr pc,=Reset_Handler \n"
|
||||
#else
|
||||
" ldr pc,=local_system_init \n"
|
||||
#endif
|
||||
```
|
||||
1). Modify `fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c`:
|
||||
|
||||
## Run `test_RZN2L`
|
||||
ORIGINAL
|
||||
```
|
||||
void SystemInit (void)
|
||||
{
|
||||
#if BSP_CFG_EARLY_INIT
|
||||
...
|
||||
#if BSP_CFG_C_RUNTIME_INIT
|
||||
|
||||
1). Right click the project and Select menu `Debug` -> `Renesas GDB Hardware debugging`
|
||||
/* Copy the loader data from external Flash to internal RAM. */
|
||||
bsp_loader_data_init();
|
||||
|
||||
2). Select J-Link ARM and R9A07G084M04
|
||||
/* Clear loader bss section in internal RAM. */
|
||||
bsp_loader_bss_init();
|
||||
#endif
|
||||
...
|
||||
#if !(BSP_CFG_RAM_EXECUTION)
|
||||
|
||||
3). Break at Entry point. Change `cpsr` register value from 0xXXXXX1yy to 0xXXXXX1da
|
||||
/* Copy the application program from external Flash to internal RAM. */
|
||||
bsp_copy_to_ram();
|
||||
|
||||
/* Clear bss section in internal RAM. */
|
||||
bsp_application_bss_init();
|
||||
#endif
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
==>
|
||||
|
||||
MODIFIED
|
||||
```
|
||||
BSP_TARGET_ARM void mpu_cache_init (void)
|
||||
{
|
||||
...
|
||||
if BSP_CFG_C_RUNTIME_INIT && !defined(EXTERNAL_LOADER_APP)
|
||||
|
||||
/* Copy the loader data from external Flash to internal RAM. */
|
||||
bsp_loader_data_init();
|
||||
|
||||
/* Clear loader bss section in internal RAM. */
|
||||
bsp_loader_bss_init();
|
||||
#endif
|
||||
...
|
||||
#if !(BSP_CFG_RAM_EXECUTION) && !defined(EXTERNAL_LOADER_APP)
|
||||
|
||||
/* Copy the application program from external Flash to internal RAM. */
|
||||
/* bsp_copy_to_ram(); */
|
||||
|
||||
/* Clear bss section in internal RAM. */
|
||||
bsp_application_bss_init();
|
||||
#endif
|
||||
...
|
||||
}
|
||||
```
|
||||
2). Copy contenst of `fsp_xspi0_boot_app.ld` of `RZN2L_bsp_xspi0bootx1_app\script\` to `test_RZN2L\script\fsp_xspi0_boot.ld`
|
||||
|
||||
3). Right click the project and Select menu `Debug` -> `Renesas GDB Hardware debugging`
|
||||
|
||||
4). Select J-Link ARM and R9A07G084M04
|
||||
5). Build `test_RZN2L`
|
||||
|
||||
## Build loader project
|
||||
+ Modify `src/Flash_section.s`:
|
||||
|
||||
ORIGINAL
|
||||
```
|
||||
.incbin "../../RZN2L_bsp_xspi0bootx1_app/Debug/RZN2L_bsp_xspi0bootx1_app.bin"
|
||||
```
|
||||
|
||||
==>
|
||||
|
||||
MODIFIED
|
||||
```
|
||||
.incbin "../../test/Debug/test_RZN2L.bin"
|
||||
```
|
||||
+ Modify `Load Image and Symbol`. Open `Debug Configuration` -> Open `Startup` tab -> Replace `RZN2L_bsp_xspi0bootx1_app.elf` to `test_RZN2L.elf`
|
||||
|
||||
## Run loader and `test_RZN2L`
|
||||
+ Run the loader project
|
||||
+ Loader download `test_RZN2L` binary from flash to system ram and execute it.
|
||||
+ Note: It recommends to re-build the loader project when re-building `test_RZN2L`
|
||||
|
||||
## Run TLS 1.3 Client
|
||||
1.) Enable `WOLFSSL_TLS13` macro in `user_settings.h`
|
||||
|
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
/* Operating Environment and Threading */
|
||||
#if defined(WOLFSSL_RENESAS_RSIP)
|
||||
#define WOLFSSL_RENESAS_RZFSP_VER 200
|
||||
/* FSP SM stands for Flexible Software Package Security Module
|
||||
* WOLFSSL_RENESAS_FSPSM enables fundamental code when it uses.
|
||||
* e.g. Open/Close/Random generator
|
||||
@@ -104,7 +105,9 @@
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
|
||||
#define WOLF_CRYPTO_CB_RSA_PAD
|
||||
#define WOLFSSL_KEY_GEN
|
||||
#define RSA_MIN_SIZE 512
|
||||
#endif
|
||||
|
||||
int uart_printf (const char *__restrict format, ...);
|
||||
@@ -112,4 +115,7 @@ int uart_printf (const char *__restrict format, ...);
|
||||
#define printf uart_printf
|
||||
|
||||
#define TEST_SLEEP() vTaskDelay(50)
|
||||
#if defined(WOLFSSL_RENESAS_RSIP)
|
||||
#define CUSTOM_RAND_GENERATE_BLOCK wc_fspsm_GenerateRandBlock
|
||||
#endif
|
||||
|
||||
|
@@ -7,10 +7,11 @@ EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/.cproject
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/.project
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/rzn2l_tst_thread_entry.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/wolfssl_dummy.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/local_system_init.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/test/wolf_client.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/test/wolf_server.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/test/wolfssl_rsip_unit_test.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/serial_io/.gitignore
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/serial_io/app_print.c
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/wolfCrypt/.gitignore
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/wolfSSL/.gitignore
|
||||
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/common/wolfssl_demo.h
|
||||
|
@@ -43,7 +43,7 @@
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.2133049482" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1476755314" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.1180377769" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="true" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.385566364" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M04GBG" valueType="string"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.385566364" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M08GBG" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.85130646" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.438363043" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.family.734485543" name="Arm family (-mcpu)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-r52" valueType="enumerated"/>
|
||||
@@ -66,6 +66,7 @@
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.878213280" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include.1404470165" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||
@@ -96,17 +97,32 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value="".""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.920863118" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.compilerC.15728131" name="Cross ARM C Compiler" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.compilerC">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.2054256250" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.c99" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.737680653" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
|
||||
<listOptionValue builtIn="false" value="EXTERNAL_LOADER_APP"/>
|
||||
<listOptionValue builtIn="false" value="WOLFSSL_RENESAS_RSIP"/>
|
||||
<listOptionValue builtIn="false" value="WOLFSSL_RENESAS_RZN2L"/>
|
||||
<listOptionValue builtIn="false" value="WOLFSSL_USER_SETTINGS"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include.1392028571" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/generate""/>
|
||||
@@ -142,6 +158,20 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value="".""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1188589179" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||
</tool>
|
||||
@@ -154,7 +184,7 @@
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano.1707323954" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint.2121320154" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript.35544828" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""fsp_ram_execution.ld""/>
|
||||
<listOptionValue builtIn="false" value=""fsp_xspi0_boot.ld""/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath.1169036561" name="User defined archive search directories (-L)" superClass="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/script""/>
|
||||
@@ -436,6 +466,7 @@
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.renesas.cdt.managedbuild.gcc.rz.archives.includeFiles.1438841261" name="Standard archive (library) files (-l)" superClass="com.renesas.cdt.managedbuild.gcc.rz.archives.includeFiles" valueType="stringList"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnosys.1028106860" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnosys" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.useprintffloat.584424940" name="Use float with nano printf (-u _printf_float)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.useprintffloat" value="false" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano.2085931869" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||
<inputType id="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c.1165207646" superClass="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinputdependency" paths="$(LIBRARY_GENERATOR_OUTPUTTYPE_OUTPUTS)"/>
|
||||
@@ -448,12 +479,16 @@
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano.1744364271" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint.1291406965" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript.310553223" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""fsp_ram_execution.ld""/>
|
||||
<listOptionValue builtIn="false" value=""fsp_xspi0_boot.ld""/>
|
||||
</option>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano.803193311" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano" value="true" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver.1683309259" name="Cross ARM GNU Archiver" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver"/>
|
||||
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.flash.495323055" name="Cross ARM GNU Create Flash Image" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.flash">
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice.1427749577" name="Output file format (-O)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice" value="ilg.gnuarmeclipse.managedbuild.cross.option.createflash.choice.srec" valueType="enumerated"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice.1427749577" name="Output file format (-O)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice" value="ilg.gnuarmeclipse.managedbuild.cross.option.createflash.choice.binary" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.flash.other.182390017" name="Other flags" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.flash.other" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="--gap-fill 0xff"/>
|
||||
</option>
|
||||
</tool>
|
||||
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.listing.1833581304" name="Cross ARM GNU Create Listing" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.listing">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.421010994" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
|
||||
@@ -784,7 +819,7 @@
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.926371065" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1328296477" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.1500121997" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="true" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.1664475593" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M04GBG" valueType="string"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.1664475593" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M08GBG" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.75533497" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.349814325" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.family.2115333421" name="Arm family (-mcpu)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-r52" valueType="enumerated"/>
|
||||
@@ -807,6 +842,7 @@
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.305259748" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include.1749182888" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||
@@ -837,6 +873,20 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value="".""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.456671311" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||
</tool>
|
||||
@@ -845,6 +895,7 @@
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.856881917" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
|
||||
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include.1411892430" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/generate""/>
|
||||
@@ -877,6 +928,20 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value="".""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.179835817" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||
</tool>
|
||||
@@ -889,11 +954,12 @@
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano.2140522055" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint.2072792159" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript.1599876065" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""fsp_ram_execution.ld""/>
|
||||
<listOptionValue builtIn="false" value=""fsp_xspi0_boot.ld""/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath.1202803303" name="User defined archive search directories (-L)" superClass="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/script""/>
|
||||
</option>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano.885232888" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||
<inputType id="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c.899703779" superClass="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinputdependency" paths="$(LIBRARY_GENERATOR_OUTPUTTYPE_OUTPUTS)"/>
|
||||
@@ -906,8 +972,9 @@
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano.1225392189" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint.827697822" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript.963403495" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""fsp_ram_execution.ld""/>
|
||||
<listOptionValue builtIn="false" value=""fsp_xspi0_boot.ld""/>
|
||||
</option>
|
||||
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano.1785719899" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano" value="true" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver.1356408537" name="Cross ARM GNU Archiver" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver"/>
|
||||
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.flash.1736780445" name="Cross ARM GNU Create Flash Image" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.flash">
|
||||
|
@@ -1,243 +0,0 @@
|
||||
/*
|
||||
Linker File for Renesas RZ/N2L FSP
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ATCM : ORIGIN = 0x00000000, LENGTH = 0x00020000
|
||||
BTCM : ORIGIN = 0x00100000, LENGTH = 0x00020000
|
||||
SYSTEM_RAM : ORIGIN = 0x10000000, LENGTH = 0x00180000
|
||||
SYSTEM_RAM_MIRROR : ORIGIN = 0x30000000, LENGTH = 0x00180000
|
||||
xSPI0_CS0_SPACE_MIRROR : ORIGIN = 0x40000000, LENGTH = 0x04000000
|
||||
xSPI0_CS1_SPACE_MIRROR : ORIGIN = 0x44000000, LENGTH = 0x04000000
|
||||
xSPI1_CS0_SPACE_MIRROR : ORIGIN = 0x48000000, LENGTH = 0x04000000
|
||||
xSPI1_CS1_SPACE_MIRROR : ORIGIN = 0x4C000000, LENGTH = 0x04000000
|
||||
CS0_SPACE_MIRROR : ORIGIN = 0x50000000, LENGTH = 0x04000000
|
||||
CS2_SPACE_MIRROR : ORIGIN = 0x54000000, LENGTH = 0x04000000
|
||||
CS3_SPACE_MIRROR : ORIGIN = 0x58000000, LENGTH = 0x04000000
|
||||
CS5_SPACE_MIRROR : ORIGIN = 0x5C000000, LENGTH = 0x04000000
|
||||
xSPI0_CS0_SPACE : ORIGIN = 0x60000000, LENGTH = 0x04000000
|
||||
xSPI0_CS1_SPACE : ORIGIN = 0x64000000, LENGTH = 0x04000000
|
||||
xSPI1_CS0_SPACE : ORIGIN = 0x68000000, LENGTH = 0x04000000
|
||||
xSPI1_CS1_SPACE : ORIGIN = 0x6C000000, LENGTH = 0x04000000
|
||||
CS0_SPACE : ORIGIN = 0x70000000, LENGTH = 0x04000000
|
||||
CS2_SPACE : ORIGIN = 0x74000000, LENGTH = 0x04000000
|
||||
CS3_SPACE : ORIGIN = 0x78000000, LENGTH = 0x04000000
|
||||
CS5_SPACE : ORIGIN = 0x7C000000, LENGTH = 0x04000000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.loader_text 0x00102000 : AT (0x00102000)
|
||||
{
|
||||
*(.loader_text)
|
||||
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(.text*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_clocks.o(.text*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_irq.o(.text*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.text*)
|
||||
*/fsp/src/r_ioport/r_ioport.o(.text*)
|
||||
KEEP(*(.warm_start))
|
||||
} > BTCM
|
||||
.loader_data :
|
||||
{
|
||||
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(.data*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_clocks.o(.data*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_irq.o(.data*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.data*)
|
||||
*/fsp/src/r_ioport/r_ioport.o(.data*)
|
||||
__loader_bss_start = .;
|
||||
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(.bss*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_clocks.o(.bss*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_irq.o(.bss*)
|
||||
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.bss*)
|
||||
*/fsp/src/r_ioport/r_ioport.o(.bss*)
|
||||
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(COMMON)
|
||||
*/fsp/src/bsp/mcu/all/bsp_clocks.o(COMMON)
|
||||
*/fsp/src/bsp/mcu/all/bsp_irq.o(COMMON)
|
||||
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.COMMON)
|
||||
*/fsp/src/r_ioport/r_ioport.o(.COMMON)
|
||||
__loader_bss_end = . ;
|
||||
} > BTCM
|
||||
.intvec 0x00000000 : AT (0x00000000)
|
||||
{
|
||||
_fvector_start = .;
|
||||
KEEP(*(.intvec))
|
||||
_fvector_end = .;
|
||||
} > ATCM
|
||||
.text 0x30000000 : AT (0x30000000)
|
||||
{
|
||||
_text_start = .;
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
_ctor_end = .;
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
_dtor_end = .;
|
||||
|
||||
*(.rodata*)
|
||||
_erodata = .;
|
||||
KEEP(*(.eh_frame*))
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.rvectors :
|
||||
{
|
||||
_rvectors_start = .;
|
||||
KEEP(*(.rvectors))
|
||||
_rvectors_end = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
__exidx_end = .;
|
||||
.got :
|
||||
{
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
_text_end = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.data :
|
||||
{
|
||||
_data_start = .;
|
||||
|
||||
*(vtable)
|
||||
*(.data.*)
|
||||
*(.data)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
/* All data end */
|
||||
_data_end = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
_bss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
_ebss = .;
|
||||
_end = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.heap (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__HeapBase = .;
|
||||
/* Place the STD heap here. */
|
||||
KEEP(*(.heap))
|
||||
__HeapLimit = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.thread_stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__ThreadStackBase = .;
|
||||
/* Place the Thread stacks here. */
|
||||
KEEP(*(.stack*))
|
||||
__ThreadStackLimit = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.sys_stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__SysStackBase = .;
|
||||
/* Place the sys_stack here. */
|
||||
KEEP(*(.sys_stack))
|
||||
__SysStackLimit = .;
|
||||
} > BTCM
|
||||
.svc_stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__SvcStackBase = .;
|
||||
/* Place the svc_stack here. */
|
||||
KEEP(*(.svc_stack))
|
||||
__SvcStackLimit = .;
|
||||
} > BTCM
|
||||
.irq_stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__IrqStackBase = .;
|
||||
/* Place the irq_stack here. */
|
||||
KEEP(*(.irq_stack))
|
||||
__IrqStackLimit = .;
|
||||
} > BTCM
|
||||
.fiq_stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__FiqStackBase = .;
|
||||
/* Place the fiq_stack here. */
|
||||
KEEP(*(.fiq_stack))
|
||||
__FiqStackLimit = .;
|
||||
} > BTCM
|
||||
.und_stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__UndStackBase = .;
|
||||
/* Place the und_stack here. */
|
||||
KEEP(*(.und_stack))
|
||||
__UndStackLimit = .;
|
||||
} > BTCM
|
||||
.abt_stack (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__AbtStackBase = .;
|
||||
/* Place the abt_stack here. */
|
||||
KEEP(*(.abt_stack))
|
||||
__AbtStackLimit = .;
|
||||
} > BTCM
|
||||
.shared_noncache_buffer 0x300C0000 : AT (0x300C0000)
|
||||
{
|
||||
. = ALIGN(32);
|
||||
_sncbuffer_start = .;
|
||||
KEEP(*(.shared_noncache_buffer*))
|
||||
_sncbuffer_end = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
.noncache_buffer 0x30100000 : AT (0x30100000)
|
||||
{
|
||||
. = ALIGN(32);
|
||||
_ncbuffer_start = .;
|
||||
KEEP(*(.noncache_buffer*))
|
||||
_ncbuffer_end = .;
|
||||
} > SYSTEM_RAM_MIRROR
|
||||
}
|
||||
|
54
IDE/Renesas/e2studio/RZN2L/test/src/local_system_init.c
Normal file
54
IDE/Renesas/e2studio/RZN2L/test/src/local_system_init.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/* local_system_init.c
|
||||
*
|
||||
* Custom configuration for wolfCrypt/wolfSSL.
|
||||
* Enabled via WOLFSSL_USER_SETTINGS.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2024 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfBoot.
|
||||
*
|
||||
* wolfBoot is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#include "bsp_api.h"
|
||||
|
||||
void local_system_init (void);
|
||||
|
||||
BSP_TARGET_ARM void local_system_init (void)
|
||||
{
|
||||
#if 1
|
||||
/* This software loops are only needed when debugging. */
|
||||
__asm volatile (
|
||||
" mov r0, #0 \n"
|
||||
" movw r1, #0xf07f \n"
|
||||
" movt r1, #0x2fa \n"
|
||||
"software_loop: \n"
|
||||
" adds r0, #1 \n"
|
||||
" cmp r0, r1 \n"
|
||||
" bne software_loop \n"
|
||||
::: "memory");
|
||||
#endif
|
||||
__asm volatile (
|
||||
"set_vbar: \n"
|
||||
" LDR r0, =__Vectors \n"
|
||||
" MCR p15, #0, r0, c12, c0, #0 \n" /* Write r0 to VBAR */
|
||||
::: "memory");
|
||||
|
||||
__asm volatile (
|
||||
"jump_stack_init: \n"
|
||||
" ldr r0, =stack_init \n"
|
||||
" blx r0 \n" /* Jump to stack_init */
|
||||
);
|
||||
}
|
@@ -20,13 +20,10 @@
|
||||
*/
|
||||
#include "rzn2l_tst_thread.h"
|
||||
|
||||
#include "um_common_cfg.h"
|
||||
#include "um_common_api.h"
|
||||
#include "um_serial_io_api.h"
|
||||
#include "um_serial_io.h"
|
||||
|
||||
#include "wolfssl_demo.h"
|
||||
#include "user_settings.h"
|
||||
#include "sio_char.h"
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
@@ -34,23 +31,20 @@ typedef struct func_args {
|
||||
int return_code;
|
||||
} func_args;
|
||||
|
||||
static serial_io_instance_ctrl_t g_serial_io0_ctrl;
|
||||
static serial_io_cfg_t const g_serial_io0_cfg =
|
||||
{
|
||||
.p_uart_instance = &g_uart0,
|
||||
};
|
||||
serial_io_instance_t const g_serial_io0 =
|
||||
{
|
||||
.p_ctrl = &g_serial_io0_ctrl,
|
||||
.p_cfg = &g_serial_io0_cfg,
|
||||
.p_api = &g_serial_io_on_serial_io,
|
||||
};
|
||||
|
||||
FSP_CPP_HEADER
|
||||
void R_BSP_WarmStart(bsp_warm_start_event_t event)
|
||||
BSP_PLACE_IN_SECTION(".warm_start");
|
||||
FSP_CPP_FOOTER
|
||||
|
||||
void user_uart_callback (uart_callback_args_t * p_args);
|
||||
void Clr_CallbackCtx(FSPSM_ST *g);
|
||||
void RSIP_KeyGeneration(FSPSM_ST *g);
|
||||
|
||||
uint32_t volatile g_tx_complete = 0;
|
||||
uint32_t volatile g_rx_complete = 0;
|
||||
uint32_t g_ofband_index = 0;
|
||||
uint8_t g_ofband_received[TRANSFER_LENGTH];
|
||||
|
||||
void R_BSP_WarmStart(bsp_warm_start_event_t event)
|
||||
{
|
||||
if (BSP_WARM_START_RESET == event) {
|
||||
@@ -61,8 +55,47 @@ void R_BSP_WarmStart(bsp_warm_start_event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TLS_CLIENT) || \
|
||||
defined(TLS_SERVER)
|
||||
void user_uart_callback (uart_callback_args_t* p_args)
|
||||
{
|
||||
/* Handle the UART event */
|
||||
switch (p_args->event)
|
||||
{
|
||||
/* Received a character */
|
||||
case UART_EVENT_RX_CHAR:
|
||||
/* Only put the next character in the receive
|
||||
* buffer if there is space for it
|
||||
*/
|
||||
if (sizeof(g_ofband_received) > g_ofband_index)
|
||||
{
|
||||
/* Write either the next one or two bytes
|
||||
* depending on the receive data size
|
||||
*/
|
||||
if ((UART_DATA_BITS_7 == g_uart0_cfg.data_bits) ||
|
||||
(UART_DATA_BITS_8 == g_uart0_cfg.data_bits))
|
||||
{
|
||||
g_ofband_received[g_ofband_index++] =
|
||||
(uint8_t) p_args->data;
|
||||
} else {
|
||||
uint16_t * p_dest =
|
||||
(uint16_t *)&g_ofband_received[g_ofband_index];
|
||||
*p_dest = (uint16_t) p_args->data;
|
||||
g_ofband_index += 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* Receive complete */
|
||||
case UART_EVENT_RX_COMPLETE:
|
||||
g_rx_complete = 1;
|
||||
break;
|
||||
/* Transmit complete */
|
||||
case UART_EVENT_TX_COMPLETE:
|
||||
g_tx_complete = 1;
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TLS_CLIENT) || defined(TLS_SERVER)
|
||||
extern uint8_t g_ether0_mac_address[6];
|
||||
const byte ucIPAddress[4] = { 192, 168, 11, 241 };
|
||||
const byte ucNetMask[4] = { 255, 255, 255, 0 };
|
||||
@@ -82,9 +115,6 @@ void R_BSP_WarmStart(bsp_warm_start_event_t event)
|
||||
FSPSM_ST guser_PKCbInfo;
|
||||
#endif
|
||||
|
||||
void Clr_CallbackCtx(FSPSM_ST *g);
|
||||
void RSIP_KeyGeneration(FSPSM_ST *g);
|
||||
|
||||
void RSIP_KeyGeneration(FSPSM_ST *g)
|
||||
{
|
||||
fsp_err_t rsip_error_code = FSP_SUCCESS;
|
||||
@@ -201,39 +231,16 @@ void wolfSSL_TLS_cleanup()
|
||||
|
||||
#endif
|
||||
|
||||
serial_io_instance_t const * gp_serial_io0 = &g_serial_io0;
|
||||
static void serial_init()
|
||||
{
|
||||
usr_err_t usr_err;
|
||||
|
||||
/** Open Serial I/O module. */
|
||||
usr_err = gp_serial_io0->p_api->open
|
||||
(gp_serial_io0->p_ctrl, gp_serial_io0->p_cfg );
|
||||
if( USR_SUCCESS != usr_err )
|
||||
{
|
||||
USR_DEBUG_BLOCK_CPU();
|
||||
}
|
||||
|
||||
/** Start Serial I/O module. */
|
||||
usr_err = gp_serial_io0->p_api->start( gp_serial_io0->p_ctrl );
|
||||
if( USR_SUCCESS != usr_err )
|
||||
{
|
||||
USR_DEBUG_BLOCK_CPU();
|
||||
}
|
||||
printf( " Started Serial I/O interface." );
|
||||
}
|
||||
|
||||
/* rzn2l_tst_thread entry function */
|
||||
/* pvParameters contains TaskHandle_t */
|
||||
void rzn2l_tst_thread_entry(void *pvParameters)
|
||||
{
|
||||
FSP_PARAMETER_NOT_USED (pvParameters);
|
||||
|
||||
|
||||
serial_init();
|
||||
/* Open the transfer instance with initial configuration. */
|
||||
R_SCI_UART_Open(&g_uart0_ctrl, &g_uart0_cfg);
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
|
||||
int ret;
|
||||
|
||||
printf("\n");
|
||||
@@ -368,8 +375,7 @@ void rzn2l_tst_thread_entry(void *pvParameters)
|
||||
TCPInit();
|
||||
|
||||
int TCP_connect_retry = 0;
|
||||
|
||||
printf("\n Start TLS Connection to %s port(%d)\n", SERVER_IP, DEFAULT_PORT);
|
||||
printf("Start TLS Connection to %s port(%d)\n", SERVER_IP, DEFAULT_PORT);
|
||||
wolfSSL_TLS_client_init();
|
||||
|
||||
do {
|
||||
@@ -403,7 +409,7 @@ void rzn2l_tst_thread_entry(void *pvParameters)
|
||||
|
||||
int TCP_connect_retry = 0;
|
||||
|
||||
printf("\n Start TLS Accept at %03d.%03d.%03d.%03d port(%d)\n",
|
||||
printf("Start TLS Accept at %03d.%03d.%03d.%03d port(%d)\n",
|
||||
ucIPAddress[0],
|
||||
ucIPAddress[1],
|
||||
ucIPAddress[2],
|
||||
|
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
83
IDE/Renesas/e2studio/RZN2L/test/src/serial_io/app_print.c
Normal file
83
IDE/Renesas/e2studio/RZN2L/test/src/serial_io/app_print.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/* app_print.c
|
||||
*
|
||||
* Copyright (C) 2006-2025 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "hal_data.h"
|
||||
|
||||
static char g_uart_buf[256]; ///< uart tx buffer
|
||||
extern volatile uint32_t g_tx_complete;
|
||||
void uart_printf( const char *format, ... );
|
||||
|
||||
void uart_printf( const char *format, ... )
|
||||
{
|
||||
va_list va;
|
||||
uint32_t bytes;
|
||||
uint32_t offset, len, skip;
|
||||
char chara;
|
||||
const char ch = '\r';
|
||||
char* p;
|
||||
|
||||
va_start( va, format );
|
||||
bytes = (uint32_t)vsprintf(g_uart_buf, format, va);
|
||||
va_end( va );
|
||||
|
||||
if (bytes > 0) {
|
||||
p = &g_uart_buf[0];
|
||||
offset = 0;
|
||||
skip = 0;
|
||||
|
||||
do {
|
||||
len = 0;
|
||||
skip = 0;
|
||||
for (;offset < bytes; offset++, len++) {
|
||||
chara = g_uart_buf[offset];
|
||||
if ('\n' == chara) {
|
||||
skip = 1;
|
||||
len += 1;
|
||||
break;
|
||||
}
|
||||
if ('\r' == chara && (offset + 1) < bytes &&
|
||||
'\n' == g_uart_buf[offset + 1]){
|
||||
skip = 2;
|
||||
len += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* write buffer without LF */
|
||||
R_SCI_UART_Write(&g_uart0_ctrl, (uint8_t*)p, len);
|
||||
while(!g_tx_complete);
|
||||
g_tx_complete = 0;
|
||||
if (skip > 0) {
|
||||
R_SCI_UART_Write(&g_uart0_ctrl, (uint8_t*)&ch, 1);
|
||||
while(!g_tx_complete);
|
||||
}
|
||||
p += (len + skip);
|
||||
offset += skip;
|
||||
} while(offset < bytes);
|
||||
}
|
||||
|
||||
|
||||
g_tx_complete = 0;
|
||||
}
|
@@ -37,7 +37,6 @@
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
extern FSPSM_INSTANCE gFSPSM_ctrl;
|
||||
int devId1 = INVALID_DEVID;
|
||||
|
||||
#ifndef NO_SHA
|
||||
int sha_test();
|
||||
@@ -74,14 +73,14 @@ static byte Aes256_Cbc_multTst_rslt = 0;
|
||||
static byte Aes128_Gcm_multTst_rslt = 0;
|
||||
static byte Aes256_Gcm_multTst_rslt = 0;
|
||||
|
||||
int rsip_crypt_AesCbc_multitest();
|
||||
int rsip_crypt_AesGcm_multitest();
|
||||
int rsip_crypt_Sha_AesCbcGcm_multitest();
|
||||
int rsip_crypt_AesCbc_multitest(int devId);
|
||||
int rsip_crypt_AesGcm_multitest(int devId);
|
||||
int rsip_crypt_Sha_AesCbcGcm_multitest(int devId);
|
||||
int rsip_crypt_sha_multitest();
|
||||
int rsip_crypt_test();
|
||||
|
||||
void Clr_CallbackCtx(FSPSM_ST *g);
|
||||
|
||||
void RSIP_KeyGeneration(FSPSM_ST *g);
|
||||
FSPSM_ST gCbInfo;
|
||||
FSPSM_ST gCbInfo_a; /* for multi testing */
|
||||
|
||||
@@ -124,12 +123,13 @@ FSPSM_ST gCbInfo_a; /* for multi testing */
|
||||
#endif
|
||||
typedef struct tagInfo
|
||||
{
|
||||
int devId;
|
||||
FSPSM_AES_PWKEY aes_key;
|
||||
} Info;
|
||||
|
||||
#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
|
||||
|
||||
static int rsip_aes128_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
static int rsip_aes128_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key, int devId)
|
||||
{
|
||||
|
||||
Aes aes[1];
|
||||
@@ -154,7 +154,7 @@ static int rsip_aes128_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
printf(" rsip_aes_cbc_test() ");
|
||||
}
|
||||
|
||||
ret = wc_AesInit(aes, NULL, devId1);
|
||||
ret = wc_AesInit(aes, NULL, devId);
|
||||
if (ret == 0) {
|
||||
ret = wc_AesSetKey(aes, (byte*)aes_key, keySz,
|
||||
iv, AES_ENCRYPTION);
|
||||
@@ -169,7 +169,7 @@ static int rsip_aes128_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
ret = -1;
|
||||
|
||||
#ifdef HAVE_AES_DECRYPT
|
||||
ret = wc_AesInit(aes, NULL, devId1);
|
||||
ret = wc_AesInit(aes, NULL, devId);
|
||||
if (ret == 0) {
|
||||
ret = wc_AesSetKey(aes, (byte*)aes_key, keySz,
|
||||
iv, AES_DECRYPTION);
|
||||
@@ -199,7 +199,7 @@ static void tskAes128_Cbc_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = rsip_aes128_cbc_test(0, p->aes_key);
|
||||
ret = rsip_aes128_cbc_test(0, p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). rsip_aes_cbc_test\n", ret);
|
||||
@@ -214,7 +214,7 @@ static void tskAes128_Cbc_Test(void *pvParam)
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_AES_256
|
||||
static int rsip_aes256_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
static int rsip_aes256_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
byte cipher[WC_AES_BLOCK_SIZE];
|
||||
@@ -237,12 +237,12 @@ static int rsip_aes256_cbc_test(int prnt, FSPSM_AES_PWKEY aes_key)
|
||||
if (prnt)
|
||||
printf(" rsip_aes256_test() ");
|
||||
|
||||
if (wc_AesInit(enc, NULL, devId1) != 0) {
|
||||
if (wc_AesInit(enc, NULL, devId) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (wc_AesInit(dec, NULL, devId1) != 0){
|
||||
if (wc_AesInit(dec, NULL, devId) != 0){
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ static void tskAes256_Cbc_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = rsip_aes256_cbc_test(0, p->aes_key);
|
||||
ret = rsip_aes256_cbc_test(0, p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). rsip_aes256_test\n", ret);
|
||||
@@ -313,7 +313,7 @@ static void tskAes256_Cbc_Test(void *pvParam)
|
||||
#endif /* WOLFSSL_AES_256 */
|
||||
|
||||
#if defined(WOLFSSL_AES_256)
|
||||
static int rsip_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key)
|
||||
static int rsip_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
Aes dec[1];
|
||||
@@ -384,11 +384,11 @@ static int rsip_aesgcm256_test(int prnt, FSPSM_AES_PWKEY aes256_key)
|
||||
XMEMSET(resultP, 0, sizeof(resultP));
|
||||
XMEMSET(&userContext, 0, sizeof(FSPSM_ST));
|
||||
|
||||
if (wc_AesInit(enc, NULL, devId1) != 0) {
|
||||
if (wc_AesInit(enc, NULL, devId) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
if (wc_AesInit(dec, NULL, devId1) != 0) {
|
||||
if (wc_AesInit(dec, NULL, devId) != 0) {
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
@@ -478,7 +478,7 @@ static void tskAes256_Gcm_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = rsip_aesgcm256_test(0, p->aes_key);
|
||||
ret = rsip_aesgcm256_test(0, p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). rsip_aesgcm256_test\n", ret);
|
||||
@@ -493,7 +493,7 @@ static void tskAes256_Gcm_Test(void *pvParam)
|
||||
|
||||
#if defined(WOLFSSL_AES_128)
|
||||
|
||||
static int rsip_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key)
|
||||
static int rsip_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
Aes dec[1];
|
||||
@@ -570,12 +570,12 @@ static int rsip_aesgcm128_test(int prnt, FSPSM_AES_PWKEY aes128_key)
|
||||
XMEMSET(resultP, 0, sizeof(resultP));
|
||||
XMEMSET(&userContext, 0, sizeof(FSPSM_ST));
|
||||
|
||||
if (wc_AesInit(enc, NULL, devId1) != 0) {
|
||||
if (wc_AesInit(enc, NULL, devId) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (wc_AesInit(dec, NULL, devId1) != 0) {
|
||||
if (wc_AesInit(dec, NULL, devId) != 0) {
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ static void tskAes128_Gcm_Test(void *pvParam)
|
||||
Info *p = (Info*)pvParam;
|
||||
|
||||
while (exit_loop == 0) {
|
||||
ret = rsip_aesgcm128_test(0, p->aes_key);
|
||||
ret = rsip_aesgcm128_test(0, p->aes_key, p->devId);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
if (ret != 0) {
|
||||
printf(" result was not good(%d). rsip_aesgcm128_test\n", ret);
|
||||
@@ -646,7 +646,7 @@ static void tskAes128_Gcm_Test(void *pvParam)
|
||||
#define TEST_STRING_SZ 25
|
||||
#define RSA_TEST_BYTES 256 /* up to 2048-bit key */
|
||||
|
||||
static int rsip_rsa_test(int prnt, int keySize)
|
||||
static int rsip_rsa_test(int prnt, int keySize, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -656,7 +656,6 @@ static int rsip_rsa_test(int prnt, int keySize)
|
||||
const char inStr2[] = TEST_STRING2;
|
||||
const word32 inLen = (word32)TEST_STRING_SZ;
|
||||
const word32 outSz = RSA_TEST_BYTES;
|
||||
word32 out_actual_len = 0;
|
||||
byte *in = NULL;
|
||||
byte *in2 = NULL;
|
||||
byte *out= NULL;
|
||||
@@ -680,7 +679,7 @@ static int rsip_rsa_test(int prnt, int keySize)
|
||||
XMEMSET(out, 0, outSz);
|
||||
XMEMSET(out2, 0, outSz);
|
||||
|
||||
ret = wc_InitRsaKey_ex(key, NULL, 7890/* fixed devid for TSIP/SCE*/);
|
||||
ret = wc_InitRsaKey_ex(key, NULL, devId);
|
||||
if (ret != 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -727,13 +726,12 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rsip_rsa_SignVerify_test(int prnt, int keySize)
|
||||
static int rsip_rsa_SignVerify_test(int prnt, int keySize, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
RsaKey *key = (RsaKey *)XMALLOC(sizeof *key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
WC_RNG rng;
|
||||
word32 sigSz;
|
||||
const char inStr [] = TEST_STRING;
|
||||
const char inStr2[] = TEST_STRING2;
|
||||
const word32 inLen = (word32)TEST_STRING_SZ;
|
||||
@@ -760,7 +758,7 @@ static int rsip_rsa_SignVerify_test(int prnt, int keySize)
|
||||
XMEMCPY(in, inStr, inLen);
|
||||
XMEMCPY(in2, inStr2, inLen);
|
||||
|
||||
ret = wc_InitRsaKey_ex(key, NULL, 7890/* fixed devid for TSIP/SCE*/);
|
||||
ret = wc_InitRsaKey_ex(key, NULL, devId);
|
||||
if (ret != 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -781,7 +779,7 @@ static int rsip_rsa_SignVerify_test(int prnt, int keySize)
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
sigSz = (word32)ret;
|
||||
|
||||
//* this should fail */
|
||||
ret = wc_RsaSSL_Verify(in2, inLen, out, (word32)(keySize/8), key);
|
||||
if (ret != FSP_ERR_CRYPTO_RSIP_FAIL) {
|
||||
@@ -902,7 +900,7 @@ int rsip_crypt_sha256_multitest()
|
||||
}
|
||||
|
||||
|
||||
int rsip_crypt_AesCbc_multitest()
|
||||
int rsip_crypt_AesCbc_multitest(int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
int num = 0;
|
||||
@@ -925,7 +923,10 @@ int rsip_crypt_AesCbc_multitest()
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
|
||||
info_aes1.devId = devId;
|
||||
info_aes2.devId = devId;
|
||||
info_aes256_1.devId = devId;
|
||||
info_aes256_2.devId = devId;
|
||||
#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
|
||||
XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1,
|
||||
sizeof(FSPSM_AES_PWKEY));
|
||||
@@ -983,7 +984,7 @@ int rsip_crypt_AesCbc_multitest()
|
||||
}
|
||||
|
||||
|
||||
int rsip_crypt_AesGcm_multitest()
|
||||
int rsip_crypt_AesGcm_multitest(int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
int num = 0;
|
||||
@@ -1007,7 +1008,10 @@ int rsip_crypt_AesGcm_multitest()
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
|
||||
info_aes1.devId = devId;
|
||||
info_aes2.devId = devId;
|
||||
info_aes256_1.devId = devId;
|
||||
info_aes256_2.devId = devId;
|
||||
#if defined(WOLFSSL_AES_128)
|
||||
XMEMCPY(&info_aes1.aes_key, &g_user_aes128_key_index1,
|
||||
sizeof(FSPSM_AES_PWKEY));
|
||||
@@ -1066,7 +1070,7 @@ int rsip_crypt_AesGcm_multitest()
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rsip_crypt_Sha_AesCbcGcm_multitest()
|
||||
int rsip_crypt_Sha_AesCbcGcm_multitest(int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
int num = 0;
|
||||
@@ -1098,7 +1102,10 @@ int rsip_crypt_Sha_AesCbcGcm_multitest()
|
||||
|
||||
exit_semaph = xSemaphoreCreateCounting((UBaseType_t)num, 0);
|
||||
xRet = pdPASS;
|
||||
|
||||
info_aes128cbc.devId = devId;
|
||||
info_aes128gcm.devId = devId;
|
||||
info_aes256cbc.devId = devId;
|
||||
info_aes256gcm.devId = devId;
|
||||
#ifndef NO_SHA256
|
||||
xRet = xTaskCreate(tskSha256_Test1, "sha256_test1",
|
||||
STACK_SIZE, NULL, 3, NULL);
|
||||
@@ -1174,12 +1181,13 @@ int rsip_crypt_Sha_AesCbcGcm_multitest()
|
||||
int rsip_crypt_test()
|
||||
{
|
||||
int ret = 0;
|
||||
int devId = INVALID_DEVID;
|
||||
fsp_err_t rsip_error_code = FSP_SUCCESS;
|
||||
|
||||
/* Generate AES sce Key */
|
||||
|
||||
if (rsip_error_code == FSP_SUCCESS) {
|
||||
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
|
||||
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
|
||||
/* set up Crypt Call back */
|
||||
Clr_CallbackCtx(&gCbInfo);
|
||||
Clr_CallbackCtx(&gCbInfo_a);
|
||||
@@ -1204,43 +1212,54 @@ int rsip_crypt_test()
|
||||
ret = wc_CryptoCb_CryptInitRenesasCmn(NULL, &gCbInfo);
|
||||
|
||||
if ( ret > 0) {
|
||||
devId1 = ret;
|
||||
devId = ret;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
#if RSA_MIN_SIZE < 1024
|
||||
if (ret == 0) {
|
||||
printf(" rsip_rsa_test(512)(this will be done"
|
||||
" by SW because RSIP doesn't support 512 bits key size.)");
|
||||
ret = rsip_rsa_test(1, 512);
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 0;
|
||||
ret = rsip_rsa_test(1, 512, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
#endif
|
||||
#if RSA_MIN_SIZE <= 1024
|
||||
if (ret == 0) {
|
||||
printf(" rsip_rsa_test(1024)");
|
||||
ret = rsip_rsa_test(1, 1024);
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 1;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 1;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 0;
|
||||
ret = rsip_rsa_test(1, 1024, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
printf(" rsip_rsa_test(2048)");
|
||||
ret = rsip_rsa_test(1, 2048);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
gCbInfo.hash_type = RSIP_HASH_TYPE_SHA256 ;
|
||||
printf(" rsip_rsa_SignVerify_test(1024)");
|
||||
ret = rsip_rsa_SignVerify_test(1, 1024);
|
||||
ret = rsip_rsa_SignVerify_test(1, 1024, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
printf(" rsip_rsa_test(2048)");
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 0;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 1;
|
||||
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 1;
|
||||
ret = rsip_rsa_test(1, 2048, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
if (ret == 0 && rsip_error_code == FSP_SUCCESS) {
|
||||
printf(" rsip_rsa_SignVerify_test(2048)");
|
||||
ret = rsip_rsa_SignVerify_test(1, 2048);
|
||||
ret = rsip_rsa_SignVerify_test(1, 2048, devId);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_RENESAS_RSIP_CRYPTONLY */
|
||||
#endif /* WOLFSSL_RENESAS_RSIP_CRYPTONLY */
|
||||
|
||||
#ifndef NO_SHA256
|
||||
printf(" sha256_test()");
|
||||
@@ -1263,18 +1282,18 @@ int rsip_crypt_test()
|
||||
RESULT_STR(ret)
|
||||
#endif
|
||||
|
||||
ret = rsip_aes128_cbc_test(1, g_user_aes128_key_index1);
|
||||
ret = rsip_aes128_cbc_test(1, g_user_aes128_key_index1, devId);
|
||||
|
||||
if (ret == 0) {
|
||||
ret = rsip_aes256_cbc_test(1, g_user_aes256_key_index1);
|
||||
ret = rsip_aes256_cbc_test(1, g_user_aes256_key_index1, devId);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = rsip_aesgcm128_test(1, g_user_aes128_key_index1);
|
||||
ret = rsip_aesgcm128_test(1, g_user_aes128_key_index1, devId);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = rsip_aesgcm256_test(1, g_user_aes256_key_index1);
|
||||
ret = rsip_aesgcm256_test(1, g_user_aes256_key_index1, devId);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
@@ -1284,20 +1303,25 @@ int rsip_crypt_test()
|
||||
|
||||
if (ret == 0) {
|
||||
printf(" multi Aes cbc thread test\n");
|
||||
ret = rsip_crypt_AesCbc_multitest();
|
||||
ret = rsip_crypt_AesCbc_multitest(devId);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
printf(" multi Aes Gcm thread test\n");
|
||||
ret = rsip_crypt_AesGcm_multitest();
|
||||
ret = rsip_crypt_AesGcm_multitest(devId);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
printf("rsip_crypt_Sha_AesCbcGcm_multitest\n");
|
||||
ret = rsip_crypt_Sha_AesCbcGcm_multitest();
|
||||
printf(" multi Sha AesCbcGcm thread test\n");
|
||||
ret = rsip_crypt_Sha_AesCbcGcm_multitest(devId);
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
|
||||
/*
|
||||
* Need to be cleaned up before context clear
|
||||
* for internal instance
|
||||
*/
|
||||
wc_CryptoCb_CleanupRenesasCmn(&devId);
|
||||
Clr_CallbackCtx(&gCbInfo);
|
||||
Clr_CallbackCtx(&gCbInfo_a);
|
||||
#endif
|
||||
|
@@ -21,13 +21,30 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/wc_port.h>
|
||||
|
||||
#define YEAR 2023
|
||||
#define MON 9
|
||||
|
||||
static int tick = 0;
|
||||
|
||||
#define YEAR ( \
|
||||
((__DATE__)[7] - '0') * 1000 + \
|
||||
((__DATE__)[8] - '0') * 100 + \
|
||||
((__DATE__)[9] - '0') * 10 + \
|
||||
((__DATE__)[10] - '0') * 1 \
|
||||
)
|
||||
|
||||
#define MONTH ( \
|
||||
__DATE__[2] == 'n' ? (__DATE__[1] == 'a' ? 1 : 6) \
|
||||
: __DATE__[2] == 'b' ? 2 \
|
||||
: __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 3 : 4) \
|
||||
: __DATE__[2] == 'y' ? 5 \
|
||||
: __DATE__[2] == 'l' ? 7 \
|
||||
: __DATE__[2] == 'g' ? 8 \
|
||||
: __DATE__[2] == 'p' ? 9 \
|
||||
: __DATE__[2] == 't' ? 10 \
|
||||
: __DATE__[2] == 'v' ? 11 \
|
||||
: 12 \
|
||||
)
|
||||
|
||||
time_t time(time_t *t)
|
||||
{
|
||||
(void)t;
|
||||
return ((YEAR-1970)*365+30*MON)*24*60*60 + tick++;
|
||||
return ((YEAR-1970)*365+30*MONTH)*24*60*60 + tick++;
|
||||
}
|
||||
|
@@ -44,16 +44,21 @@
|
||||
#define cmn_hw_lock tsip_hw_lock
|
||||
#define cmn_hw_unlock tsip_hw_unlock
|
||||
|
||||
#define FSPSM_ST TsipUserCtx;
|
||||
#define MAX_FSPSM_CBINDEX 5
|
||||
#define FSPSM_ST TsipUserCtx
|
||||
#define FSPSM_ST_Internal TsipUserCtx_Internal
|
||||
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/wc_port.h>
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#include <wolfssl/wolfcrypt/asn.h>
|
||||
#ifndef WOLFSSL_RENESAS_TSIP_CRYPTONLY
|
||||
#include <wolfssl/internal.h>
|
||||
#ifdef NO_INLINE
|
||||
#include <wolfssl/wolfcrypt/misc.h>
|
||||
#else
|
||||
#define WOLFSSL_MISC_INCLUDED
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
#include <wolfssl/internal.h>
|
||||
#include <wolfssl/error-ssl.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
@@ -65,16 +70,9 @@ uint32_t g_CAscm_Idx = (uint32_t)-1; /* index of CM table */
|
||||
static int gdevId = INITIAL_DEVID; /* initial dev Id for Crypt Callback */
|
||||
|
||||
#ifdef WOLF_CRYPTO_CB
|
||||
/* store callback ctx by devId */
|
||||
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
|
||||
|
||||
#define MAX_FSPSM_CBINDEX 5
|
||||
FSPSM_ST *gCbCtx[MAX_FSPSM_CBINDEX];
|
||||
#elif defined(WOLFSSL_RENESAS_TSIP_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
|
||||
#define FSPSM_ST TsipUserCtx;
|
||||
#define MAX_FSPSM_CBINDEX 5
|
||||
TsipUserCtx *gCbCtx[MAX_FSPSM_CBINDEX];
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/cryptocb.h>
|
||||
|
||||
@@ -274,8 +272,9 @@ static int Renesas_cmn_CryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
#endif /* HAVE_ECC */
|
||||
}
|
||||
|
||||
#elif defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
|
||||
#elif (defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY))\
|
||||
&& !defined(NO_WOLFSSL_RENESAS_FSPSM_AES)
|
||||
|
||||
if (info->algo_type == WC_ALGO_TYPE_CIPHER) {
|
||||
#if !defined(NO_AES)
|
||||
@@ -285,6 +284,20 @@ static int Renesas_cmn_CryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
|
||||
#if !defined(NO_RSA) && defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
|
||||
else if (info->algo_type == WC_ALGO_TYPE_PK) {
|
||||
if (info->pk.type == WC_PK_TYPE_RSA_GET_SIZE) {
|
||||
if (cbInfo->keyflgs_crypt.bits.rsapri2048_installedkey_set ||
|
||||
cbInfo->keyflgs_crypt.bits.rsapub2048_installedkey_set )
|
||||
{
|
||||
*info->pk.rsa_get_size.keySize = 256;
|
||||
ret = 0;
|
||||
} else if (
|
||||
cbInfo->keyflgs_crypt.bits.rsapri1024_installedkey_set ||
|
||||
cbInfo->keyflgs_crypt.bits.rsapub1024_installedkey_set )
|
||||
{
|
||||
*info->pk.rsa_get_size.keySize = 128;
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
#if defined(WOLFSSL_KEY_GEN)
|
||||
if (info->pk.type == WC_PK_TYPE_RSA_KEYGEN) {
|
||||
ret = wc_fspsm_MakeRsaKey(info->pk.rsakg.key,
|
||||
@@ -400,13 +413,8 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
|
||||
(void)ssl;
|
||||
(void)ctx;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_TSIP_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
|
||||
TsipUserCtx* cbInfo = (TsipUserCtx*)ctx;
|
||||
#elif defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
|
||||
FSPSM_ST* cbInfo = (FSPSM_ST*)ctx;
|
||||
#endif
|
||||
size_t internal_sz = sizeof(FSPSM_ST_Internal);
|
||||
|
||||
if (cbInfo == NULL
|
||||
#if (!defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY) && \
|
||||
@@ -418,13 +426,34 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
|
||||
WOLFSSL_MSG("Invalid devId\n");
|
||||
return INVALID_DEVID;
|
||||
}
|
||||
/* On Crypt Only mode, it is possible to call this method
|
||||
* first. On that time, internal instance has not yet been allocated.
|
||||
*/
|
||||
if (cbInfo->internal == NULL) {
|
||||
if (ssl)
|
||||
cbInfo->internal =
|
||||
(FSPSM_ST_Internal*)XMALLOC(internal_sz, ssl->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
else
|
||||
cbInfo->internal = (FSPSM_ST_Internal*)XMALLOC(internal_sz, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (cbInfo->internal == NULL) {
|
||||
return MEMORY_E;
|
||||
}
|
||||
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) ||\
|
||||
defined(WOLFSSL_RENESAS_TSIP_TLS)
|
||||
if (ssl)
|
||||
cbInfo->internal->heap = ssl->heap;
|
||||
#endif
|
||||
ForceZero(cbInfo->internal, internal_sz);
|
||||
}
|
||||
/* need exclusive control because of static variable */
|
||||
if ((cmn_hw_lock()) == 0) {
|
||||
/* sanity check for overflow */
|
||||
if (gdevId < 0) {
|
||||
gdevId = INITIAL_DEVID;
|
||||
}
|
||||
cbInfo->internal->devId = gdevId++;
|
||||
cbInfo->devId = gdevId++;
|
||||
cmn_hw_unlock();
|
||||
}
|
||||
else {
|
||||
@@ -432,7 +461,7 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
|
||||
return INVALID_DEVID;
|
||||
}
|
||||
|
||||
if (wc_CryptoCb_RegisterDevice(cbInfo->internal->devId,
|
||||
if (wc_CryptoCb_RegisterDevice(cbInfo->devId,
|
||||
Renesas_cmn_CryptoDevCb, cbInfo) < 0) {
|
||||
/* undo devId number */
|
||||
gdevId--;
|
||||
@@ -443,12 +472,12 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
|
||||
!defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY) && \
|
||||
!defined(HAVE_RENESAS_SYNC)
|
||||
if (ssl)
|
||||
wolfSSL_SetDevId(ssl, cbInfo->internal->devId);
|
||||
wolfSSL_SetDevId(ssl, cbInfo->devId);
|
||||
#endif
|
||||
|
||||
gCbCtx[cbInfo->internal->devId - INITIAL_DEVID] = (void*)cbInfo;
|
||||
gCbCtx[cbInfo->devId - INITIAL_DEVID] = (void*)cbInfo;
|
||||
|
||||
return cbInfo->internal->devId;
|
||||
return cbInfo->devId;
|
||||
}
|
||||
|
||||
/* Renesas Security Library Common Method
|
||||
@@ -459,8 +488,26 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
|
||||
*/
|
||||
void wc_CryptoCb_CleanupRenesasCmn(int* id)
|
||||
{
|
||||
|
||||
FSPSM_ST* cbInfo = NULL;
|
||||
|
||||
if (*id < INITIAL_DEVID ||
|
||||
(*id - INITIAL_DEVID) > MAX_FSPSM_CBINDEX)
|
||||
return;
|
||||
/* retrieve internal instance */
|
||||
cbInfo = (FSPSM_ST*)gCbCtx[*id - INITIAL_DEVID];
|
||||
|
||||
if (cbInfo != NULL && cbInfo->internal != NULL) {
|
||||
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) && \
|
||||
!defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
|
||||
XFREE(cbInfo->internal, cbInfo->internal->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#else
|
||||
XFREE(cbInfo->internal, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
cbInfo->internal = NULL;
|
||||
}
|
||||
wc_CryptoCb_UnRegisterDevice(*id);
|
||||
*id = INVALID_DEVID;
|
||||
}
|
||||
|
||||
#endif /* WOLF_CRYPTO_CB */
|
||||
@@ -752,7 +799,7 @@ WOLFSSL_LOCAL int Renesas_cmn_generateSessionKey(WOLFSSL* ssl, void* ctx)
|
||||
if (Renesas_cmn_usable(ssl, 0)) {
|
||||
#if defined(WOLFSSL_RENESAS_TSIP_TLS)
|
||||
ret = wc_tsip_generateSessionKey(ssl, cbInfo,
|
||||
cbInfo->internal->devId);
|
||||
cbInfo->devId);
|
||||
#elif defined(WOLFSSL_RENESAS_FSPSM_TLS)
|
||||
ret = wc_fspsm_generateSessionKey(ssl, ctx, cbInfo->devId);
|
||||
#endif
|
||||
|
@@ -49,7 +49,7 @@
|
||||
|
||||
struct Aes;
|
||||
|
||||
WOLFSSL_LOCAL void *Renesas_cmn_GetCbCtxBydevId(int devId);
|
||||
void *Renesas_cmn_GetCbCtxBydevId(int devId);
|
||||
|
||||
#define SCE_AES_GCM_AUTH_TAG_SIZE 16
|
||||
|
||||
@@ -60,14 +60,16 @@ extern FSPSM_INSTANCE gFSPSM_ctrl;
|
||||
typedef fsp_err_t (*aesGcmEncInitFn)
|
||||
(FSPSM_AESGCM_HANDLE*, FSPSM_AES_PWKEY, uint8_t*, uint32_t);
|
||||
typedef fsp_err_t (*aesGcmEncUpdateFn)
|
||||
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t);
|
||||
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t,
|
||||
uint32_t*);
|
||||
typedef fsp_err_t (*aesGcmEncFinalFn)
|
||||
(FSPSM_AESGCM_HANDLE*, uint8_t*, uint32_t*, uint8_t*);
|
||||
|
||||
typedef fsp_err_t (*aesGcmDecInitFn)
|
||||
(FSPSM_AESGCM_HANDLE*, FSPSM_AES_PWKEY, uint8_t*, uint32_t);
|
||||
typedef fsp_err_t (*aesGcmDecUpdateFn)
|
||||
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t);
|
||||
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t,
|
||||
uint32_t*);
|
||||
typedef fsp_err_t (*aesGcmDecFinalFn)
|
||||
(FSPSM_AESGCM_HANDLE*, uint8_t*, uint32_t*, uint8_t*, uint32_t);
|
||||
|
||||
@@ -77,72 +79,136 @@ static fsp_err_t _R_RSIP_AES_GCM_EncryptInit(FSPSM_AESGCM_HANDLE* h,
|
||||
FSPSM_AES_PWKEY k, uint8_t* iv,
|
||||
uint32_t iv_l)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_AES_AEAD_Init(&gFSPSM_ctrl, RSIP_AES_AEAD_MODE_GCM_ENC,
|
||||
(FSPSM_AES_PWKEY const)k,
|
||||
(uint8_t* const)iv, iv_l);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_GCM_EncryptInit(&gFSPSM_ctrl, (FSPSM_AES_PWKEY const)k,
|
||||
(uint8_t* const)iv, iv_l);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* wrapper for Gcm encrypt/decript ADD update */
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
static fsp_err_t _R_RSIP_AES_GCM_ADDUpdate(uint8_t* p_add, uint32_t add_len)
|
||||
{
|
||||
return R_RSIP_AES_AEAD_AADUpdate(&gFSPSM_ctrl, p_add, add_len);
|
||||
}
|
||||
#endif
|
||||
/* wrapper for Gcm encrypt update */
|
||||
static fsp_err_t _R_RSIP_AES_GCM_EncryptUpdate(FSPSM_AESGCM_HANDLE* h,
|
||||
uint8_t* p_plain, uint8_t* p_cipher, uint32_t plain_length,
|
||||
uint8_t* p_add, uint32_t add_len)
|
||||
uint8_t* p_add, uint32_t add_len, uint32_t* out_len)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
(void) p_add;
|
||||
(void) add_len;
|
||||
return R_RSIP_AES_AEAD_Update(&gFSPSM_ctrl, (uint8_t* const) p_plain,
|
||||
(uint32_t const) plain_length,
|
||||
(uint8_t* const) p_cipher,
|
||||
(uint32_t* const) out_len);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_GCM_EncryptUpdate(&gFSPSM_ctrl, (uint8_t* const) p_plain,
|
||||
(uint8_t* const) p_cipher,
|
||||
(uint32_t const) plain_length,
|
||||
(uint8_t* const) p_add,
|
||||
(uint32_t const) add_len);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for Gcm encrypt final */
|
||||
static fsp_err_t _R_RSIP_AES_GCM_EncryptFinal(FSPSM_AESGCM_HANDLE* h,
|
||||
uint8_t* p_cipher, uint32_t* c_len,
|
||||
uint8_t* p_atag)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
return R_RSIP_AES_AEAD_Finish(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
|
||||
(uint32_t* const) c_len,
|
||||
(uint8_t* const) p_atag);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_GCM_EncryptFinal(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
|
||||
(uint32_t* const) c_len,
|
||||
(uint8_t* const) p_atag);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for Gcm decrypt init */
|
||||
static fsp_err_t _R_RSIP_AES_GCM_DecryptInit(FSPSM_AESGCM_HANDLE* h,
|
||||
FSPSM_AES_PWKEY k, uint8_t* iv, uint32_t iv_l)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_AES_AEAD_Init(&gFSPSM_ctrl, RSIP_AES_AEAD_MODE_GCM_DEC,
|
||||
(FSPSM_AES_PWKEY const)k,
|
||||
(uint8_t* const)iv, iv_l);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_GCM_DecryptInit(&gFSPSM_ctrl, (FSPSM_AES_PWKEY const)k,
|
||||
(uint8_t* const)iv, iv_l);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for Gcm decrypt update */
|
||||
static fsp_err_t _R_RSIP_AES_GCM_DecryptUpdate(FSPSM_AESGCM_HANDLE* h,
|
||||
uint8_t* p_cipher, uint8_t* p_plain, uint32_t c_length,
|
||||
uint8_t* p_add, uint32_t add_len)
|
||||
uint8_t* p_add, uint32_t add_len, uint32_t* out_len)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
(void) p_add;
|
||||
(void) add_len;
|
||||
return R_RSIP_AES_AEAD_Update(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
|
||||
(uint32_t const) c_length,
|
||||
(uint8_t* const) p_plain,
|
||||
(uint32_t* const) out_len);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_GCM_DecryptUpdate(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
|
||||
(uint8_t* const) p_plain,
|
||||
(uint32_t const) c_length,
|
||||
(uint8_t* const) p_add,
|
||||
(uint32_t const) add_len);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for Gcm decrypt final */
|
||||
static fsp_err_t _R_RSIP_AES_GCM_DecryptFinal(FSPSM_AESGCM_HANDLE* h,
|
||||
uint8_t* p_plain, uint32_t* plain_len,
|
||||
uint8_t* p_atag, uint32_t atag_len)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
return R_RSIP_AES_AEAD_Verify(&gFSPSM_ctrl, (uint8_t* const) p_plain,
|
||||
(uint32_t* const) plain_len,
|
||||
(uint8_t* const) p_atag,
|
||||
(uint32_t const) atag_len);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_GCM_DecryptFinal(&gFSPSM_ctrl, (uint8_t* const) p_plain,
|
||||
(uint32_t* const) plain_len,
|
||||
(uint8_t* const) p_atag,
|
||||
(uint32_t const) atag_len);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for aes cbc encrypt init */
|
||||
static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptInit(FSPSM_AES_HANDLE* h,
|
||||
FSPSM_AES_PWKEY k,
|
||||
uint8_t* iv)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_Init(&gFSPSM_ctrl,
|
||||
RSIP_AES_CIPHER_MODE_CBC_ENC,
|
||||
k, iv);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_EncryptInit(&gFSPSM_ctrl,
|
||||
RSIP_AES_MODE_CBC,
|
||||
k, iv);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for aes cbc encrypt update */
|
||||
static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptUpdate(FSPSM_AES_HANDLE* h,
|
||||
@@ -150,31 +216,53 @@ static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptUpdate(FSPSM_AES_HANDLE* h,
|
||||
uint8_t* p_cipher,
|
||||
uint32_t plain_length)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_Update(&gFSPSM_ctrl,
|
||||
(const uint8_t* const)p_plain,
|
||||
(uint8_t* const)p_cipher,
|
||||
(const uint32_t)plain_length);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_EncryptUpdate(&gFSPSM_ctrl,
|
||||
(const uint8_t* const)p_plain,
|
||||
(uint8_t* const)p_cipher,
|
||||
(const uint32_t)plain_length);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for aes cbc encrypt final */
|
||||
static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptFinal(FSPSM_AES_HANDLE* h,
|
||||
uint8_t* p_cipher,
|
||||
uint32_t* cipher_lengh)
|
||||
uint32_t* cipher_length)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
(void) p_cipher;
|
||||
(void) cipher_length;
|
||||
return R_RSIP_AES_Cipher_Finish(&gFSPSM_ctrl);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_EncryptFinal(&gFSPSM_ctrl,
|
||||
(uint8_t* const)p_cipher,
|
||||
(uint32_t* const)cipher_lengh);
|
||||
(uint32_t* const)cipher_length);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for aes cbc decrypt init */
|
||||
static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptInit(FSPSM_AES_HANDLE* h,
|
||||
FSPSM_AES_PWKEY k,
|
||||
uint8_t* iv)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_Init(&gFSPSM_ctrl,
|
||||
RSIP_AES_CIPHER_MODE_CBC_DEC,
|
||||
k, iv);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_DecryptInit(&gFSPSM_ctrl,
|
||||
RSIP_AES_MODE_CBC,
|
||||
k, iv);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for aes cbc decrypt update */
|
||||
static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptUpdate(FSPSM_AES_HANDLE* h,
|
||||
@@ -182,21 +270,36 @@ static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptUpdate(FSPSM_AES_HANDLE* h,
|
||||
uint8_t* p_plain,
|
||||
uint32_t cipher_lengh)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_Update(&gFSPSM_ctrl,
|
||||
(const uint8_t* const)p_cipher,
|
||||
(uint8_t* const)p_plain,
|
||||
(const uint32_t)cipher_lengh);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_DecryptUpdate(&gFSPSM_ctrl,
|
||||
(const uint8_t* const)p_cipher,
|
||||
(uint8_t* const)p_plain,
|
||||
(const uint32_t)cipher_lengh);
|
||||
#endif
|
||||
}
|
||||
/* wrapper for aes cbc encrypt final */
|
||||
static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptFinal(FSPSM_AES_HANDLE* h,
|
||||
uint8_t* p_plain,
|
||||
uint32_t* plain_lengh)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void) h;
|
||||
(void) p_plain;
|
||||
(void) plain_lengh;
|
||||
return R_RSIP_AES_Cipher_Finish(&gFSPSM_ctrl);
|
||||
#else
|
||||
(void) h;
|
||||
return R_RSIP_AES_Cipher_DecryptFinal(&gFSPSM_ctrl,
|
||||
(uint8_t* const)p_plain,
|
||||
(uint32_t* const)plain_lengh);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/* Perform Aes Gcm encryption by FSP SM
|
||||
@@ -212,7 +315,7 @@ static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptFinal(FSPSM_AES_HANDLE* h,
|
||||
* ctx The callback context
|
||||
* return FSP_SUCCESS(0) on Success, otherwise negative value
|
||||
*/
|
||||
WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
|
||||
int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
|
||||
const byte* in, word32 sz,
|
||||
byte* iv, word32 ivSz,
|
||||
byte* authTag, word32 authTagSz,
|
||||
@@ -222,6 +325,8 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
|
||||
int ret;
|
||||
FSPSM_AESGCM_HANDLE _handle;
|
||||
uint32_t dataLen = sz;
|
||||
uint32_t out_len = 0;
|
||||
uint32_t out_len_tmp = 0;
|
||||
FSPSM_ST *info = (FSPSM_ST*)ctx;
|
||||
|
||||
aesGcmEncInitFn initFn;
|
||||
@@ -354,11 +459,22 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
|
||||
ret = initFn(&_handle, key_client_aes, (uint8_t*)iv_l, ivSz_l);
|
||||
|
||||
if (ret == FSP_SUCCESS) {
|
||||
/* pass only AAD and it's size before passing cipher text */
|
||||
#if defined(WOLFSSL_RENESAS_RSIP) &&\
|
||||
(WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
ret = _R_RSIP_AES_GCM_ADDUpdate((uint8_t*)authIn, authInSz);
|
||||
#else
|
||||
ret = updateFn(&_handle, NULL, NULL, 0UL, (uint8_t*)authIn,
|
||||
authInSz);
|
||||
authInSz,
|
||||
&out_len_tmp);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ret == FSP_SUCCESS) {
|
||||
ret = updateFn(&_handle, plainBuf, cipherBuf, sz, NULL, 0UL);
|
||||
out_len_tmp = 0;
|
||||
ret = updateFn(&_handle, plainBuf, cipherBuf, sz, NULL, 0UL,
|
||||
&out_len_tmp);
|
||||
out_len += out_len_tmp;
|
||||
}
|
||||
if (ret != FSP_SUCCESS) {
|
||||
WOLFSSL_MSG("R_XXXX_AesXXXGcmEncryptUpdate2: failed");
|
||||
@@ -372,12 +488,21 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
|
||||
* from its error state and all the trailing APIs will fail.
|
||||
*/
|
||||
dataLen = 0;
|
||||
out_len_tmp = 0;
|
||||
ret = finalFn(&_handle,
|
||||
cipherBuf + (sz + delta - WC_AES_BLOCK_SIZE),
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
&out_len_tmp,
|
||||
#else
|
||||
&dataLen,
|
||||
#endif
|
||||
aTagBuf);
|
||||
|
||||
if (ret == FSP_SUCCESS) {
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
out_len += out_len_tmp;
|
||||
dataLen = out_len;
|
||||
#endif
|
||||
/* copy encrypted data to out */
|
||||
if (sz != dataLen) {
|
||||
WOLFSSL_MSG("sz is not equal to dataLen!!!!");
|
||||
@@ -423,7 +548,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
|
||||
* ctx The Callback context
|
||||
* return FSP_SUCCESS(0) on Success, otherwise negative value
|
||||
*/
|
||||
WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
|
||||
int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
|
||||
const byte* in, word32 sz,
|
||||
const byte* iv, word32 ivSz,
|
||||
const byte* authTag, word32 authTagSz,
|
||||
@@ -433,6 +558,8 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
|
||||
int ret;
|
||||
FSPSM_AESGCM_HANDLE _handle;
|
||||
uint32_t dataLen = sz;
|
||||
uint32_t out_len = 0;
|
||||
uint32_t out_len_tmp = 0;
|
||||
FSPSM_ST *info = (FSPSM_ST*)ctx;
|
||||
|
||||
aesGcmDecInitFn initFn;
|
||||
@@ -559,11 +686,19 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
|
||||
|
||||
if (ret == FSP_SUCCESS) {
|
||||
/* pass only AAD and it's size before passing cipher text */
|
||||
#if defined(WOLFSSL_RENESAS_RSIP) &&\
|
||||
(WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
ret = _R_RSIP_AES_GCM_ADDUpdate((uint8_t*)authIn, authInSz);
|
||||
#else
|
||||
ret = updateFn(&_handle, NULL, NULL, 0UL, (uint8_t*)authIn,
|
||||
authInSz);
|
||||
authInSz, &out_len_tmp);
|
||||
#endif
|
||||
}
|
||||
if (ret == FSP_SUCCESS) {
|
||||
ret = updateFn(&_handle, cipherBuf, plainBuf, sz, NULL, 0UL);
|
||||
out_len_tmp = 0;
|
||||
ret = updateFn(&_handle, cipherBuf,
|
||||
plainBuf, sz, NULL, 0UL, &out_len_tmp);
|
||||
out_len += out_len_tmp;
|
||||
}
|
||||
if (ret != FSP_SUCCESS) {
|
||||
WOLFSSL_MSG("R_XXXX_AesXXXGcmDecryptUpdate: failed in decrypt");
|
||||
@@ -572,13 +707,22 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
|
||||
|
||||
if (ret == FSP_SUCCESS) {
|
||||
dataLen = 0;
|
||||
out_len_tmp = 0;
|
||||
ret = finalFn(&_handle,
|
||||
plainBuf + (sz + delta - WC_AES_BLOCK_SIZE),
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
&out_len_tmp,
|
||||
#else
|
||||
&dataLen,
|
||||
#endif
|
||||
aTagBuf,
|
||||
min(16, authTagSz));
|
||||
|
||||
if (ret == FSP_SUCCESS) {
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
out_len += out_len_tmp;
|
||||
dataLen = out_len;
|
||||
#endif
|
||||
/* copy plain data to out */
|
||||
if (sz != dataLen) {
|
||||
WOLFSSL_MSG("sz is not equal to dataLen!!!!");
|
||||
@@ -617,7 +761,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
|
||||
* sz Length of cipher text/plaintext in bytes
|
||||
* return FSP_SUCCESS(0) on Success, otherwise negative value
|
||||
*/
|
||||
WOLFSSL_LOCAL int wc_fspsm_AesCbcEncrypt(struct Aes* aes, byte* out,
|
||||
int wc_fspsm_AesCbcEncrypt(struct Aes* aes, byte* out,
|
||||
const byte* in, word32 sz)
|
||||
{
|
||||
FSPSM_AES_HANDLE _handle;
|
||||
@@ -691,7 +835,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesCbcEncrypt(struct Aes* aes, byte* out,
|
||||
* sz Length of cipher text/plaintext in bytes
|
||||
* return FSP_SUCCESS(0) on Success, otherwise negative value
|
||||
*/
|
||||
WOLFSSL_LOCAL int wc_fspsm_AesCbcDecrypt(struct Aes* aes, byte* out,
|
||||
int wc_fspsm_AesCbcDecrypt(struct Aes* aes, byte* out,
|
||||
const byte* in, word32 sz)
|
||||
{
|
||||
FSPSM_AES_HANDLE _handle;
|
||||
@@ -759,7 +903,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesCbcDecrypt(struct Aes* aes, byte* out,
|
||||
* aes The AES object.
|
||||
* return none
|
||||
*/
|
||||
WOLFSSL_LOCAL void wc_fspsm_Aesfree(Aes* aes)
|
||||
void wc_fspsm_Aesfree(Aes* aes)
|
||||
{
|
||||
#if defined(WOLFSSL_RENESAS_FSPSM_TLS)
|
||||
/* In the case of session key, memory is allocated
|
||||
@@ -814,7 +958,7 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
|
||||
}
|
||||
#endif
|
||||
|
||||
WOLFSSL_LOCAL int wc_fspsm_AesCipher(int devIdArg, wc_CryptoInfo* info,
|
||||
int wc_fspsm_AesCipher(int devIdArg, wc_CryptoInfo* info,
|
||||
void* ctx)
|
||||
{
|
||||
int ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
|
||||
|
@@ -43,52 +43,148 @@ extern FSPSM_INSTANCE gFSPSM_ctrl;
|
||||
/* wrapper for RSIP SHA1 Init */
|
||||
static fsp_err_t _R_RSIP_SHA1_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA1);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA1 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA224 Init */
|
||||
static fsp_err_t _R_RSIP_SHA224_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA224);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA224 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA256 Init */
|
||||
static fsp_err_t _R_RSIP_SHA256_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA256);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA256 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA384 Init */
|
||||
static fsp_err_t _R_RSIP_SHA384_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA384);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA384 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA512 Init */
|
||||
static fsp_err_t _R_RSIP_SHA512_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA512);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA512 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA512_224 Init */
|
||||
static fsp_err_t _R_RSIP_SHA512_224_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA512_224);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA512_224 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA512_256 Init */
|
||||
static fsp_err_t _R_RSIP_SHA512_256_GenerateInit(FSPSM_SHA_HANDLE* h)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA512_256);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA512_256 );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA Update */
|
||||
static fsp_err_t _R_RSIP_SHA_GenerateUpdate(FSPSM_SHA_HANDLE* h,
|
||||
uint8_t* m, uint32_t len)
|
||||
{
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Update(&gFSPSM_ctrl, m, len);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateUpdate(&gFSPSM_ctrl, h, m, len );
|
||||
#endif
|
||||
}
|
||||
/* wrapper for RSIP SHA Final */
|
||||
static fsp_err_t _R_RSIP_SHA_GenerateFinal(FSPSM_SHA_HANDLE* h,
|
||||
uint8_t* d, uint32_t *sz)
|
||||
{
|
||||
(void) sz;
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
(void)h;
|
||||
return R_RSIP_SHA_Finish(&gFSPSM_ctrl, d);
|
||||
#else
|
||||
return R_RSIP_SHA_GenerateFinal(&gFSPSM_ctrl, h, d);
|
||||
#endif
|
||||
}
|
||||
#endif /* WOLFSSL_RENESAS_RSIP */
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
static int FSPSM_FuncGet(uint32_t sha_type, void** Init,
|
||||
void** Update, void** Final)
|
||||
{
|
||||
(void)Init;
|
||||
(void)Update;
|
||||
(void)Final;
|
||||
|
||||
switch(sha_type) {
|
||||
case FSPSM_SHA1:
|
||||
*Init = FSPSM_SHA1_Init;
|
||||
*Update = FSPSM_SHA1_Up;
|
||||
*Final = FSPSM_SHA1_Final;
|
||||
break;
|
||||
case FSPSM_SHA256:
|
||||
*Init = FSPSM_SHA256_Init;
|
||||
*Update = FSPSM_SHA256_Up;
|
||||
*Final = FSPSM_SHA256_Final;
|
||||
break;
|
||||
case FSPSM_SHA224:
|
||||
*Init = FSPSM_SHA224_Init;
|
||||
*Update = FSPSM_SHA224_Up;
|
||||
*Final = FSPSM_SHA224_Final;
|
||||
break;
|
||||
case FSPSM_SHA384:
|
||||
*Init = FSPSM_SHA384_Init;
|
||||
*Update = FSPSM_SHA384_Up;
|
||||
*Final = FSPSM_SHA384_Final;
|
||||
break;
|
||||
case FSPSM_SHA512:
|
||||
*Init = FSPSM_SHA512_Init;
|
||||
*Update = FSPSM_SHA512_Up;
|
||||
*Final = FSPSM_SHA512_Final;
|
||||
break;
|
||||
case FSPSM_SHA512_224:
|
||||
*Init = FSPSM_SHA512_224_Init;
|
||||
*Update = FSPSM_SHA512_224_Up;
|
||||
*Final = FSPSM_SHA512_224_Final;
|
||||
break;
|
||||
case FSPSM_SHA512_256:
|
||||
*Init = FSPSM_SHA512_256_Init;
|
||||
*Update = FSPSM_SHA512_256_Up;
|
||||
*Final = FSPSM_SHA512_256_Final;
|
||||
break;
|
||||
default:
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
/* Free up allocation for msg
|
||||
*
|
||||
* hash The FSPSM Hash object.
|
||||
@@ -99,7 +195,8 @@ static void FSPSM_HashFree(wolfssl_FSPSM_Hash* hash)
|
||||
if (hash == NULL)
|
||||
return;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
XFREE(hash->msg, hash->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
hash->msg = NULL;
|
||||
#endif
|
||||
@@ -114,7 +211,8 @@ static int FSPSM_HashCopy(wolfssl_FSPSM_Hash* src, wolfssl_FSPSM_Hash* dst)
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wolfssl_FSPSM_Hash));
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
if (src->len > 0 && src->msg != NULL) {
|
||||
dst->msg = (byte*)XMALLOC(src->len, dst->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (dst->msg == NULL) {
|
||||
@@ -135,7 +233,7 @@ static int FSPSM_HashCopy(wolfssl_FSPSM_Hash* src, wolfssl_FSPSM_Hash* dst)
|
||||
static int FSPSM_HashInit(wolfssl_FSPSM_Hash* hash, void* heap, int devId,
|
||||
word32 sha_type)
|
||||
{
|
||||
#if defined(WOLFSSL_RENESAS_RSIP)
|
||||
#if defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER < 220)
|
||||
int ret;
|
||||
fsp_err_t (*Init)(FSPSM_SHA_HANDLE*);
|
||||
#endif
|
||||
@@ -148,7 +246,8 @@ static int FSPSM_HashInit(wolfssl_FSPSM_Hash* hash, void* heap, int devId,
|
||||
hash->sha_type = sha_type;
|
||||
hash->heap = heap;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
hash->len = 0;
|
||||
hash->used = 0;
|
||||
hash->msg = NULL;
|
||||
@@ -199,7 +298,7 @@ static int FSPSM_HashInit(wolfssl_FSPSM_Hash* hash, void* heap, int devId,
|
||||
static int FSPSM_HashUpdate(wolfssl_FSPSM_Hash* hash,
|
||||
const byte* data, word32 sz)
|
||||
{
|
||||
#if defined(WOLFSSL_RENESAS_RSIP)
|
||||
#if defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER < 220)
|
||||
int ret;
|
||||
fsp_err_t (*Update)(FSPSM_SHA_HANDLE*, uint8_t*, uint32_t);
|
||||
#endif
|
||||
@@ -208,7 +307,8 @@ static int FSPSM_HashUpdate(wolfssl_FSPSM_Hash* hash,
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
if (hash->len < hash->used + sz) {
|
||||
if (hash->msg == NULL) {
|
||||
hash->msg = (byte*)XMALLOC(hash->used + sz, hash->heap,
|
||||
@@ -292,7 +392,8 @@ static int FSPSM_HashFinal(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
|
||||
void* heap;
|
||||
(void) outSz;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
FSPSM_SHA_HANDLE handle;
|
||||
fsp_err_t (*Init)(FSPSM_SHA_HANDLE*);
|
||||
fsp_err_t (*Update)(FSPSM_SHA_HANDLE*, uint8_t*, uint32_t);
|
||||
@@ -300,14 +401,21 @@ static int FSPSM_HashFinal(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
|
||||
if (hash == NULL || out == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
if (hash->sha_type == FSPSM_SHA256) {
|
||||
Init = FSPSM_SHA256_Init;
|
||||
Update = FSPSM_SHA256_Up;
|
||||
Final = FSPSM_SHA256_Final;
|
||||
} else
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
#else
|
||||
Init = NULL;
|
||||
Update = NULL;
|
||||
Final = NULL;
|
||||
ret = FSPSM_FuncGet(hash->sha_type, (void**)&Init,
|
||||
(void**)&Update, (void**)&Final);
|
||||
if (ret != 0) return ret;
|
||||
#endif
|
||||
wc_fspsm_hw_lock();
|
||||
|
||||
if (Init(&handle) == FSP_SUCCESS) {
|
||||
@@ -379,7 +487,8 @@ static int FSPSM_HashGet(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
|
||||
uint32_t sz = 0;
|
||||
(void) outSz;
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
FSPSM_SHA_HANDLE handle;
|
||||
fsp_err_t (*Init)(FSPSM_SHA_HANDLE*);
|
||||
fsp_err_t (*Update)(FSPSM_SHA_HANDLE*, uint8_t*, uint32_t);
|
||||
@@ -392,14 +501,23 @@ static int FSPSM_HashGet(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
if (hash->sha_type == FSPSM_SHA256) {
|
||||
Init = FSPSM_SHA256_Init;
|
||||
Update = FSPSM_SHA256_Up;
|
||||
Final = FSPSM_SHA256_Final;
|
||||
} else
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
#else
|
||||
Init = NULL;
|
||||
Update = NULL;
|
||||
Final = NULL;
|
||||
ret = FSPSM_FuncGet(hash->sha_type, (void**)&Init,
|
||||
(void**)&Update, (void**)&Final);
|
||||
if (ret != 0) return ret;
|
||||
#endif
|
||||
wc_fspsm_hw_lock();
|
||||
if (Init(&handle) == FSP_SUCCESS) {
|
||||
ret = Update(&handle, (uint8_t*)hash->msg, hash->used);
|
||||
|
@@ -1278,6 +1278,11 @@ WOLFSSL_API int wc_fspsm_set_callback_ctx(WOLFSSL* ssl, void* user_ctx)
|
||||
|
||||
ForceZero(uCtx->internal, sizeof(FSPSM_ST_Internal));
|
||||
|
||||
uCtx->internal->ssl = ssl;
|
||||
uCtx->internal->ctx = ssl->ctx;
|
||||
uCtx->internal->heap = ssl->heap;
|
||||
uCtx->internal->side = ssl->ctx->method->side;
|
||||
|
||||
ssl->RenesasUserCtx = user_ctx; /* ssl doesn't own user_ctx */
|
||||
|
||||
wolfSSL_SetEccVerifyCtx(ssl, user_ctx);
|
||||
|
@@ -174,7 +174,7 @@ WOLFSSL_API int tsip_use_PrivateKey_buffer_TLS(struct WOLFSSL* ssl,
|
||||
/* store keyType as Id since Id capacity is 32 bytes */
|
||||
ret = wolfSSL_use_PrivateKey_Id(ssl,
|
||||
(const unsigned char*)keyBuf, 32,
|
||||
tuc->internal->devId);
|
||||
tuc->devId);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = 0;
|
||||
}
|
||||
@@ -2246,7 +2246,7 @@ WOLFSSL_API int tsip_set_callback_ctx(WOLFSSL* ssl, void* user_ctx)
|
||||
WOLFSSL_ENTER("tsip_set_callback_ctx");
|
||||
|
||||
TsipUserCtx* uCtx = (TsipUserCtx*)user_ctx;
|
||||
if (user_ctx == NULL) {
|
||||
if (user_ctx == NULL || ssl == NULL) {
|
||||
WOLFSSL_MSG("user ctx is null");
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
@@ -1066,6 +1066,7 @@ void wc_ShaFree(wc_Sha* sha)
|
||||
#if (defined(WOLFSSL_RENESAS_TSIP_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)) && \
|
||||
!defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220)) ||\
|
||||
defined(WOLFSSL_RENESAS_RX64_HASH)
|
||||
XFREE(sha->msg, sha->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
sha->msg = NULL;
|
||||
|
@@ -2326,7 +2326,8 @@ void wc_Sha256Free(wc_Sha256* sha256)
|
||||
((defined(WOLFSSL_RENESAS_TSIP_TLS) || \
|
||||
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)) && \
|
||||
!defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH)) || \
|
||||
(defined(WOLFSSL_RENESAS_SCEPROTECT) && \
|
||||
((defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))) && \
|
||||
!defined(NO_WOLFSSL_RENESAS_FSPSM_HASH)) || \
|
||||
defined(WOLFSSL_RENESAS_RX64_HASH) || \
|
||||
defined(WOLFSSL_HASH_KEEP)
|
||||
|
@@ -1500,7 +1500,8 @@ void wc_Sha512Free(wc_Sha512* sha512)
|
||||
KcapiHashFree(&sha512->kcapi);
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_HASH_KEEP)
|
||||
#if defined(WOLFSSL_HASH_KEEP) ||\
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
if (sha512->msg != NULL) {
|
||||
ForceZero(sha512->msg, sha512->len);
|
||||
XFREE(sha512->msg, sha512->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -1931,7 +1932,8 @@ void wc_Sha384Free(wc_Sha384* sha384)
|
||||
KcapiHashFree(&sha384->kcapi);
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_HASH_KEEP)
|
||||
#if defined(WOLFSSL_HASH_KEEP) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
if (sha384->msg != NULL) {
|
||||
ForceZero(sha384->msg, sha384->len);
|
||||
XFREE(sha384->msg, sha384->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
@@ -263,7 +263,7 @@ const byte const_byte_array[] = "A+Gd\0\0\0";
|
||||
#include <printx.h>
|
||||
#undef printf
|
||||
#define printf printx
|
||||
#elif defined(WOLFSSL_RENESAS_RSIP)
|
||||
#elif defined(WOLFSSL_RENESAS_RSIP) || defined(WOLFSSL_RENESAS_RZN2L)
|
||||
#ifndef TEST_SLEEP
|
||||
#define TEST_SLEEP() vTaskDelay(50)
|
||||
#endif
|
||||
@@ -2568,6 +2568,9 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
|
||||
#ifdef HAVE_CAVIUM_OCTEON_SYNC
|
||||
wc_CryptoCb_CleanupOcteon(&devId);
|
||||
#endif
|
||||
#ifdef HAVE_RENESAS_SYNC
|
||||
wc_CryptoCb_CleanupRenesasCmn(&devId);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|
@@ -21,12 +21,13 @@
|
||||
#ifndef __RENESAS_FSPSM_CRYPT_H__
|
||||
#define __RENESAS_FSPSM_CRYPT_H__
|
||||
|
||||
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WOLFSSL_FSPSM_ILLEGAL_CIPHERSUITE -1
|
||||
#define MAX_FSPSM_CBINDEX 5
|
||||
|
||||
typedef void* FSPSM_W_KEYVAR;
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#define FSPSM_key_flg_ST sce_keyflgs_crypt
|
||||
#define FSPSM_tag_ST tagUser_SCEPKCbInfo
|
||||
#define FSPSM_ST User_SCEPKCbInfo
|
||||
#define FSPSM_ST_Internal FSPSM_ST_Internal
|
||||
#define FSPSM_ST_PKC SCE_PKCbInfo
|
||||
|
||||
/* map SCE API to macro */
|
||||
@@ -167,28 +168,38 @@
|
||||
#elif defined(WOLFSSL_RENESAS_RSIP)
|
||||
|
||||
#include "r_rsip.h"
|
||||
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 200)
|
||||
#include "r_rsip_api.h"
|
||||
#endif
|
||||
/* structure, type so on */
|
||||
#define FSPSM_W_KEYVAR renesas_rsip_wrappedkey
|
||||
#define FSPSM_tls_flg_ST rsip_keyflgs_tls
|
||||
#define FSPSM_key_flg_ST rsip_keyflgs_crypt
|
||||
#define FSPSM_tag_ST tagUser_RSIPPKCbInfo
|
||||
#define FSPSM_ST User_RSIPPKCbInfo
|
||||
#define FSPSM_ST_Internal FSPSM_ST_Internal
|
||||
#define FSPSM_ST_PKC RSIP_PKCbInfo
|
||||
#define FSPSM_KEY_TYPE rsip_key_type_t
|
||||
|
||||
#define FSPSM_INSTANCE rsip_instance_ctrl_t
|
||||
#define gFSPSM_ctrl rsip_ctrl
|
||||
#define FSPSM_CONFIG rsip_cfg_t
|
||||
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
|
||||
#define gFSPSM_ctrl g_rsip_ctrl
|
||||
#define gFSPSM_cfg g_rsip_cfg
|
||||
#else
|
||||
#define gFSPSM_ctrl rsip_ctrl
|
||||
#define gFSPSM_cfg rsip_cfg
|
||||
#endif
|
||||
#define H_INSTANCE gFSPSM_ctrl
|
||||
#define FSPSM_OPEN R_RSIP_Open
|
||||
#define FSPSM_CLOSE R_RSIP_Close
|
||||
|
||||
/* rnd generation func */
|
||||
#define R_RANDOM_GEN(b) R_RSIP_RandomNumberGenerate(&gFSPSM_ctrl,b)
|
||||
#define R_RANDOM_GEN(b) \
|
||||
R_RSIP_RandomNumberGenerate(&gFSPSM_ctrl, (uint8_t* const)b)
|
||||
/* sha 1*/
|
||||
#define FSPSM_SHA_HANDLE rsip_sha_handle_t
|
||||
|
||||
#define FSPSM_SHA1_Init _R_RSIP_SHA1_GenerateInit
|
||||
#define FSPSM_SHA1_Up _R_RSIP_SHA_GenerateUpdate
|
||||
#define FSPSM_SHA1_Final _R_RSIP_SHA_GenerateFinal
|
||||
|
@@ -153,6 +153,8 @@ typedef struct TsipUserCtx_Internal TsipUserCtx_Internal;
|
||||
* TsipUserCtx holds mainly keys used for TLS handshake in TSIP specific format.
|
||||
*/
|
||||
typedef struct TsipUserCtx {
|
||||
/* unique number for each session */
|
||||
int devId;
|
||||
|
||||
int wrappedKeyType;
|
||||
/* for tsip crypt only mode */
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#ifndef _RENESAS_FSPSM_INTERNAL_H_
|
||||
#define _RENESAS_FSPSM_INTERNAL_H_
|
||||
|
||||
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-types.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h>
|
||||
|
||||
/* Wrapped TLS FSP Key Set Flags */
|
||||
@@ -35,6 +35,13 @@ struct FSPSM_ST_Internal {
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) && \
|
||||
!defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
|
||||
/* WOLFSSL object associated with */
|
||||
struct WOLFSSL* ssl;
|
||||
struct WOLFSSL_CTX* ctx;
|
||||
|
||||
/* HEAP_HINT */
|
||||
void* heap;
|
||||
|
||||
/* out from R_SCE_TLS_ServerKeyExchangeVerify */
|
||||
uint32_t
|
||||
encrypted_ephemeral_ecdh_public_key[FSPSM_TLS_ENCRYPTED_ECCPUBKEY_SZ];
|
||||
@@ -54,7 +61,6 @@ struct FSPSM_ST_Internal {
|
||||
uint8_t chr;
|
||||
struct FSPSM_tls_flg_ST bits;
|
||||
} keyflgs_tls;
|
||||
|
||||
};
|
||||
|
||||
#ifdef WOLFSSL_RENESAS_FSPSM_TLS
|
||||
@@ -92,7 +98,8 @@ typedef struct FSPSM_RSA_CTX {
|
||||
typedef struct {
|
||||
void* heap;
|
||||
word32 sha_type;
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
|
||||
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
|
||||
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
|
||||
word32 used;
|
||||
word32 len;
|
||||
byte* msg;
|
||||
|
@@ -24,10 +24,6 @@
|
||||
#include "renesas-tsip-crypt.h"
|
||||
|
||||
struct TsipUserCtx_Internal {
|
||||
|
||||
/* unique number for each session */
|
||||
int devId;
|
||||
|
||||
/* client key pair wrapped by provisioning key */
|
||||
byte* wrappedPrivateKey;
|
||||
byte* wrappedPublicKey;
|
||||
|
@@ -113,7 +113,7 @@ enum {
|
||||
#include "wolfssl/wolfcrypt/port/Renesas/renesas-rx64-hw-crypt.h"
|
||||
#elif defined(WOLFSSL_RENESAS_RSIP) && \
|
||||
!defined(NO_WOLFSSL_RENESAS_FSPSM_HASH)
|
||||
#include "wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h"
|
||||
#include "wolfssl/wolfcrypt/port/Renesas/renesas_fspsm_internal.h"
|
||||
#else
|
||||
|
||||
#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH)
|
||||
|
Reference in New Issue
Block a user