Skip to content

Commit 94b1c8c

Browse files
committed
Addressed review comments
- Add build.bat for command line build
1 parent 399ec53 commit 94b1c8c

4 files changed

Lines changed: 49 additions & 3 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@echo off
2+
setlocal
3+
4+
set MAKE=C:\Renesas\e2_studio\eclipse\plugins\com.renesas.ide.exttools.gnumake.win32.x86_64_4.3.1.v20240909-0854\mk\make.exe
5+
set CCRX_BIN=C:\PROGRA~2\Renesas\RX\3_6_0\bin
6+
set E2_UTILS=%USERPROFILE%\.eclipse\com.renesas.platform_1435879475\Utilities\ccrx
7+
set PATH=%CCRX_BIN%;%E2_UTILS%;%PATH%
8+
set BASEDIR=%~dp0
9+
10+
set TARGET=all
11+
if /i "%1"=="clean" set TARGET=clean
12+
13+
echo ============================================================
14+
echo wolfssl library [%TARGET%]
15+
echo ============================================================
16+
cd /d "%BASEDIR%wolfssl\Debug"
17+
"%MAKE%" %TARGET%
18+
if %ERRORLEVEL% neq 0 (
19+
echo [ERROR] wolfssl build failed.
20+
exit /b %ERRORLEVEL%
21+
)
22+
23+
echo.
24+
echo ============================================================
25+
echo test application [%TARGET%]
26+
echo ============================================================
27+
cd /d "%BASEDIR%test\HardwareDebug"
28+
"%MAKE%" %TARGET%
29+
if %ERRORLEVEL% neq 0 (
30+
echo [ERROR] test build failed.
31+
exit /b %ERRORLEVEL%
32+
)
33+
34+
echo.
35+
echo ============================================================
36+
echo Done.
37+
echo ============================================================
38+
endlocal

IDE/Renesas/e2studio/RX72N/EnvisionKit/include.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/test.rcpc
3737
EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/test/test.scfg
3838
EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/wolfssl/.cproject
3939
EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/wolfssl/.project
40+
EXTRA_DIST+= IDE/Renesas/e2studio/RX72N/EnvisionKit/Simple/build.bat

IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,7 @@ static int tsip_sha256_hash_test(int prnt)
15131513
byte hash1[WC_SHA256_DIGEST_SIZE];
15141514
byte hash2[WC_SHA256_DIGEST_SIZE];
15151515
int ret = 0;
1516+
int shaInited = 0;
15161517

15171518
/* SHA-256("abc") */
15181519
static const byte msg[] = { 0x61, 0x62, 0x63 };
@@ -1532,6 +1533,7 @@ static int tsip_sha256_hash_test(int prnt)
15321533
ret = -1;
15331534
goto out;
15341535
}
1536+
shaInited = 1;
15351537
ret = wc_Sha256Update(&sha, msg, sizeof(msg));
15361538
if (ret != 0) {
15371539
ret = -2;
@@ -1585,6 +1587,8 @@ static int tsip_sha256_hash_test(int prnt)
15851587
}
15861588

15871589
out:
1590+
if (shaInited)
1591+
wc_Sha256Free(&sha);
15881592
if (prnt) {
15891593
if (ret != 0)
15901594
printf("(code=%d) ", ret);
@@ -1601,6 +1605,7 @@ static int tsip_sha1_hash_test(int prnt)
16011605
byte hash1[WC_SHA_DIGEST_SIZE];
16021606
byte hash2[WC_SHA_DIGEST_SIZE];
16031607
int ret = 0;
1608+
int shaInited = 0;
16041609

16051610
/* NIST FIPS 180-4: SHA-1("abc") */
16061611
static const byte msg[] = { 0x61, 0x62, 0x63 };
@@ -1619,7 +1624,7 @@ static int tsip_sha1_hash_test(int prnt)
16191624
ret = -1;
16201625
goto out;
16211626
}
1622-
1627+
shaInited = 1;
16231628
ret = wc_ShaUpdate(&sha, msg, sizeof(msg));
16241629
if (ret != 0) {
16251630
ret = -2;
@@ -1678,6 +1683,8 @@ static int tsip_sha1_hash_test(int prnt)
16781683
}
16791684

16801685
out:
1686+
if (shaInited)
1687+
wc_ShaFree(&sha);
16811688
if (prnt) {
16821689
if (ret != 0)
16831690
printf("(code=%d) ", ret);

wolfcrypt/src/port/Renesas/renesas_tsip_sha.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static int TSIPHashFinal(wolfssl_TSIP_Hash* hash, byte* out, word32 outSz)
400400
ret = Final(&handle, out, (uint32_t*)&sz);
401401
if (ret != TSIP_SUCCESS || sz != outSz) {
402402
tsip_hw_unlock();
403-
return ret;
403+
return (ret == TSIP_SUCCESS) ? WC_HW_E : ret;
404404
}
405405
}
406406
else {
@@ -452,7 +452,7 @@ static int TSIPHashGet(wolfssl_TSIP_Hash* hash, byte* out, word32 outSz)
452452
ret = Final(&handle, out, &sz);
453453
if (ret != TSIP_SUCCESS || sz != outSz) {
454454
tsip_hw_unlock();
455-
return ret;
455+
return (ret == TSIP_SUCCESS) ? WC_HW_E : ret;
456456
}
457457
}
458458
else {

0 commit comments

Comments
 (0)