From a189d00fc96da3ab8c9c38d28e2672bac914ef85 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Mon, 3 Sep 2018 00:02:09 +0900 Subject: [PATCH] Refactor cs+ project --- IDE/Renesas/cs+/Projects/README | 16 +- .../cs+/Projects/common/user_settings.h | 86 ++- .../cs+/Projects/common/wolfssl_dummy.c | 42 +- IDE/Renesas/cs+/Projects/test/test.mtpj | 499 +++++++++--------- IDE/Renesas/cs+/Projects/test/test_main.c | 3 + .../cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj | 8 +- 6 files changed, 336 insertions(+), 318 deletions(-) diff --git a/IDE/Renesas/cs+/Projects/README b/IDE/Renesas/cs+/Projects/README index 4480b82b2..38c8bc285 100644 --- a/IDE/Renesas/cs+/Projects/README +++ b/IDE/Renesas/cs+/Projects/README @@ -4,10 +4,12 @@ wolfssl_lib: Build wolfssl_lib.lib test: - Get missing files - - create DUMMY project - - copy all files under DUMMY project except DUMMY.* - - uncomment "Use SIM I/O" lines in resetprg.c - - set heap size in sbrk.h - - set stack size in stacksct.h - Build test wolfCrypt + - For getting BSP files, create "bsp" folder under "Projects". + - Create "DUMMY" project under "bsp" with your MPU name property + - close "DUMMY" project, and open "test" project + - change MPU name property of the project + - uncomment "Use SIM I/O" lines in "bsp/resetprg.c" + - set heap size in "bsp/sbrk.h" + - set stack size in "bsp/stacksct.h" + Build "test" wolfCrypt + diff --git a/IDE/Renesas/cs+/Projects/common/user_settings.h b/IDE/Renesas/cs+/Projects/common/user_settings.h index 71eeed6a3..87d3a4304 100644 --- a/IDE/Renesas/cs+/Projects/common/user_settings.h +++ b/IDE/Renesas/cs+/Projects/common/user_settings.h @@ -22,30 +22,34 @@ #define NO_MAIN_DRIVER #define BENCH_EMBEDDED #define NO_WRITEV -#define WOLFSSL_USER_IO -#define CloseSocket close #define NO_DEV_RANDOM #define USE_CERT_BUFFERS_2048 -#define WOLFSSL_USER_CURRTIME #define SIZEOF_LONG_LONG 8 #define NO_WOLFSSL_DIR #define WOLFSSL_NO_CURRDIR #define WOLFSSL_LOG_PRINTF -#define NO_FILESYSTEM - -/* #define DEBUG_WOLFSSL */ - -#define OPENSSL_EXTRA - +#define NO_WOLFSSL_STUB +#define NO_DYNAMIC_ARRAY /* for compilers not allowed dynamic size array */ #define WOLFSSL_SMALL_STACK #define WOLFSSL_DH_CONST + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + #define HAVE_TLS_EXTENSIONS #define HAVE_SUPPORTED_CURVES -/* #define USER_TIME */ -/* #define XTIME time */ -#define TIME_OVERRIDES -#define HAVE_TM_TYPE +#define WOLFSSL_USER_IO + +//#define WOLFSSL_USER_KEYFILES /* To be defined key and cert files in user_settings.h */ +//#define WOLFSSL_NO_ABORT /* No abort during the test except exception occured */ +//#define DEBUG_WOLFSSL + +#define OPENSSL_EXTRA + +#define USER_TIME +#define XTIME time #define HAVE_TIME_T_TYPE #define USE_WOLF_SUSECONDS_T #define USE_WOLF_TIMEVAL_T @@ -54,61 +58,39 @@ #define WOLFSSL_GENSEED_FORTEST /* Wardning: define your own seed gen */ -#define TFM_TIMING_RESISTANT -#define ECC_TIMING_RESISTANT -#define WC_RSA_BLINDING - #define SINGLE_THREADED /* or define RTOS option */ -/* #undef SINGLE_THREADED */ /*#define WOLFSSL_CMSIS_RTOS */ /* #define NO_DH */ +#define NO_RC4 #define HAVE_AESGCM #define WOLFSSL_SHA512 +#define WOLFSSL_SHA384 #define HAVE_ECC #define HAVE_CURVE25519 #define CURVE25519_SMALL #define HAVE_ED25519 #define NO_OLD_SHA256_NAMES - -/*#define NO_WOLFSSL_STUB*/ -#define WOLFSSL_SHA384 #define HAVE_CRL +#define HAVE_OCSP +#define HAVE_CERTIFICATE_STATUS_REQUEST -/* Platform */ -#define RI600V4 +//#define WOLFSSL_KEY_GEN +#define SHOW_GEN -/* Server Renegotiate */ -#define WOLFSSL_SERVER_RENEGOTIATION -#define HAVE_SERVER_RENEGOTIATION_INFO +#define WOLFSSL_KEEP_STORE_CERTS +#define WOLFSSL_CIPHER_INTERNALNAME -#if defined(TIME_OVERRIDES) && defined(HAVE_TM_TYPE) && defined(HAVE_TIME_T_TYPE) - /* #include "time_mng.h" */ - typedef unsigned long Time_t; - #define time_t Time_t - #define WOLFSSL_GMTIME - #define XGMTIME gmtime - #define XTIME user_time +#define WOLFSSL_GETENV_RANDFILE "ABCDEFG" +#define WOLFSSL_GETENV_HOME "home" - struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_wday; - int tm_mon; - int tm_year; - int tm_yday; - int tm_isdst; - }; -#endif +#define CloseSocket(s) {} +#define StartTCP() -// #define HAVE_STUNNEL -#define KEEP_OUR_CERT +#define NO_FILESYSTEM +#define XFILE FILE* +#define XBADFILE NULL +//#define WOLFSSL_USER_KEYFILES /* Substitute key and cert files in test.h with user definitions */ -#ifdef NO_ASN -#undef NO_ASN -#endif +int strncasecmp(const char *s1, const char *s2, unsigned int sz); -#define WOLFSSL_GETENV_RANDFILE "randfile" -#define WOLFSSL_GETENV_HOME "envhome" \ No newline at end of file diff --git a/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c b/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c index 4a1602147..8a777cd4f 100644 --- a/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c +++ b/IDE/Renesas/cs+/Projects/common/wolfssl_dummy.c @@ -24,37 +24,45 @@ #endif #include + +#include #include #include #include -//typedef unsigned long time_t; +#define WOLFSSL_SUCCESS 1 #define YEAR 2018 #define MON 5 static int tick = 0; -#include -int strncasecmp(const char *s1, const char *s2, unsigned int sz) +time_t time(time_t *t) { - for( ; sz>0; sz--) - if(toupper(*s1++) != toupper(*s2++)) - return 1; - return 0; -} - -unsigned long user_time(void){ return ((YEAR-1970)*365+30*MON)*24*60*60 + tick++; } -char* getenv(const char *env) +#include +int strncasecmp(const char *s1, const char * s2, unsigned int sz) { - if (XSTRNCMP(env, "RANDFILE", 9) == 0) - return WOLFSSL_GETENV_RANDFILE; - else if (XSTRNCMP(env, "HOME", 5) == 0) - return WOLFSSL_GETENV_HOME; - else return 0; + for( ; sz>0; sz--, s1++, s2++){ + if(toupper(*s1) < toupper(*s2)){ + return -1; + } + if(toupper(*s1) > toupper(*s2)){ + return 1; +<<<<<<< HEAD + return 0; +======= + } + } + return 0; +>>>>>>> Refactor cs+ project +} + +void abort(void) +{ + while(1); } -void abort(void){ while(1); } \ No newline at end of file + diff --git a/IDE/Renesas/cs+/Projects/test/test.mtpj b/IDE/Renesas/cs+/Projects/test/test.mtpj index a1f0433e7..57b454ddf 100644 --- a/IDE/Renesas/cs+/Projects/test/test.mtpj +++ b/IDE/Renesas/cs+/Projects/test/test.mtpj @@ -10,31 +10,16 @@ fb98844b-2c27-4275-9804-f6e63e204da0 22bd583d-ee58-4c8e-8924-5337fd34b2b3 - - dbsct.c - File - dbsct.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 + + bsp + Category 12d9e600-88ab-4da9-95ad-6813d38e0973 + c1430910-c62b-40a9-8083-907feee08a05 - - intprg.c + + test.c File - intprg.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - resetprg.c - File - resetprg.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - sbrk.c - File - sbrk.c + ..\..\..\..\..\wolfcrypt\test\test.c 941832c1-fc3b-4e1b-94e8-01ea17128b42 12d9e600-88ab-4da9-95ad-6813d38e0973 @@ -45,55 +30,6 @@ 941832c1-fc3b-4e1b-94e8-01ea17128b42 12d9e600-88ab-4da9-95ad-6813d38e0973 - - vecttbl.c - File - vecttbl.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - iodefine.h - File - iodefine.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - sbrk.h - File - sbrk.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - stacksct.h - File - stacksct.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - typedefine.h - File - typedefine.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - vect.h - File - vect.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - test.c - File - ..\..\..\..\..\wolfcrypt\test\test.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - wolfssl_dummy.c File @@ -101,27 +37,6 @@ 941832c1-fc3b-4e1b-94e8-01ea17128b42 12d9e600-88ab-4da9-95ad-6813d38e0973 - - lowsrc.c - File - lowsrc.c - 941832c1-fc3b-4e1b-94e8-01ea17128b42 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - lowlvl.src - File - lowlvl.src - f654126d-e7ad-426d-be34-8455271d959b - 12d9e600-88ab-4da9-95ad-6813d38e0973 - - - unistd.h - File - ..\common\unistd.h - 03cad1e8-2eb3-4cde-a8a3-982423631122 - 12d9e600-88ab-4da9-95ad-6813d38e0973 - user_settings.h File @@ -129,6 +44,104 @@ 03cad1e8-2eb3-4cde-a8a3-982423631122 12d9e600-88ab-4da9-95ad-6813d38e0973 + + dbsct.c + File + ..\bsp\dbsct.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + hwsetup.c + File + ..\bsp\hwsetup.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + intprg.c + File + ..\bsp\intprg.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + iodefine.h + File + ..\bsp\iodefine.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + lowlvl.src + File + ..\bsp\lowlvl.src + f654126d-e7ad-426d-be34-8455271d959b + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + lowsrc.c + File + ..\bsp\lowsrc.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + lowsrc.h + File + ..\bsp\lowsrc.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + resetprg.c + File + ..\bsp\resetprg.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + sbrk.c + File + ..\bsp\sbrk.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + sbrk.h + File + ..\bsp\sbrk.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + stacksct.h + File + ..\bsp\stacksct.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + typedefine.h + File + ..\bsp\typedefine.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + vect.h + File + ..\bsp\vect.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + + + vecttbl.c + File + ..\bsp\vecttbl.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 1e626b57-3633-42b2-ba5f-87f5e41d554a + @@ -136,6 +149,11 @@ 0 + + + 0 + + d249e3b7-1c98-499d-ac0e-829eb0dc07f4 @@ -152,13 +170,13 @@ 1.0 - R5F565N9FxLJ + R5F571MLDxFC 0 - 0 + 2 R5F565N9FxLJ @@ -174,28 +192,30 @@ RABlAGYAYQB1AGwAdABCAHUAaQBsAGQA False DefaultBuild - 8ba268e2-1638-4188-87fc-9165a8cd11e7 + 3935a5fa-59a8-40a4-8f21-f56f418ce3a3 CSource - 924462d3-0861-4baf-b323-c25be1e91380 + 9ce51d13-dee2-4fe6-b026-5eb59375af30 CSource - f665a87e-34c4-40a6-9ce5-f9fffe993cf1 + cc854f0a-653c-4d49-ad45-0df17f62765b CSource - 80a4d598-6931-4ad5-bf89-5b184e8bcb07 + ecdc0105-42e8-490b-a5f4-dbef62521ce3 CSource - 9ce51d13-dee2-4fe6-b026-5eb59375af30 + 38d8908f-460f-45be-83f0-771791c86bca CSource - e3f84555-8ea7-4c19-9746-f36c31a8d08d + ad43352b-89de-44c3-ab21-f8c3a662dee3 CSource - 3935a5fa-59a8-40a4-8f21-f56f418ce3a3 - CSource - cc854f0a-653c-4d49-ad45-0df17f62765b + 2e12fadb-ba8f-4ede-a450-c2c2956cf93a + AsmSource + 28ec7225-91c8-4957-b715-ce2fa298b8d3 CSource - edf9134c-ea23-4afe-9dfb-ba54df0f2e45 + 30ea2319-abc7-43b0-b197-234093a1ef8c CSource - 4385a751-e97b-46d6-b9ab-ac55b25b17dc - AsmSource - 10 - 0 + 3ce36679-d436-4df9-b7e0-ba69d2319971 + CSource + 49e27495-6de7-42eb-b336-691c7499424b + CSource + 11 + 2 @@ -278,7 +298,7 @@ None False False - -8586768138329950975 + -8586657613297042146 DefaultBuild %TargetFiles% @@ -376,6 +396,7 @@ False -isa=rxv2 -fpu +-include=..\bsp -include=..\common -include=..\..\..\..\.. -include=..\wolfssl_lib @@ -450,7 +471,7 @@ False Sjis False - -8586767489570851217 + -8586657641844903702 C99 False False @@ -469,7 +490,8 @@ False None True - ..\common + ..\bsp +..\common ..\..\..\..\.. ..\wolfssl_lib @@ -491,6 +513,7 @@ False -isa=rxv2 -fpu +-include=..\bsp -include=..\common -include=..\..\..\..\.. -include=..\wolfssl_lib @@ -703,7 +726,7 @@ D_2=R_2 -exit False - -8586768128523424353 + -8586657622167475000 False Absolute Stype @@ -1085,23 +1108,15 @@ D_2=R_2 0 - 636604222525456322 - 0 1 - 636604222525456322 - 1 2 - 636604222525456322 - 2 3 - 636604222525456322 - 3 4 @@ -1110,96 +1125,122 @@ D_2=R_2 5 - 636604222525456322 - 5 - - - 636604222525456322 - 6 - - - 636604222525456322 - 7 - - - 636604222525456322 - 8 - - - 636604222525456322 - 9 - - - 636604222525456322 - 10 636604222907020637 0 - - 636604233142621806 - 0 - 636604231267559837 1 - - 636604237551510311 - 0 - 636604904407738135 0 - - 636604337733963935 + + 636714747864289133 0 + + 636714747864289133 + 1 + + + 636714747864289133 + 2 + + + 636714747864289133 + 3 + + + 636714747864289133 + 4 + + + 636714747864289133 + 5 + + + 636714747864289133 + 6 + + + 636714747864289133 + 7 + + + 636714747864289133 + 8 + + + 636714747864289133 + 9 + + + 636714747864289133 + 10 + + + 636714747864289133 + 11 + + + 636714747864289133 + 12 + + + 636714747864289133 + 13 + - -8586768138329319486 + -8586768137947755171 False True False - -8586768138329319486 + -8586768137318965490 False True False - -8586768138329319486 + -8586768129587215971 False True False - -8586768138329319486 + -8586657612990486675 False True False - -8586768137318965490 + -8586657612990486675 False True False - -8586768138329319486 + -8586657612990486675 False True False - -8586768137947755171 - False - True - False - -8586768129587215971 + -8586657612990486675 False True False - -8586768127712154002 + -8586657612990486675 False True False - - - -8586768123303255465 + -8586657612990486675 False True - False + False + -8586657612990486675 + False + True + False + + + -8586657612990486675 + False + True + False @@ -1245,10 +1286,10 @@ D_2=R_2 - 0 - R5F565N9FxLJ + 2 + R5F571MLDxFC Little - 120 + 240 3 CMT False @@ -1283,37 +1324,37 @@ D_2=R_2 True No 500 - 19 + 17 InternalRam 0 - 262143 + 524287 0 8 True False None Little - NonMap - 262144 - 524287 + Sfr + 524288 + 540671 0 8 True False None Little - Sfr - 524288 - 540671 + NonMap + 540672 + 548863 0 8 True False None Little - NonMap - 540672 - 548863 + Sfr + 548864 + 557055 0 8 True @@ -1321,35 +1362,35 @@ D_2=R_2 None Little Sfr - 548864 - 557055 + 557056 + 655359 0 8 True False None - Little + Big Sfr - 557056 - 655359 + 655360 + 671743 0 8 True False None - Big - Sfr - 655360 - 671743 + Little + NonMap + 671744 + 679935 0 8 True False None Little - InternalRam - 671744 - 679935 + Sfr + 679936 + 786431 0 8 True @@ -1357,26 +1398,26 @@ D_2=R_2 None Little Sfr - 679936 - 786431 + 786432 + 917503 0 8 True False None - Little + Big Sfr - 786432 - 917503 + 917504 + 1048575 0 8 True False None - Big - Sfr - 917504 - 1048575 + Little + InternalRom + 1048576 + 1114111 0 8 True @@ -1384,77 +1425,59 @@ D_2=R_2 None Little NonMap - 1048576 - 8380415 + 1114112 + 1179711 0 8 True False None Little - Sfr - 8380416 - 8388607 + InternalRam + 1179712 + 1179759 0 8 True False None - Big + Little NonMap - 8388608 - 4269759743 + 1179760 + 8380415 0 8 True False None Little - InternalRam - 4269759744 - 4269759871 + Sfr + 8380416 + 8388607 0 8 True False None - Little + Big NonMap - 4269759872 - 4269768047 + 8388608 + 4290772991 0 8 True False None Little - InternalRam - 4269768048 - 4269768095 + InternalRom + 4290772992 + 4294967295 0 8 True False None Little - NonMap - 4269768096 - 4293918719 - 0 - 8 - True - False - None - Little - InternalRom - 4293918720 - 4294967295 - 0 - 8 - True - False - None - Little Yes 500 No diff --git a/IDE/Renesas/cs+/Projects/test/test_main.c b/IDE/Renesas/cs+/Projects/test/test_main.c index 4d8e0179d..74d06d914 100644 --- a/IDE/Renesas/cs+/Projects/test/test_main.c +++ b/IDE/Renesas/cs+/Projects/test/test_main.c @@ -41,13 +41,16 @@ typedef struct func_args { } func_args; void wolfcrypt_test(func_args args); +void ApiTest(void); void main(void) { func_args args = { 1 }; + printf("Start wolfCrypt Test\n"); wolfcrypt_test(args); printf("End wolfCrypt Test\n"); + } #ifdef __cplusplus diff --git a/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj b/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj index 83a4bb12a..c37a10cdd 100644 --- a/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj +++ b/IDE/Renesas/cs+/Projects/wolfssl_lib/wolfssl_lib.mtpj @@ -545,13 +545,13 @@ 1.0 - R5F565N7BxFB + R5F571MLDxFC 0 - 0 + 1 R5F565N7BxFB @@ -704,7 +704,7 @@ d1a109cd-a5af-4f79-8bef-7acd6d46c8db CSource 68 - 0 + 1 @@ -787,7 +787,7 @@ None False False - -8586796872818991641 + -8586657078646268366 DefaultBuild %TargetFiles%