diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..0ea0cc46c7
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git a/IDE/MCUEXPRESSO/RT1170/fsl_caam_c.patch b/IDE/MCUEXPRESSO/RT1170/fsl_caam_c.patch
index 50590a0da0..d416d4631e 100644
--- a/IDE/MCUEXPRESSO/RT1170/fsl_caam_c.patch
+++ b/IDE/MCUEXPRESSO/RT1170/fsl_caam_c.patch
@@ -1,6 +1,6 @@
---- fsl_caam-orig.c 2022-10-21 15:50:35.709951000 -0700
-+++ fsl_caam.c 2022-12-28 06:30:34.788316189 -0800
-@@ -7872,3 +7872,462 @@
+--- fsl_caam.c 2023-01-12 23:39:04.000000000 -0800
++++ fsl_caam-expanded.c 2023-06-23 00:18:14.395128903 -0700
+@@ -7872,3 +7872,476 @@
}
return status;
}
@@ -128,7 +128,9 @@
+ descriptor[4] |= enc;
+
+ /* schedule the job */
-+ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ do {
++ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ } while (status == kStatus_CAAM_Again);
+ if (status == kStatus_Success) {
+ status = CAAM_Wait(base, handle, descriptor, kCAAM_Blocking);
+ }
@@ -212,7 +214,9 @@
+ descriptor[7] |= enc;
+
+ /* schedule the job */
-+ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ do {
++ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ } while (status == kStatus_CAAM_Again);
+ if (status == kStatus_Success) {
+ status = CAAM_Wait(base, handle, descriptor, kCAAM_Blocking);
+ }
@@ -283,7 +287,9 @@
+ DESC_ADD_LEN(descriptor[7], sizeHash);
+
+ /* schedule the job */
-+ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ do {
++ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ } while (status == kStatus_CAAM_Again);
+ if (status == kStatus_Success) {
+ status = CAAM_Wait(base, handle, descriptor, kCAAM_Blocking);
+ }
@@ -350,7 +356,9 @@
+ descriptor[5] |= enc;
+
+ /* schedule the job */
-+ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ do {
++ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ } while (status == kStatus_CAAM_Again);
+ if (status == kStatus_Success) {
+ status = CAAM_Wait(base, handle, descriptor, kCAAM_Blocking);
+ }
@@ -367,7 +375,7 @@
+/* Handle BLOB create and open */
+static const uint32_t templateBlob[] = {
+ /* 00 */ 0xB0800000u, /* HEADER */
-+ /* 01 */ 0x14400000u, /* class */
++ /* 01 */ 0x04000000u, /* class */
+ /* 02 */ 0x00000000u, /* key mod */
+ /* 03 */ 0xF0000000u, /* SEQ input size */
+ /* 04 */ 0x00000000u, /* input */
@@ -425,6 +433,10 @@
+ return status;
+ }
+
++ if (keyModSz != CAAM_SM_KEYMODSZ && keyModSz != CAAM_KEYMODSZ) {
++ return status;
++ }
++
+ if (dir == CAAM_DECAP_BLOB &&
+ (sizeOut > sizeIn - CAAM_PADDING_SIZE_BLOB)) {
+ return status;
@@ -435,7 +447,7 @@
+
+ /* add descriptor lenght in bytes to HEADER descriptor command */
+ DESC_HEADER_ADD_DESCLEN(descriptor[0], descriptorSize);
-+ descriptor[1] |= color; /* add color of blob */
++ descriptor[1] |= keyModSz;
+ DESC_SET_ADDR(descriptor[2], keyMod);
+ DESC_ADD_LEN(descriptor[3], sizeIn);
+ DESC_SET_ADDR(descriptor[4], in);
@@ -450,7 +462,9 @@
+ }
+
+ /* schedule the job */
-+ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ do {
++ status = caam_in_job_ring_add(base, handle->jobRing, &descriptor[0]);
++ } while (status == kStatus_CAAM_Again);
+ if (status == kStatus_Success) {
+ status = CAAM_Wait(base, handle, descriptor, kCAAM_Blocking);
+ }
diff --git a/IDE/MCUEXPRESSO/RT1170/fsl_caam_h.patch b/IDE/MCUEXPRESSO/RT1170/fsl_caam_h.patch
index 965b930cf7..23d43cc262 100644
--- a/IDE/MCUEXPRESSO/RT1170/fsl_caam_h.patch
+++ b/IDE/MCUEXPRESSO/RT1170/fsl_caam_h.patch
@@ -1,6 +1,6 @@
---- fsl_caam-orig.h 2022-10-21 15:50:35.745560000 -0700
-+++ fsl_caam.h 2022-12-28 08:10:29.413415216 -0800
-@@ -3038,6 +3038,162 @@
+--- fsl_caam.h 2023-06-23 00:08:46.491699533 -0700
++++ fsl_caam-expanded.h 2023-06-23 00:10:22.702730462 -0700
+@@ -3038,6 +3038,164 @@
*@}
*/ /* end of caam_driver_pkha */
@@ -127,10 +127,12 @@
+
+/* define for application to check for ECC CAAM additions */
+#define CAAM_BLOB_EXPANSION
-+#define CAAM_RED_BLOB 0x00000C08
-+#define CAAM_BLACK_BLOB 0x00000010
++#define CAAM_RED_BLOB 1
++#define CAAM_BLACK_BLOB 2
+#define CAAM_ENCAP_BLOB 0x07000000
+#define CAAM_DECAP_BLOB 0x06000000
++#define CAAM_SM_KEYMODSZ 8
++#define CAAM_KEYMODSZ 16
+#define CAAM_PADDING_SIZE_BLOB 48
+
+/*!
diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h
index 1d882ca906..5fc432ce23 100644
--- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h
+++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h
@@ -165,7 +165,7 @@
#endif
//
// DSA
-#define MDK_CONF_DSA 1
+#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@@ -204,6 +204,60 @@
//
//
+// Math / Memory
+// Math Library
+// <0=>SP Math All (sp_int.c)
+// <1=>Fast Math (tfm.c)
+// <2=>Heap Math (integer.c)
+// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
+// <4=>SP Math +ASM (faster)
+#define MDK_CONF_MATH 0
+#if MDK_CONF_MATH == 0
+ #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
+#elif MDK_CONF_MATH == 1
+ #define USE_FAST_MATH
+#elif MDK_CONF_MATH == 2
+ #define USE_INTEGER_HEAP_MATH
+#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
+ #define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
+ #define WOLFSSL_HAVE_SP_RSA
+ #define WOLFSSL_HAVE_SP_DH
+ #define WOLFSSL_HAVE_SP_ECC
+
+ //#define WOLFSSL_SP_NO_2048
+ //#define WOLFSSL_SP_NO_3072
+ #define WOLFSSL_SP_4096
+ //#define WOLFSSL_SP_NO_256
+ //#define WOLFSSL_SP_384
+ //#define WOLFSSL_SP_521
+
+ #define WOLFSSL_SP_SMALL /* use smaller version of code */
+ //#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
+ //#define WOLFSSL_SP_CACHE_RESISTANT
+ //#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
+
+ #if MDK_CONF_MATH == 4
+ /* SP Assembly Speedups - specific to chip type */
+ #define WOLFSSL_SP_ASM
+
+ //#define WOLFSSL_SP_ARM32_ASM
+ //#define WOLFSSL_SP_ARM64_ASM
+ //#define WOLFSSL_SP_ARM_THUMB_ASM
+ //#define WOLFSSL_SP_ARM_CORTEX_M_ASM
+ #endif
+#endif
+
+// Small Stack
+#define MDK_CONF_SmallStack 1
+#if MDK_CONF_SmallStack == 0
+ #define NO_WOLFSSL_SMALL_STACK
+ //#define WOLFSSL_SP_NO_MALLOC
+#else
+ #define WOLFSSL_SMALL_STACK
+#endif
+//
+//
+
// Others
// Inline
@@ -253,22 +307,9 @@
#define NO_ERROR_STRINGS
#endif
//
-
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 0
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#endif
-//
+//
-//
//
// <<< end of configuration section >>>
diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h
index 256fff09c1..51ddbae9b9 100644
--- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h
+++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h
@@ -202,7 +202,7 @@
#endif
//
// DSA
-#define MDK_CONF_DSA 1
+#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@@ -241,6 +241,60 @@
//
//
+// Math / Memory
+// Math Library
+// <0=>SP Math All (sp_int.c)
+// <1=>Fast Math (tfm.c)
+// <2=>Heap Math (integer.c)
+// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
+// <4=>SP Math +ASM (faster)
+#define MDK_CONF_MATH 0
+#if MDK_CONF_MATH == 0
+ #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
+#elif MDK_CONF_MATH == 1
+ #define USE_FAST_MATH
+#elif MDK_CONF_MATH == 2
+ #define USE_INTEGER_HEAP_MATH
+#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
+ #define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
+ #define WOLFSSL_HAVE_SP_RSA
+ #define WOLFSSL_HAVE_SP_DH
+ #define WOLFSSL_HAVE_SP_ECC
+
+ //#define WOLFSSL_SP_NO_2048
+ //#define WOLFSSL_SP_NO_3072
+ #define WOLFSSL_SP_4096
+ //#define WOLFSSL_SP_NO_256
+ //#define WOLFSSL_SP_384
+ //#define WOLFSSL_SP_521
+
+ #define WOLFSSL_SP_SMALL /* use smaller version of code */
+ //#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
+ //#define WOLFSSL_SP_CACHE_RESISTANT
+ //#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
+
+ #if MDK_CONF_MATH == 4
+ /* SP Assembly Speedups - specific to chip type */
+ #define WOLFSSL_SP_ASM
+
+ //#define WOLFSSL_SP_ARM32_ASM
+ //#define WOLFSSL_SP_ARM64_ASM
+ //#define WOLFSSL_SP_ARM_THUMB_ASM
+ //#define WOLFSSL_SP_ARM_CORTEX_M_ASM
+ #endif
+#endif
+
+// Small Stack
+#define MDK_CONF_SmallStack 1
+#if MDK_CONF_SmallStack == 0
+ #define NO_WOLFSSL_SMALL_STACK
+ //#define WOLFSSL_SP_NO_MALLOC
+#else
+ #define WOLFSSL_SMALL_STACK
+#endif
+//
+//
+
// Others
// Inline
@@ -291,20 +345,6 @@
#endif
//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 0
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#endif
-//
-
-
//
//
diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h
index 11f1de7e08..e693713c9f 100644
--- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h
+++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/config-RTX-TCP-FS.h
@@ -224,7 +224,7 @@
#endif
//
// DSA
-#define MDK_CONF_DSA 1
+#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@@ -263,6 +263,60 @@
//
//
+// Math / Memory
+// Math Library
+// <0=>SP Math All (sp_int.c)
+// <1=>Fast Math (tfm.c)
+// <2=>Heap Math (integer.c)
+// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
+// <4=>SP Math +ASM (faster)
+#define MDK_CONF_MATH 0
+#if MDK_CONF_MATH == 0
+ #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
+#elif MDK_CONF_MATH == 1
+ #define USE_FAST_MATH
+#elif MDK_CONF_MATH == 2
+ #define USE_INTEGER_HEAP_MATH
+#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
+ #define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
+ #define WOLFSSL_HAVE_SP_RSA
+ #define WOLFSSL_HAVE_SP_DH
+ #define WOLFSSL_HAVE_SP_ECC
+
+ //#define WOLFSSL_SP_NO_2048
+ //#define WOLFSSL_SP_NO_3072
+ #define WOLFSSL_SP_4096
+ //#define WOLFSSL_SP_NO_256
+ //#define WOLFSSL_SP_384
+ //#define WOLFSSL_SP_521
+
+ #define WOLFSSL_SP_SMALL /* use smaller version of code */
+ //#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
+ //#define WOLFSSL_SP_CACHE_RESISTANT
+ //#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
+
+ #if MDK_CONF_MATH == 4
+ /* SP Assembly Speedups - specific to chip type */
+ #define WOLFSSL_SP_ASM
+
+ //#define WOLFSSL_SP_ARM32_ASM
+ //#define WOLFSSL_SP_ARM64_ASM
+ //#define WOLFSSL_SP_ARM_THUMB_ASM
+ //#define WOLFSSL_SP_ARM_CORTEX_M_ASM
+ #endif
+#endif
+
+// Small Stack
+#define MDK_CONF_SmallStack 1
+#if MDK_CONF_SmallStack == 0
+ #define NO_WOLFSSL_SMALL_STACK
+ //#define WOLFSSL_SP_NO_MALLOC
+#else
+ #define WOLFSSL_SMALL_STACK
+#endif
+//
+//
+
// Others
// Inline
@@ -312,22 +366,6 @@
#define NO_ERROR_STRINGS
#endif
//
-
-// Small Stack
-#define MDK_CONF_SMALL_STACK 1
-#if MDK_CONF_SMALL_STACK == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-
-
//
//
diff --git a/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c b/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c
index b4d20bba80..de71e9941e 100644
--- a/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c
+++ b/IDE/MDK-ARM/MDK-ARM/wolfSSL/main.c
@@ -99,7 +99,7 @@ extern void benchmark_test(void) ;
extern void SER_Init(void) ;
/*-----------------------------------------------------------------------------
- * mian entry
+ * main entry
*----------------------------------------------------------------------------*/
/*** This is the parent task entry ***/
diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h
index 6aecf095e1..eb1b3b9b48 100644
--- a/IDE/MDK5-ARM/Conf/user_settings.h
+++ b/IDE/MDK5-ARM/Conf/user_settings.h
@@ -21,21 +21,20 @@
#define NO_MAIN_DRIVER
#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
#define SIZEOF_LONG_LONG 8
#define NO_WRITEV
#define NO_DEV_RANDOM
+#define WOLFSSL_IGNORE_FILE_WARN
#define TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#define WC_RSA_BLINDING
#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
+#define WOLFSSL_CURRTIME_OSTICK /* use OS tick for current_time */
#define WOLFSSL_GMTIME
-
#define NO_MULTIBYTE_PRINT
+
// <<< Use Configuration Wizard in Context Menu >>>
@@ -99,7 +98,7 @@
// File System
-#define MDK_CONF_FILESYSTEM 1
+#define MDK_CONF_FILESYSTEM 0
#if MDK_CONF_FILESYSTEM == 0
#define NO_FILESYSTEM
#else
@@ -109,7 +108,9 @@
//
// Network<0=>None <1=>RLnet <2=>User I/O
+#ifndef MDK_CONF_NETWORK
#define MDK_CONF_NETWORK 1
+#endif
#if MDK_CONF_NETWORK == 0
#elif MDK_CONF_NETWORK == 1
#define WOLFSSL_KEIL_TCP_NET
@@ -150,7 +151,7 @@
// wolfCrypt Configuration
-// Hash/Crypt Algrithm
+// Hash/Crypt Algorithm
// MD2
#define MDK_CONF_MD2 0
@@ -201,7 +202,7 @@
#endif
//
// RIPEMD
-#define MDK_CONF_RIPEMD 1
+#define MDK_CONF_RIPEMD 0
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
@@ -275,7 +276,7 @@
//
// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
+#define MDK_CONF_CAMELLIA 0
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
@@ -287,8 +288,19 @@
#define NO_DH
#endif
//
+
+// RSA
+#define MDK_CONF_RSA 1
+#if MDK_CONF_RSA == 1
+/* #define RSA_LOW_MEM */
+#else
+#define NO_RSA
+#endif
+//
+
+
// DSA
-#define MDK_CONF_DSA 1
+#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@@ -297,7 +309,7 @@
// SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
-#define HAVE_SRP
+#define WOLFCRYPT_HAVE_SRP
#endif
//
@@ -412,7 +424,7 @@
//
//
-// Cert/Key Strage
+// Cert/Key Storage
// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
#define MDK_CONF_CERT_BUFF 0
#if MDK_CONF_CERT_BUFF== 1
@@ -432,25 +444,64 @@
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
+#define WOLFSSL_OLD_PRIME_CHECK /* use older prime check (faster) */
#endif
//
//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
+
+// Math / Memory
+// Math Library
+// <0=>SP Math All (sp_int.c)
+// <1=>Fast Math (tfm.c)
+// <2=>Heap Math (integer.c)
+// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
+// <4=>SP Math +ASM (faster)
+#define MDK_CONF_MATH 0
+#if MDK_CONF_MATH == 0
+ #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
+#elif MDK_CONF_MATH == 1
+ #define USE_FAST_MATH
+#elif MDK_CONF_MATH == 2
+ #define USE_INTEGER_HEAP_MATH
+#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
+ #define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
+ #define WOLFSSL_HAVE_SP_RSA
+ #define WOLFSSL_HAVE_SP_DH
+ #define WOLFSSL_HAVE_SP_ECC
+
+ //#define WOLFSSL_SP_NO_2048
+ //#define WOLFSSL_SP_NO_3072
+ #define WOLFSSL_SP_4096
+ //#define WOLFSSL_SP_NO_256
+ //#define WOLFSSL_SP_384
+ //#define WOLFSSL_SP_521
+
+ #define WOLFSSL_SP_SMALL /* use smaller version of code */
+ //#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
+ //#define WOLFSSL_SP_CACHE_RESISTANT
+ //#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
+
+ #if MDK_CONF_MATH == 4
+ /* SP Assembly Speedups - specific to chip type */
+ #define WOLFSSL_SP_ASM
+
+ //#define WOLFSSL_SP_ARM32_ASM
+ //#define WOLFSSL_SP_ARM64_ASM
+ //#define WOLFSSL_SP_ARM_THUMB_ASM
+ //#define WOLFSSL_SP_ARM_CORTEX_M_ASM
+ #endif
#endif
-//
+
// Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
+ #define NO_WOLFSSL_SMALL_STACK
+#else
+ #define WOLFSSL_SMALL_STACK
#endif
-//
-
+//
+//
//
-
/**** wolfSSL Configuration ****/
@@ -465,6 +516,7 @@
#define WC_RSA_PSS
#define HAVE_HKDF
#define HAVE_FFDHE_2048
+//#define HAVE_FFDHE_3072
#endif
//
diff --git a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
index 673d45376a..e6d314a771 100644
--- a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
+++ b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
@@ -1,4 +1,4 @@
-/* wolfssl_KEIL_ARM.h
+/* wolfssl_MDK_ARM.h
*
* Copyright (C) 2006-2023 wolfSSL Inc.
*
@@ -70,7 +70,7 @@ typedef int socklen_t ;
#define tcp_listen wolfssl_tcp_listen
#define connect(a,b,c) connect(a, (SOCKADDR *)(b), c)
#define SOCKADDR struct sockaddr
-
+
/** KEIL-RL TCPnet ****/
/* TCPnet BSD socket does not have following functions. */
extern char *inet_ntoa(struct in_addr in);
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx
index e598c5563c..2b06bcce0b 100644
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx
+++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx
@@ -233,7 +233,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx
index 095377e603..3ef1956d19 100644
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx
+++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx
@@ -334,7 +334,7 @@
0
- USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS
+ USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS MDK_CONF_NETWORK=0
@@ -383,7 +383,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -791,7 +791,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index f206ad222c..0000000000
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define WOLFSSL_MDK5_COMPLv5
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS<4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet<9=>MQX
-// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others
-#define MDK_CONF_THREAD 15
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define WOLFSSL_CMSIS_RTOSv2
-#elif MDK_CONF_THREAD == 16
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 0
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c
index 002677f67b..1b055e7fa0 100644
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c
+++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c
@@ -37,11 +37,11 @@
#endif
/* Dummy definition for test RTC */
-#define RTC_YEAR 2019
+#define RTC_YEAR 2023
#define RTC_MONTH 1
-#define RTC_DAY 1
+#define RTC_DAY 1
#define RTC_MONTH 1
-#define RTC_DAY 1
+#define RTC_DAY 1
#if defined(STM32F7xx)
#include "stm32f7xx_hal.h"
@@ -72,22 +72,22 @@ extern uint32_t os_time;
uint32_t HAL_GetTick(void)
{
- #if defined(WOLFSSL_CMSIS_RTOS)
- return os_time;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return osKernelGetTickCount();
- #endif
+ #if defined(WOLFSSL_CMSIS_RTOS)
+ return os_time;
+ #elif defined(WOLFSSL_CMSIS_RTOSv2)
+ return osKernelGetTickCount();
+ #endif
}
double current_time(int reset)
{
if (reset)
return 0;
- #if defined(WOLFSSL_CMSIS_RTOS)
- return (double)os_time / 1000.0;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return (double)osKernelGetTickCount() / 1000.0;
- #endif
+#if defined(WOLFSSL_CMSIS_RTOS)
+ return (double)os_time / 1000.0;
+#elif defined(WOLFSSL_CMSIS_RTOSv2)
+ return (double)osKernelGetTickCount() / 1000.0;
+#endif
}
#else
@@ -96,28 +96,28 @@ double current_time(int reset)
#define DWT ((DWT_Type *) (0xE0001000UL) )
typedef struct
{
- uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
- uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
} DWT_Type;
-extern uint32_t SystemCoreClock ;
+extern uint32_t SystemCoreClock;
double current_time(int reset)
{
- if(reset) DWT->CYCCNT = 0 ;
- return ((double)DWT->CYCCNT/SystemCoreClock) ;
+ if (reset) DWT->CYCCNT = 0;
+ return ((double)DWT->CYCCNT/SystemCoreClock);
}
#endif
static time_t epochTime;
time_t time(time_t *t)
{
- return epochTime;
+ return epochTime;
}
void setTime(time_t t)
{
- epochTime = t;
+ epochTime = t;
}
/*-----------------------------------------------------------------------------
@@ -126,48 +126,51 @@ void setTime(time_t t)
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
-static void init_filesystem (void) {
- int32_t retv;
+static void init_filesystem(void)
+{
+ int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
+ retv = finit ("M0:");
if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
/*-----------------------------------------------------------------------------
- * mian entry
+ * main entry
*----------------------------------------------------------------------------*/
-void benchmark_test(void *arg) ;
+void benchmark_test(void *arg);
int main()
{
- void * arg = NULL ;
-
- MPU_Config();
+ void * arg = NULL;
+
+ MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
- #if !defined(NO_FILESYSTEM)
+#if !defined(NO_FILESYSTEM)
init_filesystem ();
- #endif
-
- setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
+#endif
- printf("=== Start: Crypt Benchmark ===\n") ;
- benchmark_test(arg) ;
- printf("=== End: Crypt Benchmark ===\n") ;
+ setTime((RTC_YEAR-1970)*365*24*60*60 +
+ RTC_MONTH*30*24*60*60 +
+ RTC_DAY*24*60*60);
-}
+ printf("=== Start: Crypt Benchmark ===\n");
+ benchmark_test(arg);
+ printf("=== End: Crypt Benchmark ===\n");
+ return 0;
+}
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx
index e3db5d5341..59202259cb 100644
--- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx
+++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx
@@ -298,7 +298,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx
index 8e4dcd595a..6c1d17fe57 100644
--- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx
+++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx
@@ -334,7 +334,7 @@
0
- USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS
+ USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS MDK_CONF_NETWORK=0
@@ -413,7 +413,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -760,14 +760,8 @@
-
- RTE\wolfSSL\config-Crypt.h
-
-
-
-
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index 80af5e2f7a..0000000000
--- a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet <9=>MQX
-// <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
-#define MDK_CONF_THREAD 15
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define WOLFSSL_CMSIS_RTOSv2
-#elif MDK_CONF_THREAD == 16
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 0
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/main.c b/IDE/MDK5-ARM/Projects/CryptTest/main.c
index 3222cc5dad..6425e654e5 100644
--- a/IDE/MDK5-ARM/Projects/CryptTest/main.c
+++ b/IDE/MDK5-ARM/Projects/CryptTest/main.c
@@ -34,9 +34,9 @@
#include "cmsis_os2.h"
#endif
/* Dummy definition for test RTC */
-#define RTC_YEAR 2019
+#define RTC_YEAR 2023
#define RTC_MONTH 1
-#define RTC_DAY 1
+#define RTC_DAY 1
#if defined(STM32F7xx)
#include "stm32f7xx_hal.h"
@@ -65,19 +65,19 @@ extern uint32_t os_time;
#endif
uint32_t HAL_GetTick(void) {
- #if defined(WOLFSSL_CMSIS_RTOS)
- return os_time;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return osKernelGetTickCount();
- #endif
+#if defined(WOLFSSL_CMSIS_RTOS)
+ return os_time;
+#elif defined(WOLFSSL_CMSIS_RTOSv2)
+ return osKernelGetTickCount();
+#endif
}
static time_t epochTime;
-time_t time(time_t *t){
- return epochTime ;
+time_t time(time_t *t) {
+ return epochTime;
}
-void setTime(time_t t){
+void setTime(time_t t) {
epochTime = t;
}
@@ -87,48 +87,52 @@ void setTime(time_t t){
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
-static void init_filesystem (void) {
- int32_t retv;
+static void init_filesystem(void)
+{
+ int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
+ retv = finit ("M0:");
if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
/*-----------------------------------------------------------------------------
- * mian entry
+ * main entry
*----------------------------------------------------------------------------*/
-void wolfcrypt_test(void *arg) ;
+void wolfcrypt_test(void *arg);
int main()
{
- void * arg = NULL ;
+ void * arg = NULL;
- MPU_Config();
+ MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
- #if !defined(NO_FILESYSTEM)
+#if !defined(NO_FILESYSTEM)
init_filesystem ();
- #endif
+#endif
- setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
+ setTime((RTC_YEAR-1970)*365*24*60*60 +
+ RTC_MONTH*30*24*60*60 +
+ RTC_DAY*24*60*60);
- printf("=== Start: Crypt test === \n") ;
- wolfcrypt_test(arg) ;
- printf("=== End: Crypt test ===\n") ;
+ printf("=== Start: Crypt test === \n");
+ wolfcrypt_test(arg);
+ printf("=== End: Crypt test ===\n");
+ return 0;
}
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx
index 0348f08346..8a7d23a38e 100644
--- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx
+++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx
@@ -328,7 +328,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx
index fdaf171556..735b3c8af7 100644
--- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx
+++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx
@@ -413,7 +413,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -880,7 +880,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index 4a714d7e1e..0000000000
--- a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,495 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet <9=>MQX
-// <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
-#define MDK_CONF_THREAD 14
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 1
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/main.c b/IDE/MDK5-ARM/Projects/EchoClient/main.c
index 63d87dc0ed..22f27cb153 100644
--- a/IDE/MDK5-ARM/Projects/EchoClient/main.c
+++ b/IDE/MDK5-ARM/Projects/EchoClient/main.c
@@ -26,7 +26,7 @@
#include "wolfssl/wolfcrypt/settings.h"
#include "cmsis_os.h" /* CMSIS RTOS definitions */
-#include "rl_net.h" /* Network definitions */
+#include "rl_net.h" /* Network definitions */
#include
#if defined(STM32F7xx)
@@ -40,12 +40,9 @@
//-------- <<< Use Configuration Wizard in Context Menu >>> -----------------
// RTC: for validate certificate date
-// Year <1970-2099>
-#define RTC_YEAR 2018
-// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec
+#define RTC_YEAR 2023
#define RTC_MONTH 1
-// Day <1-31>
-#define RTC_DAY 1
+#define RTC_DAY 1
//
//------------- <<< end of configuration section >>> -----------------------
@@ -69,29 +66,30 @@ static void CPU_CACHE_Enable (void) {
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
-static void init_filesystem (void) {
- int32_t retv;
+static void init_filesystem(void)
+{
+ int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
+ retv = finit ("M0:");
if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
void net_loop(void const *arg)
{
- while(1) {
+ while (1) {
net_main ();
osThreadYield ();
}
@@ -103,8 +101,8 @@ osThreadDef(net_loop, osPriorityLow, 2, 0);
extern uint32_t os_time;
static time_t epochTime;
-uint32_t HAL_GetTick(void) {
- return os_time;
+uint32_t HAL_GetTick(void) {
+ return os_time;
}
time_t time(time_t *t){
@@ -133,15 +131,15 @@ double current_time(int reset)
#define DWT ((DWT_Type *) (0xE0001000UL) )
typedef struct
{
- uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
- uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
} DWT_Type;
extern uint32_t SystemCoreClock ;
double current_time(int reset)
{
- if(reset) DWT->CYCCNT = 0 ;
+ if (reset) DWT->CYCCNT = 0 ;
return ((double)DWT->CYCCNT/SystemCoreClock) ;
}
#endif
@@ -160,20 +158,21 @@ extern void echoclient_test(func_args * args) ;
int myoptind = 0;
char* myoptarg = NULL;
-int main (void) {
+int main (void)
+{
static char *argv[] =
{ "client" } ;
static func_args args =
{ 1, argv } ;
- MPU_Config(); /* Configure the MPU */
- CPU_CACHE_Enable(); /* Enable the CPU Cache */
- HAL_Init(); /* Initialize the HAL Library */
- SystemClock_Config(); /* Configure the System Clock */
+ MPU_Config(); /* Configure the MPU */
+ CPU_CACHE_Enable(); /* Enable the CPU Cache */
+ HAL_Init(); /* Initialize the HAL Library */
+ SystemClock_Config(); /* Configure the System Clock */
- #if !defined(NO_FILESYSTEM)
+#if !defined(NO_FILESYSTEM)
init_filesystem ();
- #endif
+#endif
net_initialize ();
#if defined(DEBUG_WOLFSSL)
@@ -181,14 +180,15 @@ int main (void) {
wolfSSL_Debugging_ON() ;
#endif
- setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
+ setTime((RTC_YEAR-1970)*365*24*60*60 +
+ RTC_MONTH*30*24*60*60 +
+ RTC_DAY*24*60*60);
osThreadCreate (osThread(net_loop), NULL);
echoclient_test(&args) ;
- while(1)
+ while (1) {
osDelay(1000);
-
+ }
}
-
diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx
index 78b6935496..65e7c61c8d 100644
--- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx
+++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx
@@ -279,7 +279,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx
index 0650169d96..9471fa6b89 100644
--- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx
+++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx
@@ -413,7 +413,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -886,7 +886,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index f4c47bf794..0000000000
--- a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet <9=>MQX
-// <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
-#define MDK_CONF_THREAD 14
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define WOLFSSL_CMSIS_RTOSv2
-#elif MDK_CONF_THREAD == 16
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 1
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/EchoServer/main.c b/IDE/MDK5-ARM/Projects/EchoServer/main.c
index deb800f8a6..53a27bec00 100644
--- a/IDE/MDK5-ARM/Projects/EchoServer/main.c
+++ b/IDE/MDK5-ARM/Projects/EchoServer/main.c
@@ -26,7 +26,7 @@
#include "wolfssl/wolfcrypt/settings.h"
#include "cmsis_os.h" /* CMSIS RTOS definitions */
-#include "rl_net.h" /* Network definitions */
+#include "rl_net.h" /* Network definitions */
#include
#if defined(STM32F7xx)
@@ -58,12 +58,9 @@
//
// RTC: for validate certificate date
-// Year <1970-2099>
-#define RTC_YEAR 2018
-// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec
+#define RTC_YEAR 2023
#define RTC_MONTH 1
-// Day <1-31>
-#define RTC_DAY 1
+#define RTC_DAY 1
//
//------------- <<< end of configuration section >>> -----------------------
@@ -88,22 +85,23 @@ static void CPU_CACHE_Enable (void) {
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
-static void init_filesystem (void) {
- int32_t retv;
+static void init_filesystem(void)
+{
+ int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
+ retv = finit ("M0:");
if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
@@ -120,20 +118,20 @@ osThreadDef(net_loop, osPriorityLow, 2, 0);
#ifdef RTE_CMSIS_RTOS_RTX
extern uint32_t os_time;
-static time_t epochTime;
+static time_t epochTime;
-uint32_t HAL_GetTick(void) {
- return os_time;
+uint32_t HAL_GetTick(void) {
+ return os_time;
}
-time_t time(time_t *t){
- return epochTime ;
+time_t time(time_t *t) {
+ return epochTime;
}
-void setTime(time_t t){
+void setTime(time_t t) {
epochTime = t;
}
-#endif
+#endif /* RTE_CMSIS_RTOS_RTX */
#ifdef WOLFSSL_CURRTIME_OSTICK
@@ -143,28 +141,27 @@ extern uint32_t os_time;
double current_time(int reset)
{
- if(reset) os_time = 0 ;
- return (double)os_time /1000.0;
+ if (reset) os_time = 0;
+ return (double)os_time /1000.0;
}
#else
#include
#define DWT ((DWT_Type *) (0xE0001000UL) )
-typedef struct
-{
- uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
- uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+typedef struct {
+ uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
} DWT_Type;
-extern uint32_t SystemCoreClock ;
+extern uint32_t SystemCoreClock;
double current_time(int reset)
{
- if(reset) DWT->CYCCNT = 0 ;
- return ((double)DWT->CYCCNT/SystemCoreClock) ;
+ if (reset) DWT->CYCCNT = 0;
+ return ((double)DWT->CYCCNT/SystemCoreClock);
}
-#endif
+#endif /* WOLFSSL_CURRTIME_OSTICK */
/*----------------------------------------------------------------------------
Main Thread 'main': Run Network
@@ -175,39 +172,42 @@ typedef struct func_args {
char** argv;
} func_args;
-extern void echoserver_test(func_args * args) ;
+extern void echoserver_test(func_args * args);
int myoptind = 0;
char* myoptarg = NULL;
-int main (void) {
+int main (void)
+{
static char *argv[] =
- { "server" } ;
- static func_args args = { 1, argv } ;
+ { "server" };
+ static func_args args = { 1, argv };
- MPU_Config(); /* Configure the MPU */
- CPU_CACHE_Enable(); /* Enable the CPU Cache */
- HAL_Init(); /* Initialize the HAL Library */
- SystemClock_Config(); /* Configure the System Clock */
+ MPU_Config(); /* Configure the MPU */
+ CPU_CACHE_Enable(); /* Enable the CPU Cache */
+ HAL_Init(); /* Initialize the HAL Library */
+ SystemClock_Config(); /* Configure the System Clock */
- #if !defined(NO_FILESYSTEM)
+#if !defined(NO_FILESYSTEM)
init_filesystem ();
- #endif
+#endif
net_initialize ();
- #if defined(DEBUG_WOLFSSL)
- printf("Turning ON Debug message\n") ;
- wolfSSL_Debugging_ON() ;
- #endif
+#if defined(DEBUG_WOLFSSL)
+ printf("Turning ON Debug message\n");
+ wolfSSL_Debugging_ON();
+#endif
- setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
+ setTime((RTC_YEAR-1970)*365*24*60*60 +
+ RTC_MONTH*30*24*60*60 +
+ RTC_DAY*24*60*60);
osThreadCreate (osThread(net_loop), NULL);
- echoserver_test(&args) ;
- printf("echoserver: Terminated\n") ;
- while(1)
- osDelay(1000);
+ echoserver_test(&args);
+ printf("echoserver: Terminated\n");
+ while (1) {
+ osDelay(1000);
+ }
}
-
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index c14e47240e..0000000000
--- a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet <9=>MQX
-// <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
-#define MDK_CONF_THREAD 15
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define WOLFSSL_CMSIS_RTOSv2
-#elif MDK_CONF_THREAD == 16
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 1
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx
index 38fdb54080..47f64d8b7b 100644
--- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx
+++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx
@@ -298,7 +298,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx
index 913abe82b7..7bf9356eb9 100644
--- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx
+++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx
@@ -413,7 +413,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -912,7 +912,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/main.c b/IDE/MDK5-ARM/Projects/SimpleClient/main.c
index 4345458538..0461547014 100644
--- a/IDE/MDK5-ARM/Projects/SimpleClient/main.c
+++ b/IDE/MDK5-ARM/Projects/SimpleClient/main.c
@@ -68,12 +68,9 @@
//
// RTC: for validate certificate date
-// Year <1970-2099>
-#define RTC_YEAR 2019
-// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aug<9=>Sep<10=>Oct<11=>Nov<12=>Dec
+#define RTC_YEAR 2023
#define RTC_MONTH 1
-// Day <1-31>
-#define RTC_DAY 1
+#define RTC_DAY 1
//
//------------- <<< end of configuration section >>> -----------------------
@@ -96,19 +93,19 @@ extern uint32_t os_time;
#endif
uint32_t HAL_GetTick(void) {
- #if defined(WOLFSSL_CMSIS_RTOS)
- return os_time;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return osKernelGetTickCount();
- #endif
+#if defined(WOLFSSL_CMSIS_RTOS)
+ return os_time;
+#elif defined(WOLFSSL_CMSIS_RTOSv2)
+ return osKernelGetTickCount();
+#endif
}
static time_t epochTime;
-time_t time(time_t *t){
- return epochTime ;
+time_t time(time_t *t) {
+ return epochTime;
}
-void setTime(time_t t){
+void setTime(time_t t) {
epochTime = t;
}
@@ -129,22 +126,23 @@ double current_time(int reset)
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
-static void init_filesystem (void) {
- int32_t retv;
+static void init_filesystem(void)
+{
+ int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
+ retv = finit ("M0:");
if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
@@ -156,9 +154,10 @@ void app_main(void *arg)
void app_main(void const*arg)
#endif
{
- if(netInitialize () == netOK)
- client_test(arg);
- else printf("ERROR: netInitialize\n");
+ if (netInitialize () == netOK)
+ client_test(arg);
+ else
+ printf("ERROR: netInitialize\n");
}
#if defined(WOLFSSL_CMSIS_RTOS)
@@ -178,48 +177,51 @@ typedef struct func_args {
int myoptind = 0;
char* myoptarg = NULL;
-int main (void) {
+int main (void)
+{
static char *argv[] =
{ "client", "-h", REMOTE_IP, "-p", REMOTE_PORT,
- "-v", " ", OTHER_OPTIONS } ;
+ "-v", " ", OTHER_OPTIONS };
static func_args args =
- { sizeof(argv)/sizeof(*argv[0]), argv } ;
+ { sizeof(argv)/sizeof(*argv[0]), argv };
char *verStr[] = { "SSL3", "TLS1.0", "TLS1.1", "TLS1.2", "TLS1.3"};
#define VERSIZE 2
static char ver[VERSIZE];
-
- MPU_Config(); /* Configure the MPU */
- CPU_CACHE_Enable(); /* Enable the CPU Cache */
- HAL_Init(); /* Initialize the HAL Library */
- SystemClock_Config(); /* Configure the System Clock */
- #if defined(WOLFSSL_CMSIS_RTOSv2)
+
+ MPU_Config(); /* Configure the MPU */
+ CPU_CACHE_Enable(); /* Enable the CPU Cache */
+ HAL_Init(); /* Initialize the HAL Library */
+ SystemClock_Config(); /* Configure the System Clock */
+#if defined(WOLFSSL_CMSIS_RTOSv2)
osKernelInitialize();
- #endif
-
- #if !defined(NO_FILESYSTEM)
+#endif
+
+#if !defined(NO_FILESYSTEM)
init_filesystem ();
- #endif
+#endif
- #if defined(DEBUG_WOLFSSL)
- printf("Turning ON Debug message\n") ;
- wolfSSL_Debugging_ON() ;
- #endif
+#if defined(DEBUG_WOLFSSL)
+ printf("Turning ON Debug message\n");
+ wolfSSL_Debugging_ON();
+#endif
snprintf(ver, VERSIZE, "%d", TLS_VER);
argv[6] = ver;
- printf("SSL/TLS Client(%d)\n ", (int)(sizeof(argv)/sizeof(argv[0]))) ;
- printf(" Remote IP: %s, Port: %s\n Version: %s\n", argv[2], argv[4], verStr[TLS_VER]) ;
- printf(" Other options: %s\n", OTHER_OPTIONS);
- setTime((time_t)((RTC_YEAR-1970)*365*24*60*60) + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
-
- #if defined(WOLFSSL_CMSIS_RTOS)
- osThreadCreate (osThread(app_main), (void *)&args);
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- osThreadNew(app_main, (void *)&args, NULL);
- #endif
- osKernelStart();
+ printf("SSL/TLS Client(%d)\n ", (int)(sizeof(argv)/sizeof(argv[0])));
+ printf(" Remote IP: %s, Port: %s\n Version: %s\n",
+ argv[2], argv[4], verStr[TLS_VER]);
+ printf(" Other options: %s\n", OTHER_OPTIONS);
+ setTime((time_t)((RTC_YEAR-1970)*365*24*60*60) +
+ RTC_MONTH*30*24*60*60 +
+ RTC_DAY*24*60*60);
+#if defined(WOLFSSL_CMSIS_RTOS)
+ osThreadCreate (osThread(app_main), (void *)&args);
+#elif defined(WOLFSSL_CMSIS_RTOSv2)
+ osThreadNew(app_main, (void *)&args, NULL);
+#endif
+ osKernelStart();
}
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index c14e47240e..0000000000
--- a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet <9=>MQX
-// <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
-#define MDK_CONF_THREAD 15
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define WOLFSSL_CMSIS_RTOSv2
-#elif MDK_CONF_THREAD == 16
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 1
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx
index 793053daf5..2f13b80690 100644
--- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx
+++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx
@@ -298,7 +298,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx
index 33c84cb0ee..659c22d0aa 100644
--- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx
+++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx
@@ -413,7 +413,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -912,7 +912,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/main.c b/IDE/MDK5-ARM/Projects/SimpleServer/main.c
index 3f8c196cde..973fdbbe1d 100644
--- a/IDE/MDK5-ARM/Projects/SimpleServer/main.c
+++ b/IDE/MDK5-ARM/Projects/SimpleServer/main.c
@@ -66,11 +66,9 @@
// RTC: for validate certificate date
// Year <1970-2099>
-#define RTC_YEAR 2019
-// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec
+#define RTC_YEAR 2023
#define RTC_MONTH 1
-// Day <1-31>
-#define RTC_DAY 1
+#define RTC_DAY 1
//
//------------- <<< end of configuration section >>> -----------------------
@@ -94,22 +92,23 @@ static void CPU_CACHE_Enable (void) {
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
-static void init_filesystem (void) {
- int32_t retv;
+static void init_filesystem(void)
+{
+ int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
+ retv = finit ("M0:");
if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
@@ -121,20 +120,20 @@ extern uint32_t os_time;
uint32_t HAL_GetTick(void)
{
- #if defined(WOLFSSL_CMSIS_RTOS)
- return os_time;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return osKernelGetTickCount();
- #endif
+#if defined(WOLFSSL_CMSIS_RTOS)
+ return os_time;
+#elif defined(WOLFSSL_CMSIS_RTOSv2)
+ return osKernelGetTickCount();
+#endif
}
double current_time(int reset)
{
- #if defined(WOLFSSL_CMSIS_RTOS)
- return (double)os_time / 1000.0;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return (double)osKernelGetTickCount() / 1000.0;
- #endif
+#if defined(WOLFSSL_CMSIS_RTOS)
+ return (double)os_time / 1000.0;
+#elif defined(WOLFSSL_CMSIS_RTOSv2)
+ return (double)osKernelGetTickCount() / 1000.0;
+#endif
}
#else
@@ -143,8 +142,8 @@ double current_time(int reset)
#define DWT ((DWT_Type *) (0xE0001000UL) )
typedef struct
{
- uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
- uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
} DWT_Type;
extern uint32_t SystemCoreClock;
@@ -203,22 +202,22 @@ int main(void)
{
static char *argv[] =
{ "server", "-p", SERVER_PORT,
- "-v", " ", OTHER_OPTIONS } ;
+ "-v", " ", OTHER_OPTIONS };
static func_args args =
- { sizeof(argv)/sizeof(*argv[0]), argv } ;
+ { sizeof(argv)/sizeof(*argv[0]), argv };
char *verStr[] = { "SSL3", "TLS1.0", "TLS1.1", "TLS1.2", "TLS1.3"};
#define VERSIZE 2
char ver[VERSIZE];
-
+
MPU_Config(); /* Configure the MPU */
CPU_CACHE_Enable(); /* Enable the CPU Cache */
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
- #if !defined(NO_FILESYSTEM)
+#if !defined(NO_FILESYSTEM)
init_filesystem ();
- #endif
+#endif
#if defined(WOLFSSL_CMSIS_RTOSv2)
osKernelInitialize();
@@ -232,10 +231,12 @@ int main(void)
snprintf(ver, VERSIZE, "%d", TLS_VER);
argv[4] = ver;
- printf("SSL/TLS Server\n ") ;
- printf(" Server Port: %s\n Version: %s\n", argv[2], verStr[TLS_VER]) ;
- printf(" Other options: %s\n", OTHER_OPTIONS);
- setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
+ printf("SSL/TLS Server\n ");
+ printf(" Server Port: %s\n Version: %s\n", argv[2], verStr[TLS_VER]);
+ printf(" Other options: %s\n", OTHER_OPTIONS);
+ setTime((RTC_YEAR-1970)*365*24*60*60 +
+ RTC_MONTH*30*24*60*60 +
+ RTC_DAY*24*60*60);
#if defined(WOLFSSL_CMSIS_RTOS)
osThreadCreate(osThread(app_main), (void *)&args);
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c
index 43bd729807..7eed772050 100644
--- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c
@@ -51,22 +51,24 @@ void SystemClock_Config(void) {
*----------------------------------------------------------------------------*/
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h"
-static void init_filesystem (void) {
- int32_t retv;
-
- retv = finit ("M0:");
- if (retv == 0) {
- retv = fmount ("M0:");
- if (retv == 0) {
- printf ("Drive M0 ready!\n");
+
+static void init_filesystem(void)
+{
+ int32_t retv;
+
+ retv = finit ("M0:");
+ if (retv == fsOK) {
+ retv = fmount ("M0:");
+ if (retv == fsOK) {
+ printf ("Drive M0 ready!\n");
+ }
+ else {
+ printf ("Drive M0 mount failed(%d)!\n", retv);
+ }
}
else {
- printf ("Drive M0 mount failed!\n");
+ printf ("Drive M0 initialization failed!\n");
}
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
}
#endif
@@ -76,31 +78,31 @@ typedef struct func_args {
} func_args;
-extern void shell_main(func_args * args) ;
+extern void shell_main(func_args * args);
/*-----------------------------------------------------------------------------
- * mian entry
+ * main entry
*----------------------------------------------------------------------------*/
int myoptind = 0;
char* myoptarg = NULL;
int main()
{
- void *arg = NULL ;
+ void *arg = NULL;
- SystemClock_Config() ;
+ SystemClock_Config();
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
- netInitialize() ;
- osDelay(300) ;
+ netInitialize();
+ osDelay(300);
- #if defined(DEBUG_WOLFSSL)
- printf("Turning ON Debug message\n") ;
- wolfSSL_Debugging_ON() ;
- #endif
+#if defined(DEBUG_WOLFSSL)
+ printf("Turning ON Debug message\n");
+ wolfSSL_Debugging_ON();
+#endif
- shell_main(arg) ;
+ shell_main(arg);
}
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
index 91b3e7f9a1..7aac8af8bc 100644
--- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
@@ -300,7 +300,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx
index e383032536..919e7464cc 100644
--- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx
@@ -441,7 +441,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -972,7 +972,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h
deleted file mode 100644
index c14e47240e..0000000000
--- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* user_settings.h
- *
- * Copyright (C) 2006-2023 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 2 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
- */
-
-#define NO_MAIN_DRIVER
-#define BENCH_EMBEDDED
-#define NO_DEV_RANDOM
-#define WOLFSSL_USER_CURRTIME
-#define SIZEOF_LONG_LONG 8
-#define NO_WRITEV
-#define NO_DEV_RANDOM
-
-#define TFM_TIMING_RESISTANT
-#define ECC_TIMING_RESISTANT
-#define WC_RSA_BLINDING
-
-#define WOLFSSL_USER_CURRTIME /* for benchmark */
-#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */
-#define WOLFSSL_GMTIME
-#define NO_MULTIBYTE_PRINT
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-
-// Common options
-// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx
-#define MDK_CONF_MPU 3
-#if MDK_CONF_MPU == 0
-
-#elif MDK_CONF_MPU == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F2xx
-#elif MDK_CONF_MPU == 2
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F4xx
-#elif MDK_CONF_MPU == 3
-#define WOLFSSL_STM32_CUBEMX
-#define STM32F7xx
-#endif
-
-// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
-// <5=>PThread <6=>ThreadX
-// <7=>Micrium <8=>EBSnet <9=>MQX
-// <10=>T-RTOS <11=>uITRON4 <12=>uTKERNEL2
-// <13=>Frosted <14=>CMSIS RTOS <15=>CMSIS RTOSv2 <16=>Others
-#define MDK_CONF_THREAD 15
-#if MDK_CONF_THREAD== 0
-#define SINGLE_THREADED
-#elif MDK_CONF_THREAD == 1
-#define FREERTOS
-#elif MDK_CONF_THREAD == 3
-#define WOLFSSL_SAFERTOS
-#elif MDK_CONF_THREAD == 4
-#define USE_WINDOWS_API
-#elif MDK_CONF_THREAD == 5
-#define WOLFSSL_PTHREADS
-#elif MDK_CONF_THREAD == 6
-#define THREADX
-#define NETX
-#elif MDK_CONF_THREAD == 7
-#define MICRIUM
-#elif MDK_CONF_THREAD == 8
-#define EBSNET
-#elif MDK_CONF_THREAD == 9
-#define FREESCALE_MQX
-#define FREESCALE_KSDK_MQX
-#elif MDK_CONF_THREAD == 10
-#define WOLFSSL_TIRTOS
-#elif MDK_CONF_THREAD == 11
-#define WOLFSSL_uITRON4
-#elif MDK_CONF_THREAD == 12
-#define WOLFSSL_uTKERNEL2
-#elif MDK_CONF_THREAD == 13
-#define WOLFSSL_FROSTED
-#elif MDK_CONF_THREAD == 14
-#define WOLFSSL_CMSIS_RTOS
-#elif MDK_CONF_THREAD == 15
-#define WOLFSSL_CMSIS_RTOSv2
-#elif MDK_CONF_THREAD == 16
-#define SINGLE_THREADED
-#endif
-
-
-// File System
-#define MDK_CONF_FILESYSTEM 1
-#if MDK_CONF_FILESYSTEM == 0
-#define NO_FILESYSTEM
-#else
-#define WOLFSSL_KEIL_FS
-#define NO_WOLFSSL_DIR
-#endif
-//
-
-// Network<0=>None <1=>RLnet <2=>User I/O
-#define MDK_CONF_NETWORK 1
-#if MDK_CONF_NETWORK == 0
-#elif MDK_CONF_NETWORK == 1
-#define WOLFSSL_KEIL_TCP_NET
-#elif MDK_CONF_NETWORK == 2
-#define WOLFSSL_USER_IO
-#endif
-
-// Debug options
-
-// Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_WOLFSSL
-#endif
-//
-// Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define WOLFSSL_MALLOC_CHECK
-#define USE_WOLFSSL_MEMORY
-#endif
-//
-// ErrNo.h
-#define MDK_CONF_ErrNo 1
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//
-// Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//
-
-//
-//
-
-// wolfCrypt Configuration
-
-// Hash/Crypt Algrithm
-
-// MD2
-#define MDK_CONF_MD2 0
-#if MDK_CONF_MD2 == 1
-#define WOLFSSL_MD2
-#endif
-//
-// MD4
-#define MDK_CONF_MD4 0
-#if MDK_CONF_MD4 == 0
-#define NO_MD4
-#endif
-//
-// MD5
-#define MDK_CONF_MD5 1
-#if MDK_CONF_MD5 == 0
-#define NO_MD5
-#endif
-//
-// SHA
-#define MDK_CONF_SHA 1
-#if MDK_CONF_SHA == 0
-#define NO_SHA
-#endif
-//
-// SHA-256
-#define MDK_CONF_SHA256 1
-#if MDK_CONF_SHA256 == 0
-#define NO_SHA256
-#endif
-//
-// SHA-384
-#define MDK_CONF_SHA384 1
-#if MDK_CONF_SHA384 == 1
-#define WOLFSSL_SHA384
-#endif
-//
-// SHA-512
-#define MDK_CONF_SHA512 1
-#if MDK_CONF_SHA512 == 1
-#define WOLFSSL_SHA512
-#endif
-//
-// Hash DRBG
-#define MDK_CONF_HASHDRBG 1
-#if MDK_CONF_HASHDRBG == 1
-#define HAVE_HASHDRBG
-#endif
-//
-// RIPEMD
-#define MDK_CONF_RIPEMD 1
-#if MDK_CONF_RIPEMD == 1
-#define WOLFSSL_RIPEMD
-#endif
-//
-// BLAKE2
-#define MDK_CONF_BLAKE2 0
-#if MDK_CONF_BLAKE2 == 1
-#define HAVE_BLAKE2
-#endif
-//
-// HMAC
-#define MDK_CONF_HMAC 1
-#if MDK_CONF_HMAC == 0
-#define NO_HMAC
-#endif
-//
-// HMAC KDF
-#define MDK_CONF_HKDF 1
-#if MDK_CONF_HKDF == 1
-#define HAVE_HKDF
-#endif
-//
-
-// AES CCM
-#define MDK_CONF_AESCCM 1
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
-#endif
-//
-// AES GCM
-#define MDK_CONF_AESGCM 1
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#endif
-//
-
-// RC4
-#define MDK_CONF_RC4 0
-#if MDK_CONF_RC4 == 0
-#define NO_RC4
-#endif
-//
-
-// CHACHA
-#define MDK_CONF_CHACHA 1
-#if MDK_CONF_CHACHA == 1
-#define HAVE_CHACHA
-#endif
-//
-
-// POLY1305
-#define MDK_CONF_POLY1305 1
-#if MDK_CONF_POLY1305 == 1
-#define HAVE_POLY1305
-#define HAVE_ONE_TIME_AUTH
-#endif
-//
-
-// DES3
-#define MDK_CONF_DES3 1
-#if MDK_CONF_DES3 == 0
-#define NO_DES3
-#endif
-//
-
-// AES
-#define MDK_CONF_AES 1
-#if MDK_CONF_AES == 0
-#define NO_AES
-#endif
-//
-
-// CAMELLIA
-#define MDK_CONF_CAMELLIA 1
-#if MDK_CONF_CAMELLIA == 1
-#define HAVE_CAMELLIA
-#endif
-//
-
-// DH
-#define MDK_CONF_DH 1
-#if MDK_CONF_DH == 0
-#define NO_DH
-#endif
-//
-// DSA
-#define MDK_CONF_DSA 1
-#if MDK_CONF_DSA == 0
-#define NO_DSA
-#endif
-//
-
-// SRP
-#define MDK_CONF_SRP 1
-#if MDK_CONF_SRP == 1
-#define HAVE_SRP
-#endif
-//
-
-// PWDBASED
-#define MDK_CONF_PWDBASED 1
-#if MDK_CONF_PWDBASED == 0
-#define NO_PWDBASED
-#endif
-//
-
-// ECC
-#define MDK_CONF_ECC 1
-#if MDK_CONF_ECC == 1
-#define HAVE_ECC
-#endif
-//
-
-// CURVE25519
-#define MDK_CONF_CURVE25519 1
-#if MDK_CONF_CURVE25519 == 1
-#define HAVE_CURVE25519
-#define CURVED25519_SMALL
-#endif
-//
-// CURVE25519 SMALL
-#define MDK_CONF_CURVE25519_SMALL 0
-#if MDK_CONF_CURVE25519_SMALL == 1
-#define CURVED25519_SMALL
-#endif
-//
-// ED25519
-#define MDK_CONF_ED25519 1
-#if MDK_CONF_ED25519 == 1
-#define HAVE_ED25519
-#endif
-//
-// ED25519 SMALL
-#define MDK_CONF_ED25519_SMALL 0
-#if MDK_CONF_ED25519_SMALL == 1
-#define ED25519_SMALL
-#endif
-//
-// PKCS7
-#define MDK_CONF_PKCS7 0
-#if MDK_CONF_PKCS7 == 1
-#define HAVE_PKCS7
-#endif
-//
-//
-
-// Random Seed, for TEST Only
-#define MDK_CONF_RNDSEED 1
-#if MDK_CONF_RNDSEED == 1
-#define WOLFSSL_GENSEED_FORTEST
-#endif
-//
-
-// Hardware Crypt (See document for usage)
-// Hardware RNG
-#define MDK_CONF_STM32F2_RNG 0
-#if MDK_CONF_STM32F2_RNG == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_RNG
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Crypt
-#define MDK_CONF_STM32F2_CRYPTO 0
-#if MDK_CONF_STM32F2_CRYPTO == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_CRYPTO
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-// Hardware Hash
-#define MDK_CONF_STM32F2_HASH 0
-#if MDK_CONF_STM32F2_HASH == 1
-#define WOLFSSL_STM32_CUBEMX
-#define STM32_HASH
-#define WC_ASYNC_DEV_SIZE 320+24
-#define STM32_HAL_TIMEOUT 0xFF
-
-#if defined(STM32F2xx)
-#define WOLFSSL_STM32F2
-#elif defined(STM32F4xx)
-#define WOLFSSL_STM32F4
-#elif defined(STM32F7xx)
-#define WOLFSSL_STM32F7
-#endif
-
-#endif
-//
-//
-
-// Cert/Key Strage
-// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
-#if MDK_CONF_CERT_BUFF== 1
-#define USE_CERT_BUFFERS_1024
-#elif MDK_CONF_CERT_BUFF == 2
-#define USE_CERT_BUFFERS_2048
-#endif
-//
-// Cert/Key Generation
-// CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define WOLFSSL_CERT_GEN
-#endif
-//
-// KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define WOLFSSL_KEY_GEN
-#endif
-//
-//
-// Use Fast Math
-#define MDK_CONF_FASTMATH 1
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#define TFM_TIMING_RESISTANT
-#endif
-//
-// Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_WOLFSSL_SMALL_STACK
-#endif
-//
-
-//
-
-
-/**** wolfSSL Configuration ****/
-
-// wolfSSL Configuration
-
-// TLS 1.3
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 1
-#define WOLFSSL_TLS13
-#define HAVE_TLS_EXTENSIONS
-#define HAVE_SUPPORTED_CURVES
-#define WC_RSA_PSS
-#define HAVE_HKDF
-#define HAVE_FFDHE_2048
-#endif
-//
-
-// Include Old TLS
-#define MDK_CONF_NO_OLDTLS 0
-#if MDK_CONF_NO_OLDTLS == 0
-#define NO_OLD_TLS
-#endif
-//
-// CRL
-#define MDK_CONF_CRL 0
-#if MDK_CONF_CRL == 1
-#define HAVE_CRL
-#define WOLFSSL_DER_LOAD
-#endif
-//
-// OCSP
-#define MDK_CONF_OCSP 0
-#if MDK_CONF_OCSP == 1
-#define HAVE_OCSP
-#endif
-//
-// OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 0
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//
-
-//
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx
index 1f0fdd6999..d11940ef29 100644
--- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx
@@ -226,7 +226,7 @@
0
0
0
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
user_settings.h
0
0
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx
index 0d046e502d..34f3cba640 100644
--- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx
@@ -383,7 +383,7 @@
user_settings.h
5
- .\RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
@@ -832,7 +832,7 @@
- RTE\wolfSSL\user_settings.h
+ ..\..\Conf\user_settings.h
diff --git a/IDE/MDK5-ARM/README.md b/IDE/MDK5-ARM/README.md
new file mode 100644
index 0000000000..f78365f74f
--- /dev/null
+++ b/IDE/MDK5-ARM/README.md
@@ -0,0 +1,60 @@
+# ARM Keil MDK 5 wolfSSL Support
+
+wolfSSL has a Keil CMSIS pack available that is updated for each release.
+
+This CMSIS pack contains the wolfCrypt and wolfSSL (TLS) libraries including test, benchmark and example applications.
+
+## To install the wolfSSL pack
+
+1) Open the Keil "Pack Installer"
+2) Under Generic locate "wolfSSL::wolfSSL"
+3) Click "Install"
+
+## To add the pack to your project
+
+1) Project -> Manage -> "Runtime Environment"
+2) Expand "wolfSSL" and check the boxes for wolfCrypt CORE and wolfSSL CORE.
+3) If running the wolfCrypt test or any of the TLS examples check those as well.
+
+Note: By default the pack's user_settings.h assumes the CMSIS RTOS v2 and Keil TCP packs are also installed. See below for how to change these settings (`MDK_CONF_THREAD` and `MDK_CONF_NETWORK`).
+
+If the wolfSSL::wolfSSL pack isn't showing:
+1) Project -> Manage -> "Select Software Packs"
+2) Make sure wolfSSL:wolfSSL is selected to "latest"
+3) Hit "OK"
+
+## To configure wolfSSL
+
+1) Add a pre-processor macro `WOLFSSL_USER_SETTINGS`
+ - Project -> Options for Target... -> C/C++ -> Preprocessor Symbols -> Define.
+ - Add `WOLFSSL_USER_SETTINGS`
+2) Open the `user_settings.h` file. In wolfSSL -> user_settings.h
+3) Configure math library (`MDK_CONF_MATH`). Default 0=SP Math all (sp_int.c)
+4) Configure MPU (`MDK_CONF_MPU`): If not STM32, use 0 for none.
+5) Configure the RTOS (`MDK_CONF_THREAD`): By default 15 = "CMSIS RTOSv2". For bare-metal use 0. For FreeRTOS use 1.
+6) Configure the TCP stack (`MDK_CONF_NETWORK`). By default uses Keil TCP `WOLFSSL_KEIL_TCP_NET`. Use 0 for none or 2 for user io callbacks.
+6) For wolfCrypt only (no TLS) add `#define WOLFCRYPT_ONLY` (resolves GetCA errors)
+7) Increase stack/heap (if needed). This is typically in the startup.s, but for RTX is in the `RTX_Config.h`. For CMSIS RTOSv2 stack is set in `osThreadAttr_t` on call to `osThreadNew`.
+
+## Building
+
+If getting an error for an unknown type `inline`, change your project C standard to c99 in the C/C++ options. Alternatively,
+add `#define WC_INLINE __inline` to `user_settings.h` to stick to c89 or the default c90.
+
+If getting error for missing GetCA or GetCAByName then include `Src/ssl-dummy.c` or define `WOLFCRYPT_ONLY`.
+
+If getting an error with missing `current_time` then please implement a function to return elapsed seconds (used by benchmark) like this:
+
+```c
+extern uint32_t os_time;
+double current_time(int reset)
+{
+ if (reset) os_time = 0 ;
+ return (double)os_time /1000.0;
+}
+```
+
+
+## For Support
+
+For question email support@wolfssl.com
diff --git a/IDE/MDK5-ARM/Src/ssl-dummy.c b/IDE/MDK5-ARM/Src/ssl-dummy.c
index fdd71c962f..7cfd82ec69 100644
--- a/IDE/MDK5-ARM/Src/ssl-dummy.c
+++ b/IDE/MDK5-ARM/Src/ssl-dummy.c
@@ -29,11 +29,11 @@
Signer* GetCA(void* vp, byte* hash)
{
- return NULL ;
+ return NULL;
}
Signer* GetCAByName(void* vp, byte* hash)
{
- return NULL ;
+ return NULL;
}
diff --git a/IDE/MDK5-ARM/include.am b/IDE/MDK5-ARM/include.am
new file mode 100644
index 0000000000..ffd0d42e75
--- /dev/null
+++ b/IDE/MDK5-ARM/include.am
@@ -0,0 +1,9 @@
+# vim:ft=automake
+# included from Top Level Makefile.am
+# All paths should be given relative to the root
+
+EXTRA_DIST+= IDE/MDK5-ARM/README.md
+EXTRA_DIST+= IDE/MDK5-ARM/Conf/user_settings.h
+EXTRA_DIST+= IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
+EXTRA_DIST+= IDE/MDK5-ARM/Projects
+EXTRA_DIST+= IDE/MDK5-ARM/Src/ssl-dummy.c
diff --git a/IDE/include.am b/IDE/include.am
index 379400d7ec..ec6bcd5321 100644
--- a/IDE/include.am
+++ b/IDE/include.am
@@ -53,6 +53,7 @@ include IDE/AURIX/include.am
include IDE/MCUEXPRESSO/include.am
include IDE/Espressif/include.am
include IDE/STARCORE/include.am
+include IDE/MDK5-ARM/include.am
-EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
+EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
EXTRA_DIST+= IDE/OPENSTM32/README.md
diff --git a/scripts/makedistsmall.sh b/scripts/makedistsmall.sh
index 24bd7f19e3..325e5c15aa 100755
--- a/scripts/makedistsmall.sh
+++ b/scripts/makedistsmall.sh
@@ -9,6 +9,7 @@
if [ "$1" == "keep" ]; then KEEP="yes"; else KEEP="no"; fi
WOLFSSL_TEMPDIR=$(mktemp -d) || exit $?
+WOLFSSL_BRANCH=$(git symbolic-ref --short HEAD)
function cleanup_on_exit() {
if [ "$KEEP" == "no" ];
@@ -34,7 +35,7 @@ fi
echo "Setting up work directory..."
git clone -q -n --shared . "$WOLFSSL_TEMPDIR" || exit $?
pushd "$WOLFSSL_TEMPDIR" >/dev/null || exit $?
-git checkout -q master || exit $?
+git checkout -q "$WOLFSSL_BRANCH"
# cleanup example directories
echo "Removing files not needed..."
diff --git a/src/internal.c b/src/internal.c
index c6a781afbc..ce7958b6d0 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -9256,6 +9256,13 @@ ProtocolVersion MakeDTLSv1_3(void)
return sys_now()/1000;
}
+#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
+
+ word32 LowResTimer(void)
+ {
+ return (word32)osKernelGetTickCount() / 1000;
+ }
+
#elif defined(WOLFSSL_TIRTOS)
word32 LowResTimer(void)
diff --git a/src/ssl_asn1.c b/src/ssl_asn1.c
index fb33a25485..e9ece79df3 100644
--- a/src/ssl_asn1.c
+++ b/src/ssl_asn1.c
@@ -1630,7 +1630,7 @@ WOLFSSL_ASN1_OBJECT* wolfSSL_ASN1_OBJECT_dup(WOLFSSL_ASN1_OBJECT* obj)
#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */
#endif /* !NO_ASN */
-#ifdef OPENSSL_EXTRA
+#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
/**
* Parse DER encoding and return header information.
@@ -1859,6 +1859,10 @@ WOLFSSL_ASN1_OBJECT *wolfSSL_c2i_ASN1_OBJECT(WOLFSSL_ASN1_OBJECT **a,
return ret;
}
+#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
+
+#ifdef OPENSSL_EXTRA
+
/* Write at most buf_len bytes of textual representation of ASN.1 OBJECT_ID.
*
* @param [in, out] buf Buffer to write to.
@@ -3227,7 +3231,7 @@ static int wolfssl_asn1_time_to_secs(const WOLFSSL_ASN1_TIME* t,
/* Calculate difference in time of two ASN.1 TIME objects.
*
* @param [out] days Number of whole days between from and to.
- * @param [out] secs Number of serconds less than a day between from and to.
+ * @param [out] secs Number of seconds less than a day between from and to.
* @param [in] from ASN.1 TIME object as start time.
* @param [in] to ASN.1 TIME object as end time.
* @return 1 on success.
@@ -3918,7 +3922,7 @@ int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO* bio, const WOLFSSL_ASN1_UTCTIME* a)
* ASN1_TYPE APIs
******************************************************************************/
-#ifdef OPENSSL_EXTRA
+#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
/**
* Allocate a new ASN.1 TYPE object.
@@ -3954,12 +3958,12 @@ static void wolfssl_asn1_type_free_value(WOLFSSL_ASN1_TYPE* at)
wolfSSL_ASN1_OBJECT_free(at->value.object);
break;
case V_ASN1_UTCTIME:
- #ifndef NO_ASN_TIME
+ #if !defined(NO_ASN_TIME) && defined(OPENSSL_EXTRA)
wolfSSL_ASN1_TIME_free(at->value.utctime);
#endif
break;
case V_ASN1_GENERALIZEDTIME:
- #ifndef NO_ASN_TIME
+ #if !defined(NO_ASN_TIME) && defined(OPENSSL_EXTRA)
wolfSSL_ASN1_TIME_free(at->value.generalizedtime);
#endif
break;
@@ -3991,9 +3995,10 @@ void wolfSSL_ASN1_TYPE_free(WOLFSSL_ASN1_TYPE* at)
XFREE(at, NULL, DYNAMIC_TYPE_OPENSSL);
}
-#endif /* OPENSSL_EXTRA */
+#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
-#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS)
+#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS) || \
+ defined(WOLFSSL_WPAS_SMALL)
/**
* Set ASN.1 TYPE object with a type and value.
*
diff --git a/src/tls.c b/src/tls.c
index 1be158e6b1..d16dba6846 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -1803,6 +1803,9 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
if (extensions == NULL || data == NULL || dataSz == NULL)
return BAD_FUNC_ARG;
+ *data = NULL;
+ *dataSz = 0;
+
extension = TLSX_Find(extensions, TLSX_APPLICATION_LAYER_PROTOCOL);
if (extension == NULL) {
WOLFSSL_MSG("TLS extension not found");
@@ -1813,8 +1816,6 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
alpn = (ALPN *)extension->data;
if (alpn == NULL) {
WOLFSSL_MSG("ALPN extension not found");
- *data = NULL;
- *dataSz = 0;
WOLFSSL_ERROR_VERBOSE(WOLFSSL_FATAL_ERROR);
return WOLFSSL_FATAL_ERROR;
}
diff --git a/src/tls13.c b/src/tls13.c
index 4726c8322d..257750233d 100644
--- a/src/tls13.c
+++ b/src/tls13.c
@@ -1713,6 +1713,14 @@ int DeriveTls13Keys(WOLFSSL* ssl, int secret, int side, int store)
{
return sys_now();
}
+
+#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
+
+ word32 TimeNowInMilliseconds(void)
+ {
+ return (word32)osKernelGetTickCount();
+ }
+
#elif defined(WOLFSSL_TIRTOS)
/* The time in milliseconds.
* Used for tickets to represent difference between when first seen and when
@@ -1996,6 +2004,14 @@ int DeriveTls13Keys(WOLFSSL* ssl, int secret, int side, int store)
{
return sys_now();
}
+
+#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
+
+ sword64 TimeNowInMilliseconds(void)
+ {
+ return (sword64)osKernelGetTickCount();
+ }
+
#elif defined(WOLFSSL_TIRTOS)
/* The time in milliseconds.
* Used for tickets to represent difference between when first seen and when
diff --git a/src/wolfio.c b/src/wolfio.c
index 26c11ad49f..f5bb180cde 100644
--- a/src/wolfio.c
+++ b/src/wolfio.c
@@ -20,6 +20,9 @@
*/
+#ifndef WOLFSSL_STRERROR_BUFFER_SIZE
+#define WOLFSSL_STRERROR_BUFFER_SIZE 256
+#endif
#ifdef HAVE_CONFIG_H
#include
@@ -121,6 +124,12 @@ static WC_INLINE int wolfSSL_LastError(int err)
static int TranslateIoError(int err)
{
+#ifdef _WIN32
+ size_t errstr_offset;
+ char errstr[WOLFSSL_STRERROR_BUFFER_SIZE];
+#endif /* _WIN32 */
+
+
if (err > 0)
return err;
@@ -151,7 +160,20 @@ static int TranslateIoError(int err)
return WOLFSSL_CBIO_ERR_CONN_CLOSE;
}
+#if defined(_WIN32)
+ strcpy_s(errstr, sizeof(errstr), "\tGeneral error: ");
+ errstr_offset = strlen(errstr);
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPSTR)(errstr + errstr_offset),
+ (DWORD)(sizeof(errstr) - errstr_offset),
+ NULL);
+ WOLFSSL_MSG(errstr);
+#else
WOLFSSL_MSG("\tGeneral error");
+#endif
return WOLFSSL_CBIO_ERR_GENERAL;
}
#endif /* USE_WOLFSSL_IO || HAVE_HTTP_CLIENT */
diff --git a/src/x509.c b/src/x509.c
index bc1c48992a..860eea185c 100644
--- a/src/x509.c
+++ b/src/x509.c
@@ -541,6 +541,10 @@ int wolfSSL_X509_get_ext_by_OBJ(const WOLFSSL_X509 *x,
return -1;
}
+#endif /* OPENSSL_ALL || OPENSSL_EXTRA */
+
+#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || \
+ defined(WOLFSSL_WPAS_SMALL)
/* Set a general name from the DNS entry data.
*
* @param [in] dns DNS entry.
@@ -650,7 +654,9 @@ static int wolfssl_dns_entry_othername_to_gn(DNS_entry* dns,
err:
return ret;
}
+#endif /* OPENSSL_ALL || WOLFSSL_WPAS_SMALL */
+#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA)
static int wolfssl_x509_alt_names_to_gn(WOLFSSL_X509* x509,
WOLFSSL_X509_EXTENSION* ext)
{
@@ -2118,7 +2124,7 @@ int wolfSSL_X509_get_ext_by_NID(const WOLFSSL_X509* x509, int nid, int lastPos)
return found ? extCount : WOLFSSL_FATAL_ERROR;
}
-#endif /* OPENSSL_ALL */
+#endif /* OPENSSL_ALL || OPENSSL_EXTRA */
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
/* Looks for the extension matching the passed in nid
diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c
index 6609a2e20f..eb571949ae 100644
--- a/wolfcrypt/benchmark/benchmark.c
+++ b/wolfcrypt/benchmark/benchmark.c
@@ -9020,6 +9020,14 @@ void bench_sphincsKeySign(byte level, byte optim)
return (double)OSA_TimeGetMsec() / 1000;
}
+#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
+
+ double current_time(int reset)
+ {
+ (void)reset;
+ return (double)osKernelGetTickCount() / 1000.0;
+ }
+
#elif defined(WOLFSSL_EMBOS)
#include "RTOS.h"
diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c
index 7541b76cdb..685f54c157 100644
--- a/wolfcrypt/src/asn.c
+++ b/wolfcrypt/src/asn.c
@@ -9078,7 +9078,7 @@ int EncryptContent(byte* input, word32 inputSz, byte* out, word32* outSz,
DECL_ASNSETDATA(dataASN, p8EncPbes1ASN_Length);
int ret = 0;
int sz = 0;
- int version;
+ int version = 0;
int id = -1;
int blockSz = 0;
word32 pkcs8Sz = 0;
diff --git a/wolfcrypt/src/chacha20_poly1305.c b/wolfcrypt/src/chacha20_poly1305.c
index e4ebd10165..0c37de747a 100644
--- a/wolfcrypt/src/chacha20_poly1305.c
+++ b/wolfcrypt/src/chacha20_poly1305.c
@@ -355,9 +355,9 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot(
int isEncrypt)
{
int ret;
- ssize_t dst_len = isEncrypt ?
- (ssize_t)src_len + POLY1305_DIGEST_SIZE :
- (ssize_t)src_len - POLY1305_DIGEST_SIZE;
+ long int dst_len = isEncrypt ?
+ (long int)src_len + POLY1305_DIGEST_SIZE :
+ (long int)src_len - POLY1305_DIGEST_SIZE;
const byte *src_i;
byte *dst_i;
size_t src_len_rem;
@@ -375,7 +375,7 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot(
goto out;
}
- if ((ssize_t)dst_space < dst_len) {
+ if ((long int)dst_space < dst_len) {
ret = BUFFER_E;
goto out;
}
diff --git a/wolfcrypt/src/port/caam/wolfcaam_fsl_nxp.c b/wolfcrypt/src/port/caam/wolfcaam_fsl_nxp.c
index 4a8801895e..848d682598 100644
--- a/wolfcrypt/src/port/caam/wolfcaam_fsl_nxp.c
+++ b/wolfcrypt/src/port/caam/wolfcaam_fsl_nxp.c
@@ -838,7 +838,7 @@ int SynchronousSendRequest(int type, unsigned int args[4], CAAM_BUFFER *buf,
buf[1].Length, (byte*)buf[2].TheAddress,
buf[2].Length, (byte*)buf[0].TheAddress,
buf[0].Length, CAAM_ENCAP_BLOB,
- (args[0] = 0)? CAAM_RED_BLOB : CAAM_BLACK_BLOB)
+ (args[0] == 0)? CAAM_RED_BLOB : CAAM_BLACK_BLOB)
!= kStatus_Success) {
ret = WC_HW_E;
}
@@ -849,7 +849,7 @@ int SynchronousSendRequest(int type, unsigned int args[4], CAAM_BUFFER *buf,
(byte*)buf[2].TheAddress, buf[2].Length,
(byte*)buf[0].TheAddress, buf[0].Length,
CAAM_DECAP_BLOB,
- (args[0] = 0)? CAAM_RED_BLOB : CAAM_BLACK_BLOB)
+ (args[0] == 0)? CAAM_RED_BLOB : CAAM_BLACK_BLOB)
!= kStatus_Success) {
ret = WC_HW_E;
}
diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c
index 874744ffc9..d19a044fa1 100644
--- a/wolfcrypt/test/test.c
+++ b/wolfcrypt/test/test.c
@@ -413,208 +413,214 @@ typedef struct testVector {
PRAGMA_GCC("GCC diagnostic ignored \"-Wunused-function\"")
PRAGMA_CLANG("clang diagnostic ignored \"-Wunused-function\"")
-WOLFSSL_TEST_SUBROUTINE int error_test(void);
-WOLFSSL_TEST_SUBROUTINE int base64_test(void);
-WOLFSSL_TEST_SUBROUTINE int base16_test(void);
-WOLFSSL_TEST_SUBROUTINE int asn_test(void);
-WOLFSSL_TEST_SUBROUTINE int md2_test(void);
-WOLFSSL_TEST_SUBROUTINE int md5_test(void);
-WOLFSSL_TEST_SUBROUTINE int md4_test(void);
-WOLFSSL_TEST_SUBROUTINE int sha_test(void);
-WOLFSSL_TEST_SUBROUTINE int sha224_test(void);
-WOLFSSL_TEST_SUBROUTINE int sha256_test(void);
-WOLFSSL_TEST_SUBROUTINE int sha512_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t base64_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t base16_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t asn_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t md2_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t md5_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t md4_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha224_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha256_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_test(void);
#if !defined(WOLFSSL_NOSHA512_224) && \
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
-WOLFSSL_TEST_SUBROUTINE int sha512_224_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_224_test(void);
#endif
#if !defined(WOLFSSL_NOSHA512_256) && \
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
-WOLFSSL_TEST_SUBROUTINE int sha512_256_test(void);
-#endif
-WOLFSSL_TEST_SUBROUTINE int sha384_test(void);
-WOLFSSL_TEST_SUBROUTINE int sha3_test(void);
-WOLFSSL_TEST_SUBROUTINE int shake128_test(void);
-WOLFSSL_TEST_SUBROUTINE int shake256_test(void);
-WOLFSSL_TEST_SUBROUTINE int hash_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_md5_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_sha_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_sha224_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_sha256_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_sha384_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_sha512_test(void);
-WOLFSSL_TEST_SUBROUTINE int hmac_sha3_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_256_test(void);
+#endif
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha384_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha3_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake128_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake256_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_md5_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha224_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha256_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha384_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha512_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha3_test(void);
#if defined(HAVE_HKDF) && !defined(NO_HMAC)
+#if defined(WOLFSSL_AFALG_XILINX) || defined(WOLFSSL_AFALG_XILINX_AES) || \
+ defined(WOLFSSL_AFALG_XILINX_SHA3) || defined(WOLFSSL_AFALG_HASH_KEEP) || \
+ defined(WOLFSSL_AFALG_XILINX_RSA)
/* hkdf_test has issue with WOLFSSL_TEST_SUBROUTINE set on Xilinx with afalg */
-static int hkdf_test(void);
+static wc_test_ret_t hkdf_test(void);
+#else
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void);
+#endif
#endif
-WOLFSSL_TEST_SUBROUTINE int sshkdf_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sshkdf_test(void);
#ifdef WOLFSSL_TLS13
-WOLFSSL_TEST_SUBROUTINE int tls13_kdf_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls13_kdf_test(void);
#endif
-WOLFSSL_TEST_SUBROUTINE int x963kdf_test(void);
-WOLFSSL_TEST_SUBROUTINE int hpke_test(void);
-WOLFSSL_TEST_SUBROUTINE int arc4_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t x963kdf_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hpke_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t arc4_test(void);
#ifdef WC_RC2
-WOLFSSL_TEST_SUBROUTINE int rc2_test(void);
-#endif
-WOLFSSL_TEST_SUBROUTINE int chacha_test(void);
-WOLFSSL_TEST_SUBROUTINE int XChaCha_test(void);
-WOLFSSL_TEST_SUBROUTINE int chacha20_poly1305_aead_test(void);
-WOLFSSL_TEST_SUBROUTINE int XChaCha20Poly1305_test(void);
-WOLFSSL_TEST_SUBROUTINE int des_test(void);
-WOLFSSL_TEST_SUBROUTINE int des3_test(void);
-WOLFSSL_TEST_SUBROUTINE int aes_test(void);
-WOLFSSL_TEST_SUBROUTINE int aes192_test(void);
-WOLFSSL_TEST_SUBROUTINE int aes256_test(void);
-WOLFSSL_TEST_SUBROUTINE int aesofb_test(void);
-WOLFSSL_TEST_SUBROUTINE int cmac_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rc2_test(void);
+#endif
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t chacha_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t XChaCha_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t chacha20_poly1305_aead_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t XChaCha20Poly1305_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t des_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t des3_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes192_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes256_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesofb_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cmac_test(void);
#if defined(WOLFSSL_SIPHASH)
-WOLFSSL_TEST_SUBROUTINE int siphash_test(void);
-#endif
-WOLFSSL_TEST_SUBROUTINE int poly1305_test(void);
-WOLFSSL_TEST_SUBROUTINE int aesgcm_test(void);
-WOLFSSL_TEST_SUBROUTINE int aesgcm_default_test(void);
-WOLFSSL_TEST_SUBROUTINE int gmac_test(void);
-WOLFSSL_TEST_SUBROUTINE int aesccm_test(void);
-WOLFSSL_TEST_SUBROUTINE int aeskeywrap_test(void);
-WOLFSSL_TEST_SUBROUTINE int camellia_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t siphash_test(void);
+#endif
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t poly1305_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesgcm_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesgcm_default_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t gmac_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesccm_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aeskeywrap_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t camellia_test(void);
#ifdef WC_RSA_NO_PADDING
-WOLFSSL_TEST_SUBROUTINE int rsa_no_pad_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_no_pad_test(void);
#endif
-WOLFSSL_TEST_SUBROUTINE int rsa_test(void);
-WOLFSSL_TEST_SUBROUTINE int dh_test(void);
-WOLFSSL_TEST_SUBROUTINE int dsa_test(void);
-WOLFSSL_TEST_SUBROUTINE int srp_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dh_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dsa_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srp_test(void);
#ifndef WC_NO_RNG
-WOLFSSL_TEST_SUBROUTINE int random_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t random_test(void);
#endif /* WC_NO_RNG */
-WOLFSSL_TEST_SUBROUTINE int pwdbased_test(void);
-WOLFSSL_TEST_SUBROUTINE int ripemd_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ripemd_test(void);
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
-WOLFSSL_TEST_SUBROUTINE int openssl_test(void); /* test mini api */
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_test(void); /* test mini api */
-WOLFSSL_TEST_SUBROUTINE int openssl_pkey0_test(void);
-WOLFSSL_TEST_SUBROUTINE int openssl_pkey1_test(void);
-WOLFSSL_TEST_SUBROUTINE int openSSL_evpMD_test(void);
-WOLFSSL_TEST_SUBROUTINE int openssl_evpSig_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_pkey0_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_pkey1_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openSSL_evpMD_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_evpSig_test(void);
#endif
-WOLFSSL_TEST_SUBROUTINE int pbkdf1_test(void);
-WOLFSSL_TEST_SUBROUTINE int pkcs12_test(void);
-WOLFSSL_TEST_SUBROUTINE int pbkdf2_test(void);
-WOLFSSL_TEST_SUBROUTINE int scrypt_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf1_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf2_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t scrypt_test(void);
#ifdef HAVE_ECC
- WOLFSSL_TEST_SUBROUTINE int ecc_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test(void);
#if defined(HAVE_ECC_ENCRYPT) && defined(HAVE_AES_CBC) && \
(defined(WOLFSSL_AES_128) || defined(WOLFSSL_AES_256))
- WOLFSSL_TEST_SUBROUTINE int ecc_encrypt_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_encrypt_test(void);
#endif
#if defined(USE_CERT_BUFFERS_256) && !defined(WOLFSSL_ATECC508A) && \
!defined(WOLFSSL_ATECC608A) && !defined(NO_ECC256) && \
defined(HAVE_ECC_VERIFY) && defined(HAVE_ECC_SIGN) && \
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(NO_ECC_SECP)
/* skip for ATECC508/608A, cannot import private key buffers */
- WOLFSSL_TEST_SUBROUTINE int ecc_test_buffers(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test_buffers(void);
#endif
#endif
#ifdef HAVE_CURVE25519
- WOLFSSL_TEST_SUBROUTINE int curve25519_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void);
#endif
#ifdef HAVE_ED25519
- WOLFSSL_TEST_SUBROUTINE int ed25519_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ed25519_test(void);
#endif
#ifdef HAVE_CURVE448
- WOLFSSL_TEST_SUBROUTINE int curve448_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve448_test(void);
#endif
#ifdef HAVE_ED448
- WOLFSSL_TEST_SUBROUTINE int ed448_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ed448_test(void);
#endif
#ifdef WOLFSSL_HAVE_KYBER
- WOLFSSL_TEST_SUBROUTINE int kyber_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t kyber_test(void);
#endif
#ifdef WOLFCRYPT_HAVE_ECCSI
- WOLFSSL_TEST_SUBROUTINE int eccsi_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t eccsi_test(void);
#endif
#ifdef WOLFCRYPT_HAVE_SAKKE
- WOLFSSL_TEST_SUBROUTINE int sakke_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sakke_test(void);
#endif
#ifdef HAVE_BLAKE2
- WOLFSSL_TEST_SUBROUTINE int blake2b_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_test(void);
#endif
#ifdef HAVE_BLAKE2S
- WOLFSSL_TEST_SUBROUTINE int blake2s_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2s_test(void);
#endif
#ifdef HAVE_LIBZ
- WOLFSSL_TEST_SUBROUTINE int compress_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t compress_test(void);
#endif
#ifdef HAVE_PKCS7
#ifndef NO_PKCS7_ENCRYPTED_DATA
- WOLFSSL_TEST_SUBROUTINE int pkcs7encrypted_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7encrypted_test(void);
#endif
#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA)
- WOLFSSL_TEST_SUBROUTINE int pkcs7compressed_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7compressed_test(void);
#endif
- WOLFSSL_TEST_SUBROUTINE int pkcs7signed_test(void);
- WOLFSSL_TEST_SUBROUTINE int pkcs7enveloped_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7signed_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7enveloped_test(void);
#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM)
- WOLFSSL_TEST_SUBROUTINE int pkcs7authenveloped_test(void);
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7authenveloped_test(void);
#endif
#if !defined(NO_AES) && defined(HAVE_AES_CBC)
- WOLFSSL_TEST_SUBROUTINE int pkcs7callback_test(byte* cert, word32 certSz, byte* key,
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7callback_test(byte* cert, word32 certSz, byte* key,
word32 keySz);
#endif
#endif
#if !defined(NO_ASN_TIME) && !defined(NO_RSA) && defined(WOLFSSL_TEST_CERT) && \
!defined(NO_FILESYSTEM)
-WOLFSSL_TEST_SUBROUTINE int cert_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cert_test(void);
#endif
#if defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_TEST_CERT) && \
!defined(NO_FILESYSTEM) && defined(WOLFSSL_CERT_GEN)
-WOLFSSL_TEST_SUBROUTINE int certext_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certext_test(void);
#endif
#if defined(WOLFSSL_CERT_GEN_CACHE) && defined(WOLFSSL_TEST_CERT) && \
defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_CERT_GEN)
-WOLFSSL_TEST_SUBROUTINE int decodedCertCache_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t decodedCertCache_test(void);
#endif
-WOLFSSL_TEST_SUBROUTINE int memory_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memory_test(void);
#if defined(WOLFSSL_PUBLIC_MP) && \
((defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \
defined(USE_FAST_MATH))
-WOLFSSL_TEST_SUBROUTINE int mp_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mp_test(void);
#endif
#if defined(WOLFSSL_PUBLIC_MP) && defined(WOLFSSL_KEY_GEN)
-WOLFSSL_TEST_SUBROUTINE int prime_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t prime_test(void);
#endif
#if defined(ASN_BER_TO_DER) && \
(defined(WOLFSSL_TEST_CERT) || defined(OPENSSL_EXTRA) || \
defined(OPENSSL_EXTRA_X509_SMALL))
-WOLFSSL_TEST_SUBROUTINE int berder_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t berder_test(void);
#endif
-WOLFSSL_TEST_SUBROUTINE int logging_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t logging_test(void);
#if !defined(NO_ASN) && !defined(NO_ASN_TIME)
-WOLFSSL_TEST_SUBROUTINE int time_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t time_test(void);
#endif
#if defined(__INCLUDE_NUTTX_CONFIG_H)
-WOLFSSL_TEST_SUBROUTINE int wolfcrypt_mutex_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t wolfcrypt_mutex_test(void);
#else
-WOLFSSL_TEST_SUBROUTINE int mutex_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mutex_test(void);
#endif
#if defined(USE_WOLFSSL_MEMORY) && !defined(FREERTOS)
-WOLFSSL_TEST_SUBROUTINE int memcb_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memcb_test(void);
#endif
#ifdef WOLFSSL_CAAM_BLOB
-WOLFSSL_TEST_SUBROUTINE int blob_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blob_test(void);
#endif
#ifdef WOLF_CRYPTO_CB
-WOLFSSL_TEST_SUBROUTINE int cryptocb_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void);
#endif
#ifdef WOLFSSL_CERT_PIV
-WOLFSSL_TEST_SUBROUTINE int certpiv_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certpiv_test(void);
#endif
#ifdef WOLFSSL_AES_SIV
-WOLFSSL_TEST_SUBROUTINE int aes_siv_test(void);
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_siv_test(void);
#endif
/* General big buffer size for many tests. */
@@ -623,7 +629,7 @@ WOLFSSL_TEST_SUBROUTINE int aes_siv_test(void);
#define ERROR_OUT(err, eLabel) do { ret = (err); goto eLabel; } while (0)
-static void render_error_message(const char* msg, int es)
+static void render_error_message(const char* msg, wc_test_ret_t es)
{
(void)msg;
(void)es;
@@ -699,7 +705,7 @@ static void print_fiducials(void);
#ifdef HAVE_STACK_SIZE
static THREAD_RETURN err_sys(const char* msg, int es)
#else
-static int err_sys(const char* msg, int es)
+static wc_test_ret_t err_sys(const char* msg, wc_test_ret_t es)
#endif
{
render_error_message(msg, es);
@@ -716,7 +722,7 @@ static int err_sys(const char* msg, int es)
typedef struct func_args {
int argc;
char** argv;
- int return_code;
+ wc_test_ret_t return_code;
} func_args;
#endif /* !HAVE_WOLFCRYPT_TEST_OPTIONS */
@@ -822,10 +828,10 @@ static int rng_crypto_cb(int thisDevId, wc_CryptoInfo* info, void* ctx)
#ifdef HAVE_STACK_SIZE
THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args)
#else
-int wolfcrypt_test(void* args)
+wc_test_ret_t wolfcrypt_test(void* args)
#endif
{
- int ret;
+ wc_test_ret_t ret;
#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
long heap_baselineAllocs, heap_baselineBytes;
#endif
@@ -1703,19 +1709,19 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
/* so overall tests can pull in test function */
#if defined(WOLFSSL_ESPIDF) || defined(_WIN32_WCE)
- int wolf_test_task(void)
+ wc_test_ret_t wolf_test_task(void)
#else
#ifndef NO_MAIN_FUNCTION
int main(int argc, char** argv)
{
- return wolfcrypt_test_main(argc, argv);
+ return (int)wolfcrypt_test_main(argc, argv);
}
#endif
- int wolfcrypt_test_main(int argc, char** argv)
+ wc_test_ret_t wolfcrypt_test_main(int argc, char** argv)
#endif
{
- int ret;
+ wc_test_ret_t ret;
func_args args;
#if defined(WOLFSSL_ESPIDF) || defined(WOLFSSL_SE050)
/* set dummy wallclock time. */
@@ -1782,7 +1788,7 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
args.argv = argv;
#endif
if ((ret = wolfCrypt_Init()) != 0) {
- printf("wolfCrypt_Init failed %d\n", ret);
+ printf("wolfCrypt_Init failed %d\n", (int)ret);
err_sys("Error with wolfCrypt_Init!\n", WC_TEST_RET_ENC_EC(ret));
}
@@ -1801,7 +1807,7 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
#endif
if ((ret = wolfCrypt_Cleanup()) != 0) {
- printf("wolfCrypt_Cleanup failed %d\n", ret);
+ printf("wolfCrypt_Cleanup failed %d\n", (int)ret);
err_sys("Error with wolfCrypt_Cleanup!\n", WC_TEST_RET_ENC_EC(ret));
}
@@ -1826,7 +1832,7 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
/* everything else will use printf */
#if !defined(WOLFSSL_ESPIDF)
/* gate this for target platforms wishing to avoid printf reference */
- printf("Exiting main with return code: %d\n", args.return_code);
+ printf("Exiting main with return code: %ld\n", (long int)args.return_code);
#endif
return args.return_code;
@@ -1845,11 +1851,11 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
#define SaveDerAndPem(d, dSz, fD, fP, pT) _SaveDerAndPem(d, dSz, NULL, NULL, pT, WC_TEST_RET_LN)
#endif
-static int _SaveDerAndPem(const byte* der, int derSz,
+static wc_test_ret_t _SaveDerAndPem(const byte* der, int derSz,
const char* fileDer, const char* filePem, int pemType, int calling_line)
{
#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
- int ret;
+ wc_test_ret_t ret;
XFILE derFile;
derFile = XFOPEN(fileDer, "wb");
@@ -1915,7 +1921,7 @@ static int _SaveDerAndPem(const byte* der, int derSz,
}
#endif /* WOLFSSL_KEY_GEN || WOLFSSL_CERT_GEN */
-WOLFSSL_TEST_SUBROUTINE int error_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void)
{
const char* errStr;
char out[WOLFSSL_MAX_ERROR_SZ];
@@ -1980,9 +1986,9 @@ WOLFSSL_TEST_SUBROUTINE int error_test(void)
#ifndef NO_CODING
-WOLFSSL_TEST_SUBROUTINE int base64_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t base64_test(void)
{
- int ret;
+ wc_test_ret_t ret;
WOLFSSL_SMALL_STACK_STATIC const byte good[] = "A+Gd\0\0\0";
WOLFSSL_SMALL_STACK_STATIC const byte goodEnd[] = "A+Gd \r\n";
WOLFSSL_SMALL_STACK_STATIC const byte good_spaces[] = " A + G d \0";
@@ -2127,9 +2133,9 @@ WOLFSSL_TEST_SUBROUTINE int base64_test(void)
}
#ifdef WOLFSSL_BASE16
-WOLFSSL_TEST_SUBROUTINE int base16_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t base16_test(void)
{
- int ret;
+ wc_test_ret_t ret;
WOLFSSL_SMALL_STACK_STATIC const byte testData[] = "SomeDataToEncode\n";
WOLFSSL_SMALL_STACK_STATIC const byte encodedTestData[] = "536F6D6544617461546F456E636F64650A00";
byte encoded[40];
@@ -2166,9 +2172,9 @@ WOLFSSL_TEST_SUBROUTINE int base16_test(void)
#endif /* !NO_CODING */
#ifndef NO_ASN
-WOLFSSL_TEST_SUBROUTINE int asn_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t asn_test(void)
{
- int ret;
+ wc_test_ret_t ret;
/* ASN1 encoded date buffer */
WOLFSSL_SMALL_STACK_STATIC const byte dateBuf[] = {0x17, 0x0d, 0x31, 0x36, 0x30, 0x38, 0x31, 0x31,
0x32, 0x30, 0x30, 0x37, 0x33, 0x37, 0x5a};
@@ -2211,9 +2217,9 @@ WOLFSSL_TEST_SUBROUTINE int asn_test(void)
#endif /* !NO_ASN */
#ifdef WOLFSSL_MD2
-WOLFSSL_TEST_SUBROUTINE int md2_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t md2_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
Md2 md2;
byte hash[MD2_DIGEST_SIZE];
@@ -2299,9 +2305,9 @@ WOLFSSL_TEST_SUBROUTINE int md2_test(void)
#endif
#ifndef NO_MD5
-WOLFSSL_TEST_SUBROUTINE int md5_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t md5_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
wc_Md5 md5, md5Copy;
byte hash[WC_MD5_DIGEST_SIZE];
byte hashcopy[WC_MD5_DIGEST_SIZE];
@@ -2429,7 +2435,7 @@ WOLFSSL_TEST_SUBROUTINE int md5_test(void)
#ifndef NO_MD4
-WOLFSSL_TEST_SUBROUTINE int md4_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t md4_test(void)
{
Md4 md4;
byte hash[MD4_DIGEST_SIZE];
@@ -2507,9 +2513,9 @@ WOLFSSL_TEST_SUBROUTINE int md4_test(void)
#ifndef NO_SHA
-WOLFSSL_TEST_SUBROUTINE int sha_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
wc_Sha sha, shaCopy;
byte hash[WC_SHA_DIGEST_SIZE];
byte hashcopy[WC_SHA_DIGEST_SIZE];
@@ -2637,10 +2643,10 @@ WOLFSSL_TEST_SUBROUTINE int sha_test(void)
#endif /* NO_SHA */
#ifdef WOLFSSL_RIPEMD
-WOLFSSL_TEST_SUBROUTINE int ripemd_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ripemd_test(void)
{
RipeMd ripemd;
- int ret;
+ wc_test_ret_t ret;
byte hash[RIPEMD_DIGEST_SIZE];
testVector a, b, c, d;
@@ -2744,7 +2750,7 @@ static const byte blake2b_vec[BLAKE2B_TESTS][BLAKE2B_OUTBYTES] =
-WOLFSSL_TEST_SUBROUTINE int blake2b_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_test(void)
{
Blake2b b2b;
byte digest[64];
@@ -2805,7 +2811,7 @@ static const byte blake2s_vec[BLAKE2S_TESTS][BLAKE2S_OUTBYTES] =
-WOLFSSL_TEST_SUBROUTINE int blake2s_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2s_test(void)
{
Blake2s b2s;
byte digest[32];
@@ -2839,12 +2845,12 @@ WOLFSSL_TEST_SUBROUTINE int blake2s_test(void)
#ifdef WOLFSSL_SHA224
-WOLFSSL_TEST_SUBROUTINE int sha224_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha224_test(void)
{
wc_Sha224 sha, shaCopy;
byte hash[WC_SHA224_DIGEST_SIZE];
byte hashcopy[WC_SHA224_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
testVector a, b, c;
testVector test_sha[3];
@@ -2913,12 +2919,12 @@ WOLFSSL_TEST_SUBROUTINE int sha224_test(void)
#ifndef NO_SHA256
-WOLFSSL_TEST_SUBROUTINE int sha256_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha256_test(void)
{
wc_Sha256 sha, shaCopy;
byte hash[WC_SHA256_DIGEST_SIZE];
byte hashcopy[WC_SHA256_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
testVector a, b, c;
testVector test_sha[3];
@@ -3029,7 +3035,7 @@ WOLFSSL_TEST_SUBROUTINE int sha256_test(void)
#ifdef WOLFSSL_SHA512
-WOLFSSL_TEST_SUBROUTINE int sha512_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_test(void)
{
/*
** See https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA512.pdf
@@ -3037,7 +3043,7 @@ WOLFSSL_TEST_SUBROUTINE int sha512_test(void)
wc_Sha512 sha, shaCopy;
byte hash[WC_SHA512_DIGEST_SIZE];
byte hashcopy[WC_SHA512_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
testVector a, b, c;
testVector test_sha[3];
@@ -3165,7 +3171,7 @@ WOLFSSL_TEST_SUBROUTINE int sha512_test(void)
#if !defined(WOLFSSL_NOSHA512_224) && \
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
-WOLFSSL_TEST_SUBROUTINE int sha512_224_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_224_test(void)
{
/*
** See https://csrc.nist.gov/Projects/cryptographic-standards-and-guidelines/example-values
@@ -3176,7 +3182,7 @@ WOLFSSL_TEST_SUBROUTINE int sha512_224_test(void)
wc_Sha512 sha, shaCopy;
byte hash[WC_SHA512_224_DIGEST_SIZE];
byte hashcopy[WC_SHA512_224_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
testVector a, b, c;
testVector test_sha[3];
@@ -3317,7 +3323,7 @@ WOLFSSL_TEST_SUBROUTINE int sha512_224_test(void)
#if !defined(WOLFSSL_NOSHA512_256) && \
(!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
-WOLFSSL_TEST_SUBROUTINE int sha512_256_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_256_test(void)
{
/*
** See https://csrc.nist.gov/Projects/cryptographic-standards-and-guidelines/example-values
@@ -3327,7 +3333,7 @@ WOLFSSL_TEST_SUBROUTINE int sha512_256_test(void)
wc_Sha512 sha, shaCopy;
byte hash[WC_SHA512_256_DIGEST_SIZE];
byte hashcopy[WC_SHA512_256_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
testVector a, b, c;
testVector test_sha[3];
@@ -3469,12 +3475,12 @@ WOLFSSL_TEST_SUBROUTINE int sha512_256_test(void)
#ifdef WOLFSSL_SHA384
-WOLFSSL_TEST_SUBROUTINE int sha384_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha384_test(void)
{
wc_Sha384 sha, shaCopy;
byte hash[WC_SHA384_DIGEST_SIZE];
byte hashcopy[WC_SHA384_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
testVector a, b, c;
testVector test_sha[3];
@@ -3589,7 +3595,7 @@ WOLFSSL_TEST_SUBROUTINE int sha384_test(void)
#ifdef WOLFSSL_SHA3
#ifndef WOLFSSL_NOSHA3_224
-static int sha3_224_test(void)
+static wc_test_ret_t sha3_224_test(void)
{
wc_Sha3 sha;
byte hash[WC_SHA3_224_DIGEST_SIZE];
@@ -3597,7 +3603,7 @@ static int sha3_224_test(void)
testVector a, b, c;
testVector test_sha[3];
- int ret = 0;
+ wc_test_ret_t ret = 0;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
a.input = "";
@@ -3677,7 +3683,7 @@ static int sha3_224_test(void)
#endif /* WOLFSSL_NOSHA3_224 */
#ifndef WOLFSSL_NOSHA3_256
-static int sha3_256_test(void)
+static wc_test_ret_t sha3_256_test(void)
{
wc_Sha3 sha;
byte hash[WC_SHA3_256_DIGEST_SIZE];
@@ -3685,7 +3691,7 @@ static int sha3_256_test(void)
testVector a, b, c;
testVector test_sha[3];
- int ret = 0;
+ wc_test_ret_t ret = 0;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
byte large_input[1024];
@@ -3798,7 +3804,7 @@ static int sha3_256_test(void)
#endif /* WOLFSSL_NOSHA3_256 */
#ifndef WOLFSSL_NOSHA3_384
-static int sha3_384_test(void)
+static wc_test_ret_t sha3_384_test(void)
{
wc_Sha3 sha;
byte hash[WC_SHA3_384_DIGEST_SIZE];
@@ -3809,7 +3815,7 @@ static int sha3_384_test(void)
testVector a, b, c;
testVector test_sha[3];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
/*
@@ -3919,7 +3925,7 @@ static int sha3_384_test(void)
#endif /* WOLFSSL_NOSHA3_384 */
#ifndef WOLFSSL_NOSHA3_512
-static int sha3_512_test(void)
+static wc_test_ret_t sha3_512_test(void)
{
wc_Sha3 sha;
byte hash[WC_SHA3_512_DIGEST_SIZE];
@@ -3927,7 +3933,7 @@ static int sha3_512_test(void)
testVector a, b, c;
testVector test_sha[3];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
/*
@@ -4020,9 +4026,9 @@ static int sha3_512_test(void)
}
#endif /* WOLFSSL_NOSHA3_512 */
-WOLFSSL_TEST_SUBROUTINE int sha3_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha3_test(void)
{
- int ret;
+ wc_test_ret_t ret;
(void)ret;
@@ -4048,12 +4054,12 @@ WOLFSSL_TEST_SUBROUTINE int sha3_test(void)
#endif /* WOLFSSL_SHA3 */
#ifdef WOLFSSL_SHAKE128
-static int shake128_absorb_test(wc_Shake* sha, byte *large_input_buf,
+static wc_test_ret_t shake128_absorb_test(wc_Shake* sha, byte *large_input_buf,
size_t large_input_buf_size)
{
testVector a, b, c, d, e;
testVector test_sha[5];
- int ret = 0;
+ wc_test_ret_t ret = 0;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
static const char large_digest[] =
@@ -4233,14 +4239,14 @@ static int shake128_absorb_test(wc_Shake* sha, byte *large_input_buf,
return ret;
}
-WOLFSSL_TEST_SUBROUTINE int shake128_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake128_test(void)
{
wc_Shake sha;
byte hash[250];
testVector a, b, c, d, e;
testVector test_sha[5];
- int ret = 0;
+ wc_test_ret_t ret = 0;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
#define SHAKE128_LARGE_INPUT_BUFSIZ 1024
@@ -4404,12 +4410,12 @@ WOLFSSL_TEST_SUBROUTINE int shake128_test(void)
#endif
#ifdef WOLFSSL_SHAKE256
-static int shake256_absorb_test(wc_Shake* sha, byte *large_input_buf,
+static wc_test_ret_t shake256_absorb_test(wc_Shake* sha, byte *large_input_buf,
size_t large_input_buf_size)
{
testVector a, b, c, d, e;
testVector test_sha[5];
- int ret = 0;
+ wc_test_ret_t ret = 0;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
static const char large_digest[] =
@@ -4573,14 +4579,14 @@ static int shake256_absorb_test(wc_Shake* sha, byte *large_input_buf,
return ret;
}
-WOLFSSL_TEST_SUBROUTINE int shake256_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake256_test(void)
{
wc_Shake sha;
byte hash[250];
testVector a, b, c, d, e;
testVector test_sha[5];
- int ret = 0;
+ wc_test_ret_t ret = 0;
int times = sizeof(test_sha) / sizeof(struct testVector), i;
#define SHAKE256_LARGE_INPUT_BUFSIZ 1024
@@ -4741,7 +4747,7 @@ WOLFSSL_TEST_SUBROUTINE int shake256_test(void)
#endif
#ifndef NO_HASH_WRAPPER
-WOLFSSL_TEST_SUBROUTINE int hash_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
{
wc_HashAlg hash;
int ret, exp_ret;
@@ -5050,7 +5056,7 @@ WOLFSSL_TEST_SUBROUTINE int hash_test(void)
#if !defined(NO_HMAC) && !defined(NO_MD5) && !(defined(HAVE_FIPS) && \
defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION >= 5))
-WOLFSSL_TEST_SUBROUTINE int hmac_md5_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_md5_test(void)
{
Hmac hmac;
byte hash[WC_MD5_DIGEST_SIZE];
@@ -5065,7 +5071,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_md5_test(void)
testVector a, b, c;
testVector test_hmac[3];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_hmac) / sizeof(testVector), i;
a.input = "Hi There";
@@ -5132,7 +5138,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_md5_test(void)
#endif /* !NO_HMAC && !NO_MD5 && (!HAVE_FIPS || (HAVE_FIPS_VERSION < 5)) */
#if !defined(NO_HMAC) && !defined(NO_SHA)
-WOLFSSL_TEST_SUBROUTINE int hmac_sha_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha_test(void)
{
Hmac hmac;
byte hash[WC_SHA_DIGEST_SIZE];
@@ -5149,7 +5155,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha_test(void)
testVector a, b, c;
testVector test_hmac[3];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_hmac) / sizeof(testVector), i;
a.input = "Hi There";
@@ -5215,7 +5221,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha_test(void)
#if !defined(NO_HMAC) && defined(WOLFSSL_SHA224)
-WOLFSSL_TEST_SUBROUTINE int hmac_sha224_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha224_test(void)
{
Hmac hmac;
byte hash[WC_SHA224_DIGEST_SIZE];
@@ -5237,7 +5243,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha224_test(void)
testVector a, b, c, d;
testVector test_hmac[4];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_hmac) / sizeof(testVector), i;
a.input = "Hi There";
@@ -5310,7 +5316,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha224_test(void)
#if !defined(NO_HMAC) && !defined(NO_SHA256)
-WOLFSSL_TEST_SUBROUTINE int hmac_sha256_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha256_test(void)
{
Hmac hmac;
byte hash[WC_SHA256_DIGEST_SIZE];
@@ -5329,7 +5335,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha256_test(void)
testVector a, b, c, d;
testVector test_hmac[4];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_hmac) / sizeof(testVector), i;
a.input = "Hi There";
@@ -5416,7 +5422,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha256_test(void)
#if !defined(NO_HMAC) && defined(WOLFSSL_SHA384)
-WOLFSSL_TEST_SUBROUTINE int hmac_sha384_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha384_test(void)
{
Hmac hmac;
byte hash[WC_SHA384_DIGEST_SIZE];
@@ -5442,7 +5448,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha384_test(void)
testVector a, b, c, d;
testVector test_hmac[4];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_hmac) / sizeof(testVector), i;
a.input = "Hi There";
@@ -5523,7 +5529,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha384_test(void)
#if !defined(NO_HMAC) && defined(WOLFSSL_SHA512)
-WOLFSSL_TEST_SUBROUTINE int hmac_sha512_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha512_test(void)
{
Hmac hmac;
byte hash[WC_SHA512_DIGEST_SIZE];
@@ -5549,7 +5555,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha512_test(void)
testVector a, b, c, d;
testVector test_hmac[4];
- int ret;
+ wc_test_ret_t ret;
int times = sizeof(test_hmac) / sizeof(testVector), i;
a.input = "Hi There";
@@ -5636,7 +5642,7 @@ WOLFSSL_TEST_SUBROUTINE int hmac_sha512_test(void)
#if !defined(NO_HMAC) && defined(WOLFSSL_SHA3) && \
!defined(WOLFSSL_NOSHA3_224) && !defined(WOLFSSL_NOSHA3_256) && \
!defined(WOLFSSL_NOSHA3_384) && !defined(WOLFSSL_NOSHA3_512)
-WOLFSSL_TEST_SUBROUTINE int hmac_sha3_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hmac_sha3_test(void)
{
Hmac hmac;
byte hash[WC_SHA3_512_DIGEST_SIZE];
@@ -5819,9 +5825,9 @@ typedef struct rc2TestVector {
int effectiveKeyBits; /* Up to 1024 bits supported */
} rc2TestVector;
-static int rc2_ecb_test(void)
+static wc_test_ret_t rc2_ecb_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte cipher[RC2_BLOCK_SIZE];
byte plain[RC2_BLOCK_SIZE];
@@ -5948,9 +5954,9 @@ static int rc2_ecb_test(void)
return 0;
}
-static int rc2_cbc_test(void)
+static wc_test_ret_t rc2_cbc_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte cipher[128];
byte plain[128];
@@ -6129,9 +6135,9 @@ static int rc2_cbc_test(void)
return 0;
}
-WOLFSSL_TEST_SUBROUTINE int rc2_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rc2_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
ret = rc2_ecb_test();
if (ret != 0) {
@@ -6144,11 +6150,11 @@ WOLFSSL_TEST_SUBROUTINE int rc2_test(void)
#ifndef NO_RC4
-WOLFSSL_TEST_SUBROUTINE int arc4_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t arc4_test(void)
{
byte cipher[16];
byte plain[16];
- int ret;
+ wc_test_ret_t ret;
const char* keys[] =
{
@@ -6232,7 +6238,7 @@ WOLFSSL_TEST_SUBROUTINE int arc4_test(void)
#endif
#ifdef HAVE_CHACHA
-WOLFSSL_TEST_SUBROUTINE int chacha_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t chacha_test(void)
{
ChaCha enc;
ChaCha dec;
@@ -6241,7 +6247,7 @@ WOLFSSL_TEST_SUBROUTINE int chacha_test(void)
byte sliver[64];
byte input[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
word32 keySz = 32;
- int ret = 0;
+ wc_test_ret_t ret = 0;
int i;
int times = 4;
@@ -6618,9 +6624,9 @@ WOLFSSL_TEST_SUBROUTINE int chacha_test(void)
#ifdef HAVE_POLY1305
-WOLFSSL_TEST_SUBROUTINE int poly1305_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t poly1305_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int i;
byte tag[16];
Poly1305 enc;
@@ -6829,7 +6835,7 @@ WOLFSSL_TEST_SUBROUTINE int poly1305_test(void)
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
-WOLFSSL_TEST_SUBROUTINE int chacha20_poly1305_aead_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t chacha20_poly1305_aead_test(void)
{
/* Test #1 from Section 2.8.2 of draft-irtf-cfrg-chacha20-poly1305-10 */
/* https://tools.ietf.org/html/draft-irtf-cfrg-chacha20-poly1305-10 */
@@ -6994,7 +7000,7 @@ WOLFSSL_TEST_SUBROUTINE int chacha20_poly1305_aead_test(void)
byte generatedCiphertext[265]; /* max plaintext2/cipher2 */
byte generatedPlaintext[265]; /* max plaintext2/cipher2 */
byte generatedAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE];
- int err;
+ wc_test_ret_t err;
ChaChaPoly_Aead aead;
@@ -7348,7 +7354,7 @@ WOLFSSL_TEST_SUBROUTINE int chacha20_poly1305_aead_test(void)
#ifndef NO_DES3
-WOLFSSL_TEST_SUBROUTINE int des_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t des_test(void)
{
WOLFSSL_SMALL_STACK_STATIC const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
@@ -7379,7 +7385,7 @@ WOLFSSL_TEST_SUBROUTINE int des_test(void)
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
};
- int ret;
+ wc_test_ret_t ret;
ret = wc_Des_SetKey(&enc, key, iv, DES_ENCRYPTION);
if (ret != 0)
@@ -7443,7 +7449,7 @@ WOLFSSL_TEST_SUBROUTINE int des_test(void)
#ifndef NO_DES3
-WOLFSSL_TEST_SUBROUTINE int des3_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t des3_test(void)
{
WOLFSSL_SMALL_STACK_STATIC const byte vector[] = { /* "Now is the time for all " w/o trailing 0 */
0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
@@ -7478,7 +7484,7 @@ WOLFSSL_TEST_SUBROUTINE int des3_test(void)
0x18,0x94,0x15,0x74,0x87,0x12,0x7d,0xb0
};
- int ret;
+ wc_test_ret_t ret;
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
size_t i;
#endif
@@ -7592,7 +7598,7 @@ static const int fiducial1 = WC_TEST_RET_LN; /* source code reference point --
&& !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS)
/* pass in the function, key, iv, plain text and expected and this function
* tests that the encryption and decryption is successful */
-static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
+static wc_test_ret_t EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
const byte* iv, const byte* plain, int plainSz,
const byte* expected, int expectedSz)
{
@@ -7601,7 +7607,8 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
#else
EVP_CIPHER_CTX ctx[1];
#endif
- int idx, ret = 0, cipherSz;
+ int idx, cipherSz;
+ wc_test_ret_t ret = 0;
byte* cipher;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -7678,7 +7685,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
#ifdef WOLFSSL_AES_OFB
/* test vector from https://csrc.nist.gov/Projects/cryptographic-algorithm-validation-program/Block-Ciphers */
- WOLFSSL_TEST_SUBROUTINE int aesofb_test(void)
+ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesofb_test(void)
{
#ifdef WOLFSSL_AES_256
WOLFSSL_SMALL_STACK_STATIC const byte key1[] =
@@ -7775,7 +7782,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
#endif
byte plain [AES_BLOCK_SIZE * 4];
#endif
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
if ((enc = (Aes *)XMALLOC(sizeof *enc, HEAP_HINT, DYNAMIC_TYPE_AES)) == NULL)
@@ -8044,7 +8051,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
#if defined(WOLFSSL_AES_CFB)
/* Test cases from NIST SP 800-38A, Recommendation for Block Cipher Modes of Operation Methods an*/
- static int aescfb_test(void)
+ static wc_test_ret_t aescfb_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc = NULL;
@@ -8062,7 +8069,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
int dec_inited = 0;
byte plain [AES_BLOCK_SIZE * 4];
#endif
- int ret = 0;
+ wc_test_ret_t ret = 0;
WOLFSSL_SMALL_STACK_STATIC const byte iv[] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
@@ -8369,7 +8376,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
}
#if !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS)
- static int aescfb1_test(void)
+ static wc_test_ret_t aescfb1_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc = NULL;
@@ -8387,7 +8394,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
int dec_inited = 0;
byte plain [AES_BLOCK_SIZE];
#endif
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef WOLFSSL_AES_128
WOLFSSL_SMALL_STACK_STATIC const byte iv[] = {
@@ -8619,7 +8626,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
return ret;
}
- static int aescfb8_test(void)
+ static wc_test_ret_t aescfb8_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc = NULL;
@@ -8637,7 +8644,7 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
int dec_inited = 0;
byte plain [AES_BLOCK_SIZE];
#endif
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef WOLFSSL_AES_128
WOLFSSL_SMALL_STACK_STATIC const byte iv[] = {
@@ -8837,9 +8844,9 @@ static int EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
#endif /* WOLFSSL_AES_CFB */
-static int aes_key_size_test(void)
+static wc_test_ret_t aes_key_size_test(void)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *aes;
#else
@@ -8973,7 +8980,7 @@ static int aes_key_size_test(void)
#if defined(WOLFSSL_AES_XTS)
/* test vectors from http://csrc.nist.gov/groups/STM/cavp/block-cipher-modes.html */
#ifdef WOLFSSL_AES_128
-static int aes_xts_128_test(void)
+static wc_test_ret_t aes_xts_128_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
XtsAes *aes = NULL;
@@ -8981,7 +8988,7 @@ static int aes_xts_128_test(void)
XtsAes aes[1];
#endif
int aes_inited = 0;
- int ret = 0;
+ wc_test_ret_t ret = 0;
unsigned char buf[AES_BLOCK_SIZE * 2 + 8];
unsigned char cipher[AES_BLOCK_SIZE * 2 + 8];
@@ -9236,7 +9243,7 @@ static int aes_xts_128_test(void)
#ifdef WOLFSSL_AES_256
-static int aes_xts_256_test(void)
+static wc_test_ret_t aes_xts_256_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
XtsAes *aes = NULL;
@@ -9244,7 +9251,7 @@ static int aes_xts_256_test(void)
XtsAes aes[1];
#endif
int aes_inited = 0;
- int ret = 0;
+ wc_test_ret_t ret = 0;
unsigned char buf[AES_BLOCK_SIZE * 3];
unsigned char cipher[AES_BLOCK_SIZE * 3];
@@ -9433,7 +9440,7 @@ static int aes_xts_256_test(void)
#if defined(WOLFSSL_AES_128) && defined(WOLFSSL_AES_256)
/* both 128 and 256 bit key test */
-static int aes_xts_sector_test(void)
+static wc_test_ret_t aes_xts_sector_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
XtsAes *aes = NULL;
@@ -9441,7 +9448,7 @@ static int aes_xts_sector_test(void)
XtsAes aes[1];
#endif
int aes_inited = 0;
- int ret = 0;
+ wc_test_ret_t ret = 0;
unsigned char buf[AES_BLOCK_SIZE * 2];
/* 128 key tests */
@@ -9576,7 +9583,7 @@ static int aes_xts_sector_test(void)
#ifdef WOLFSSL_AES_128
/* testing of bad arguments */
-static int aes_xts_args_test(void)
+static wc_test_ret_t aes_xts_args_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
XtsAes *aes = NULL;
@@ -9584,7 +9591,7 @@ static int aes_xts_args_test(void)
XtsAes aes[1];
#endif
int aes_inited = 0;
- int ret;
+ wc_test_ret_t ret;
unsigned char buf[AES_BLOCK_SIZE * 2];
/* 128 key tests */
@@ -9677,11 +9684,11 @@ static int aes_xts_args_test(void)
#endif /* WOLFSSL_AES_XTS */
#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
-static int aes_cbc_test(void)
+static wc_test_ret_t aes_cbc_test(void)
{
byte cipher[AES_BLOCK_SIZE];
byte plain[AES_BLOCK_SIZE];
- int ret;
+ wc_test_ret_t ret;
WOLFSSL_SMALL_STACK_STATIC const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
@@ -9722,7 +9729,7 @@ static int aes_cbc_test(void)
#endif
#if defined(HAVE_AES_ECB) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
-static int aesecb_test(void)
+static wc_test_ret_t aesecb_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc = (Aes *)XMALLOC(sizeof *enc, HEAP_HINT, DYNAMIC_TYPE_AES);
@@ -9740,7 +9747,7 @@ static int aesecb_test(void)
int dec_inited = 0;
byte plain [AES_BLOCK_SIZE * 4];
#endif /* HAVE_AES_DECRYPT */
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(WOLFSSL_AES_256)
{
@@ -9826,9 +9833,9 @@ static int aesecb_test(void)
#endif /* HAVE_AES_ECB */
#ifdef WOLFSSL_AES_COUNTER
-static int aesctr_test(Aes* enc, Aes* dec, byte* cipher, byte* plain)
+static wc_test_ret_t aesctr_test(Aes* enc, Aes* dec, byte* cipher, byte* plain)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
/* test vectors from "Recommendation for Block Cipher Modes of
* Operation" NIST Special Publication 800-38A */
@@ -10402,7 +10409,7 @@ static int aesctr_test(Aes* enc, Aes* dec, byte* cipher, byte* plain)
ret = wc_AesSetKeyDirect(dec, testVec[i].key, testVec[i].keySz,
testVec[i].iv, AES_ENCRYPTION);
if (ret != 0) {
- ERROR_OUT(WC_TEST_RET_ENC_EC(i), out);
+ ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
}
}
@@ -10431,7 +10438,7 @@ static int aesctr_test(Aes* enc, Aes* dec, byte* cipher, byte* plain)
#endif /* WOLFSSL_AES_COUNTER */
-WOLFSSL_TEST_SUBROUTINE int aes_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_test(void)
{
#if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_DIRECT)
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -10451,7 +10458,7 @@ WOLFSSL_TEST_SUBROUTINE int aes_test(void)
byte plain [AES_BLOCK_SIZE * 4];
#endif /* HAVE_AES_DECRYPT */
#endif /* HAVE_AES_CBC || WOLFSSL_AES_COUNTER || WOLFSSL_AES_DIRECT */
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef HAVE_AES_CBC
#ifdef WOLFSSL_AES_128
@@ -10887,7 +10894,7 @@ WOLFSSL_TEST_SUBROUTINE int aes_test(void)
}
#ifdef WOLFSSL_AES_192
-WOLFSSL_TEST_SUBROUTINE int aes192_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes192_test(void)
{
#ifdef HAVE_AES_CBC
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -10905,7 +10912,7 @@ WOLFSSL_TEST_SUBROUTINE int aes192_test(void)
byte plain[AES_BLOCK_SIZE];
#endif
#endif /* HAVE_AES_CBC */
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef HAVE_AES_CBC
/* Test vectors from NIST Special Publication 800-38A, 2001 Edition
@@ -11003,7 +11010,7 @@ WOLFSSL_TEST_SUBROUTINE int aes192_test(void)
#endif /* WOLFSSL_AES_192 */
#ifdef WOLFSSL_AES_256
-WOLFSSL_TEST_SUBROUTINE int aes256_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes256_test(void)
{
#ifdef HAVE_AES_CBC
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -11021,7 +11028,7 @@ WOLFSSL_TEST_SUBROUTINE int aes256_test(void)
byte plain[AES_BLOCK_SIZE];
#endif
#endif /* HAVE_AES_CBC */
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef HAVE_AES_CBC
/* Test vectors from NIST Special Publication 800-38A, 2001 Edition,
@@ -11122,11 +11129,12 @@ WOLFSSL_TEST_SUBROUTINE int aes256_test(void)
#ifdef HAVE_AESGCM
#ifdef WOLFSSL_AES_128
-static int aesgcm_default_test_helper(byte* key, int keySz, byte* iv, int ivSz,
+static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv, int ivSz,
byte* plain, int plainSz, byte* cipher, int cipherSz,
byte* aad, int aadSz, byte* tag, int tagSz)
{
- int ret, enc_inited = 0, dec_inited = 0;
+ wc_test_ret_t ret;
+ int enc_inited = 0, dec_inited = 0;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc = NULL;
Aes *dec = NULL;
@@ -11231,7 +11239,7 @@ static int aesgcm_default_test_helper(byte* key, int keySz, byte* iv, int ivSz,
/* tests that only use 12 byte IV and 16 or less byte AAD
* test vectors are from NIST SP 800-38D
* https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/CAVP-TESTING-BLOCK-CIPHER-MODES*/
-WOLFSSL_TEST_SUBROUTINE int aesgcm_default_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesgcm_default_test(void)
{
#ifdef WOLFSSL_AES_128
byte key1[] = {
@@ -11308,7 +11316,7 @@ WOLFSSL_TEST_SUBROUTINE int aesgcm_default_test(void)
0x11, 0x64, 0xb2, 0xff
};
- int ret;
+ wc_test_ret_t ret;
ret = aesgcm_default_test_helper(key1, sizeof(key1), iv1, sizeof(iv1),
plain1, sizeof(plain1), cipher1, sizeof(cipher1),
aad1, sizeof(aad1), tag1, sizeof(tag1));
@@ -11332,7 +11340,7 @@ WOLFSSL_TEST_SUBROUTINE int aesgcm_default_test(void)
return 0;
}
-WOLFSSL_TEST_SUBROUTINE int aesgcm_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesgcm_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc = NULL;
@@ -11499,7 +11507,7 @@ WOLFSSL_TEST_SUBROUTINE int aesgcm_test(void)
byte resultT[sizeof(t1) + AES_BLOCK_SIZE];
byte resultP[sizeof(p) + AES_BLOCK_SIZE];
byte resultC[sizeof(p) + AES_BLOCK_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef WOLFSSL_AES_256
#if !(defined(WOLF_CRYPTO_CB) && defined(HAVE_INTEL_QA_SYNC))
int alen;
@@ -12088,9 +12096,9 @@ WOLFSSL_TEST_SUBROUTINE int aesgcm_test(void)
}
#ifdef WOLFSSL_AES_128
-WOLFSSL_TEST_SUBROUTINE int gmac_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t gmac_test(void)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Gmac *gmac;
#else
@@ -12235,9 +12243,9 @@ WOLFSSL_TEST_SUBROUTINE int gmac_test(void)
#if defined(WOLFSSL_AES_256)
-static int aesccm_256_test(void)
+static wc_test_ret_t aesccm_256_test(void)
{
- int ret;
+ wc_test_ret_t ret;
/* Test vectors from NIST AES CCM 256-bit CAST Example #1 */
WOLFSSL_SMALL_STACK_STATIC const byte in_key[32] = {
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
@@ -12311,9 +12319,9 @@ static int aesccm_256_test(void)
#if defined(WOLFSSL_AES_128)
-static int aesccm_128_test(void)
+static wc_test_ret_t aesccm_128_test(void)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Aes *enc;
#else
@@ -12586,9 +12594,9 @@ static int aesccm_128_test(void)
}
#endif /* WOLFSSL_AES_128 */
-WOLFSSL_TEST_SUBROUTINE int aesccm_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesccm_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef WOLFSSL_AES_128
if (ret == 0)
ret = aesccm_128_test();
@@ -12616,7 +12624,7 @@ typedef struct keywrapVector {
word32 verifyLen;
} keywrapVector;
-WOLFSSL_TEST_SUBROUTINE int aeskeywrap_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aeskeywrap_test(void)
{
int wrapSz, plainSz, testSz, i;
@@ -12824,7 +12832,7 @@ typedef struct {
int errorCode;
} test_vector_t;
-WOLFSSL_TEST_SUBROUTINE int camellia_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t camellia_test(void)
{
/* Camellia ECB Test Plaintext */
WOLFSSL_SMALL_STACK_STATIC const byte pte[] =
@@ -13018,8 +13026,8 @@ WOLFSSL_TEST_SUBROUTINE int camellia_test(void)
#endif /* HAVE_CAMELLIA */
#ifdef HAVE_XCHACHA
-WOLFSSL_TEST_SUBROUTINE int XChaCha_test(void) {
- int ret;
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t XChaCha_test(void) {
+ wc_test_ret_t ret;
WOLFSSL_SMALL_STACK_STATIC const byte Plaintext[] = {
0x54, 0x68, 0x65, 0x20, 0x64, 0x68, 0x6f, 0x6c, 0x65, 0x20, 0x28, 0x70, 0x72, 0x6f, 0x6e, 0x6f, /* The dhole (prono */
@@ -13125,8 +13133,8 @@ WOLFSSL_TEST_SUBROUTINE int XChaCha_test(void) {
#endif /* HAVE_XCHACHA */
#if defined(HAVE_XCHACHA) && defined(HAVE_POLY1305)
-WOLFSSL_TEST_SUBROUTINE int XChaCha20Poly1305_test(void) {
- int ret;
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t XChaCha20Poly1305_test(void) {
+ wc_test_ret_t ret;
WOLFSSL_SMALL_STACK_STATIC const byte Plaintext[] = {
0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x47, 0x65, 0x6e, 0x74, 0x6c, /* Ladies and Gentl */
@@ -13215,10 +13223,11 @@ WOLFSSL_TEST_SUBROUTINE int XChaCha20Poly1305_test(void) {
#endif /* defined(HAVE_XCHACHA) && defined(HAVE_POLY1305) */
#ifndef WC_NO_RNG
-static int _rng_test(WC_RNG* rng, int errorOffset)
+static wc_test_ret_t _rng_test(WC_RNG* rng, int errorOffset)
{
byte block[32];
- int ret, i;
+ wc_test_ret_t ret;
+ int i;
XMEMSET(block, 0, sizeof(block));
@@ -13278,11 +13287,11 @@ static int _rng_test(WC_RNG* rng, int errorOffset)
return ret;
}
-static int random_rng_test(void)
+static wc_test_ret_t random_rng_test(void)
{
WC_RNG localRng;
WC_RNG* rng;
- int ret;
+ wc_test_ret_t ret;
rng = &localRng;
/* Test stack based RNG. */
@@ -13335,7 +13344,7 @@ static int seed_cb(OS_Seed* os, byte* output, word32 sz)
return 0;
}
-static int rng_seed_test(void)
+static wc_test_ret_t rng_seed_test(void)
{
#ifndef HAVE_FIPS
WOLFSSL_SMALL_STACK_STATIC const byte check[] =
@@ -13357,7 +13366,7 @@ static int rng_seed_test(void)
#endif
byte output[WC_SHA256_DIGEST_SIZE];
WC_RNG rng;
- int ret;
+ wc_test_ret_t ret;
ret = wc_SetSeed_Cb(seed_cb);
if (ret != 0) {
@@ -13390,7 +13399,7 @@ static int rng_seed_test(void)
#endif
-WOLFSSL_TEST_SUBROUTINE int random_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t random_test(void)
{
WOLFSSL_SMALL_STACK_STATIC const byte test1Entropy[] =
{
@@ -13442,7 +13451,7 @@ WOLFSSL_TEST_SUBROUTINE int random_test(void)
};
byte output[WC_SHA256_DIGEST_SIZE * 4];
- int ret;
+ wc_test_ret_t ret;
ret = wc_RNG_HealthTest(0, test1Entropy, sizeof(test1Entropy), NULL, 0,
output, sizeof(output));
@@ -13507,7 +13516,7 @@ WOLFSSL_TEST_SUBROUTINE int random_test(void)
#else
-WOLFSSL_TEST_SUBROUTINE int random_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t random_test(void)
{
/* Basic RNG generate block test */
return random_rng_test();
@@ -13521,9 +13530,9 @@ WOLFSSL_TEST_SUBROUTINE int random_test(void)
#endif
#if defined(WOLFSSL_STATIC_MEMORY) || !defined(WOLFSSL_NO_MALLOC)
-static int simple_mem_test(int sz)
+static wc_test_ret_t simple_mem_test(int sz)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* b;
int i;
@@ -13547,9 +13556,9 @@ static int simple_mem_test(int sz)
}
#endif
-WOLFSSL_TEST_SUBROUTINE int memory_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memory_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(COMPLEX_MEM_TEST) || defined(WOLFSSL_STATIC_MEMORY)
int i;
#endif
@@ -14022,9 +14031,9 @@ static int add_data(byte* certData, int offset, byte* data, byte length)
return offset + length;
}
-static int cert_asn1_test(void)
+static wc_test_ret_t cert_asn1_test(void)
{
- int ret;
+ wc_test_ret_t ret;
int len[3];
DecodedCert cert;
byte certData[114];
@@ -14078,14 +14087,14 @@ static int cert_asn1_test(void)
return ret;
}
-WOLFSSL_TEST_SUBROUTINE int cert_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cert_test(void)
{
#if !defined(NO_FILESYSTEM)
DecodedCert cert;
byte* tmp;
size_t bytes;
XFILE file;
- int ret;
+ wc_test_ret_t ret;
tmp = (byte*)XMALLOC(FOURK_BUF, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
if (tmp == NULL)
@@ -14156,13 +14165,13 @@ WOLFSSL_TEST_SUBROUTINE int cert_test(void)
#if defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_TEST_CERT) && \
!defined(NO_FILESYSTEM) && defined(WOLFSSL_CERT_GEN)
-WOLFSSL_TEST_SUBROUTINE int certext_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certext_test(void)
{
DecodedCert cert;
byte* tmp;
size_t bytes;
XFILE file;
- int ret;
+ wc_test_ret_t ret;
/* created from rsa_test : othercert.der */
byte skid_rsa[] = "\x33\xD8\x45\x66\xD7\x68\x87\x18\x7E\x54"
@@ -14351,9 +14360,9 @@ WOLFSSL_TEST_SUBROUTINE int certext_test(void)
#if defined(WOLFSSL_CERT_GEN_CACHE) && defined(WOLFSSL_TEST_CERT) && \
defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_CERT_GEN)
-WOLFSSL_TEST_SUBROUTINE int decodedCertCache_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t decodedCertCache_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
Cert cert;
FILE* file;
byte* der;
@@ -14501,9 +14510,9 @@ WOLFSSL_TEST_SUBROUTINE int decodedCertCache_test(void)
#if !defined(NO_ASN) && !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
!defined(WOLFSSL_RSA_VERIFY_ONLY)
-static int rsa_flatten_test(RsaKey* key)
+static wc_test_ret_t rsa_flatten_test(RsaKey* key)
{
- int ret;
+ wc_test_ret_t ret;
byte e[RSA_TEST_BYTES];
byte n[RSA_TEST_BYTES];
word32 eSz = sizeof(e);
@@ -14596,9 +14605,9 @@ static int rsa_flatten_test(RsaKey* key)
#if !defined(HAVE_FIPS) && !defined(HAVE_USER_RSA) && !defined(NO_ASN) \
&& !defined(WOLFSSL_RSA_VERIFY_ONLY)
-static int rsa_export_key_test(RsaKey* key)
+static wc_test_ret_t rsa_export_key_test(RsaKey* key)
{
- int ret;
+ wc_test_ret_t ret;
byte e[3];
word32 eSz = sizeof(e);
byte n[RSA_TEST_BYTES];
@@ -14672,9 +14681,9 @@ static int rsa_export_key_test(RsaKey* key)
#endif /* !HAVE_FIPS && !USER_RSA && !NO_ASN */
#ifndef NO_SIG_WRAPPER
-static int rsa_sig_test(RsaKey* key, word32 keyLen, int modLen, WC_RNG* rng)
+static wc_test_ret_t rsa_sig_test(RsaKey* key, word32 keyLen, int modLen, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
word32 sigSz;
WOLFSSL_SMALL_STACK_STATIC const byte in[] = TEST_STRING;
WOLFSSL_SMALL_STACK_STATIC const byte hash[] = {
@@ -14867,10 +14876,11 @@ static int rsa_sig_test(RsaKey* key, word32 keyLen, int modLen, WC_RNG* rng)
#endif /* !NO_SIG_WRAPPER */
#ifdef WC_RSA_NONBLOCK
-static int rsa_nb_test(RsaKey* key, const byte* in, word32 inLen, byte* out,
+static wc_test_ret_t rsa_nb_test(RsaKey* key, const byte* in, word32 inLen, byte* out,
word32 outSz, byte* plain, word32 plainSz, WC_RNG* rng)
{
- int ret = 0, count;
+ wc_test_ret_t ret = 0;
+ int count;
int signSz = 0;
RsaNb nb;
byte* inlinePlain = NULL;
@@ -14954,9 +14964,9 @@ static int rsa_nb_test(RsaKey* key, const byte* in, word32 inLen, byte* out,
#endif
#if !defined(HAVE_USER_RSA) && !defined(NO_ASN)
-static int rsa_decode_test(RsaKey* keyPub)
+static wc_test_ret_t rsa_decode_test(RsaKey* keyPub)
{
- int ret;
+ wc_test_ret_t ret;
word32 inSz;
word32 inOutIdx;
WOLFSSL_SMALL_STACK_STATIC const byte n[2] = { 0x00, 0x23 };
@@ -15242,10 +15252,10 @@ static int rsa_decode_test(RsaKey* keyPub)
/* Need to create known good signatures to test with this. */
#if !defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
!defined(WOLF_CRYPTO_CB_ONLY_RSA)
-static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
+static wc_test_ret_t rsa_pss_test(WC_RNG* rng, RsaKey* key)
{
byte digest[WC_MAX_DIGEST_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
const char inStr[] = TEST_STRING;
word32 inLen = (word32)TEST_STRING_SZ;
word32 outSz;
@@ -15327,7 +15337,7 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
} while (ret == WC_PENDING_E);
if (ret <= 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_pss);
- outSz = ret;
+ outSz = (word32)ret;
XMEMCPY(sig, out, outSz);
plain = NULL;
@@ -15345,7 +15355,7 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
} while (ret == WC_PENDING_E);
if (ret <= 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_pss);
- plainSz = ret;
+ plainSz = (word32)ret;
TEST_SLEEP();
#if defined(HAVE_SELFTEST) && \
@@ -15407,7 +15417,7 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
} while (ret == WC_PENDING_E);
if (ret <= 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_pss);
- outSz = ret;
+ outSz = (word32)ret;
TEST_SLEEP();
do {
@@ -15422,7 +15432,7 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
} while (ret == WC_PENDING_E);
if (ret <= 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_pss);
- plainSz = ret;
+ plainSz = (word32)ret;
TEST_SLEEP();
do {
@@ -15461,7 +15471,7 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
} while (ret == WC_PENDING_E);
if (ret <= 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_pss);
- plainSz = ret;
+ plainSz = (word32)ret;
TEST_SLEEP();
#if defined(HAVE_SELFTEST) && \
@@ -15595,12 +15605,12 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
#endif
#ifdef WC_RSA_NO_PADDING
-WOLFSSL_TEST_SUBROUTINE int rsa_no_pad_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_no_pad_test(void)
{
WC_RNG rng;
byte* tmp = NULL;
size_t bytes;
- int ret;
+ wc_test_ret_t ret;
word32 inLen = 0;
word32 idx = 0;
word32 outSz = RSA_TEST_BYTES;
@@ -15823,11 +15833,11 @@ WOLFSSL_TEST_SUBROUTINE int rsa_no_pad_test(void)
#endif /* WC_RSA_NO_PADDING */
#if defined(WOLFSSL_HAVE_SP_RSA) && defined(USE_FAST_MATH)
-static int rsa_even_mod_test(WC_RNG* rng, RsaKey* key)
+static wc_test_ret_t rsa_even_mod_test(WC_RNG* rng, RsaKey* key)
{
byte* tmp = NULL;
size_t bytes;
- int ret;
+ wc_test_ret_t ret;
word32 inLen = 0;
#ifndef NO_ASN
word32 idx = 0;
@@ -15992,7 +16002,7 @@ static int rsa_even_mod_test(WC_RNG* rng, RsaKey* key)
#endif /* WOLFSSL_HAVE_SP_RSA */
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
-static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
+static wc_test_ret_t rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
RsaKey *caKey = (RsaKey *)XMALLOC(sizeof *caKey, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -16006,7 +16016,7 @@ static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
#endif
#endif
byte* der = NULL;
- int ret;
+ wc_test_ret_t ret;
Cert* myCert = NULL;
int certSz;
size_t bytes3;
@@ -16107,7 +16117,7 @@ static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
if (ret < 0) {
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
}
- certSz = ret;
+ certSz = (word32)ret;
#ifdef WOLFSSL_TEST_CERT
InitDecodedCert(decode, der, certSz, HEAP_HINT);
@@ -16266,7 +16276,7 @@ static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
} while (ret == WC_PENDING_E);
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
- certSz = ret;
+ certSz = (word32)ret;
#ifdef WOLFSSL_TEST_CERT
InitDecodedCert(decode, der, certSz, HEAP_HINT);
@@ -16309,7 +16319,7 @@ static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
#if !defined(NO_RSA) && defined(HAVE_ECC) && !defined(NO_ECC_SECP) && \
defined(WOLFSSL_CERT_GEN)
/* Make Cert / Sign example for ECC cert and RSA CA */
-static int rsa_ecc_certgen_test(WC_RNG* rng, byte* tmp)
+static wc_test_ret_t rsa_ecc_certgen_test(WC_RNG* rng, byte* tmp)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
RsaKey *caKey = (RsaKey *)XMALLOC(sizeof *caKey, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -16335,7 +16345,7 @@ static int rsa_ecc_certgen_test(WC_RNG* rng, byte* tmp)
|| !defined(USE_CERT_BUFFERS_256)
XFILE file3;
#endif
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
if ((caKey == NULL) || (caEccKey == NULL) || (caEccKeyPub == NULL)
@@ -16484,7 +16494,7 @@ static int rsa_ecc_certgen_test(WC_RNG* rng, byte* tmp)
} while (ret == WC_PENDING_E);
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
- certSz = ret;
+ certSz = (word32)ret;
#ifdef WOLFSSL_TEST_CERT
InitDecodedCert(decode, der, certSz, 0);
@@ -16539,14 +16549,14 @@ static int rsa_ecc_certgen_test(WC_RNG* rng, byte* tmp)
#endif /* !NO_RSA && HAVE_ECC && WOLFSSL_CERT_GEN */
#ifdef WOLFSSL_KEY_GEN
-static int rsa_keygen_test(WC_RNG* rng)
+static wc_test_ret_t rsa_keygen_test(WC_RNG* rng)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
RsaKey *genKey = (RsaKey *)XMALLOC(sizeof *genKey, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
#else
RsaKey genKey[1];
#endif
- int ret;
+ wc_test_ret_t ret;
byte* der = NULL;
#ifndef WOLFSSL_CRYPTOCELL
word32 idx = 0;
@@ -16647,9 +16657,9 @@ static int rsa_keygen_test(WC_RNG* rng)
(!defined(HAVE_FIPS) || \
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))) \
&& !defined(WOLF_CRYPTO_CB_ONLY_RSA)
-static int rsa_oaep_padding_test(RsaKey* key, WC_RNG* rng)
+static wc_test_ret_t rsa_oaep_padding_test(RsaKey* key, WC_RNG* rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
word32 idx = 0;
const char inStr[] = TEST_STRING;
const word32 inLen = (word32)TEST_STRING_SZ;
@@ -16891,7 +16901,7 @@ static int rsa_oaep_padding_test(RsaKey* key, WC_RNG* rng)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
TEST_SLEEP();
- idx = ret;
+ idx = (word32)ret;
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
do {
#if defined(WOLFSSL_ASYNC_CRYPT)
@@ -16966,9 +16976,9 @@ static int rsa_oaep_padding_test(RsaKey* key, WC_RNG* rng)
#endif
#endif
-WOLFSSL_TEST_SUBROUTINE int rsa_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
{
- int ret;
+ wc_test_ret_t ret;
size_t bytes;
WC_RNG rng;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -17169,7 +17179,7 @@ WOLFSSL_TEST_SUBROUTINE int rsa_test(void)
#ifdef WC_RSA_BLINDING
{
- int tmpret = ret;
+ wc_test_ret_t tmpret = ret;
ret = wc_RsaSetRNG(key, &rng);
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
@@ -17548,7 +17558,7 @@ WOLFSSL_TEST_SUBROUTINE int rsa_test(void)
} while (ret == WC_PENDING_E);
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
- derSz = ret;
+ derSz = (word32)ret;
ret = SaveDerAndPem(der, derSz, certReqDerFile, certReqPemFile,
CERTREQ_TYPE);
@@ -17654,9 +17664,9 @@ WOLFSSL_TEST_SUBROUTINE int rsa_test(void)
#ifndef NO_DH
-static int dh_fips_generate_test(WC_RNG *rng)
+static wc_test_ret_t dh_fips_generate_test(WC_RNG *rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
DhKey *key = (DhKey *)XMALLOC(sizeof *key, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
#else
@@ -17866,9 +17876,9 @@ static int dh_fips_generate_test(WC_RNG *rng)
return ret;
}
-static int dh_generate_test(WC_RNG *rng)
+static wc_test_ret_t dh_generate_test(WC_RNG *rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
DhKey *smallKey = NULL;
#else
@@ -17993,9 +18003,9 @@ typedef struct dh_pubvalue_test {
word32 len;
} dh_pubvalue_test;
-static int dh_test_check_pubvalue(void)
+static wc_test_ret_t dh_test_check_pubvalue(void)
{
- int ret;
+ wc_test_ret_t ret;
word32 i;
WOLFSSL_SMALL_STACK_STATIC const byte prime[] = {0x01, 0x00, 0x01};
WOLFSSL_SMALL_STACK_STATIC const byte pubValZero[] = { 0x00 };
@@ -18071,12 +18081,12 @@ static int dh_test_check_pubvalue(void)
(defined(WOLFSSL_SP_ARM64_ASM) || defined(WOLFSSL_SP_ARM32_ASM)))
#ifdef HAVE_PUBLIC_FFDHE
-static int dh_ffdhe_test(WC_RNG *rng, const DhParams* params)
+static wc_test_ret_t dh_ffdhe_test(WC_RNG *rng, const DhParams* params)
#else
-static int dh_ffdhe_test(WC_RNG *rng, int name)
+static wc_test_ret_t dh_ffdhe_test(WC_RNG *rng, int name)
#endif
{
- int ret;
+ wc_test_ret_t ret;
word32 privSz, pubSz, privSz2, pubSz2;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
byte *priv = (byte*)XMALLOC(MAX_DH_PRIV_SZ, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -18250,9 +18260,9 @@ static int dh_ffdhe_test(WC_RNG *rng, int name)
#endif /* !WC_NO_RNG */
#endif /* HAVE_FFDHE */
-WOLFSSL_TEST_SUBROUTINE int dh_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dh_test(void)
{
- int ret;
+ wc_test_ret_t ret;
word32 bytes;
word32 idx = 0, privSz, pubSz, privSz2, pubSz2;
#ifndef WC_NO_RNG
@@ -18677,9 +18687,10 @@ WOLFSSL_TEST_SUBROUTINE int dh_test(void)
#ifndef NO_DSA
-WOLFSSL_TEST_SUBROUTINE int dsa_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dsa_test(void)
{
- int ret = 0, answer;
+ wc_test_ret_t ret = 0;
+ int answer;
word32 bytes;
word32 idx = 0;
WC_RNG rng;
@@ -18880,9 +18891,9 @@ WOLFSSL_TEST_SUBROUTINE int dsa_test(void)
#ifdef WOLFCRYPT_HAVE_SRP
-static int generate_random_salt(byte *buf, word32 size)
+static wc_test_ret_t generate_random_salt(byte *buf, word32 size)
{
- int ret = WC_TEST_RET_ENC_NC;
+ wc_test_ret_t ret = WC_TEST_RET_ENC_NC;
WC_RNG rng;
if(NULL == buf || !size)
@@ -18897,9 +18908,9 @@ static int generate_random_salt(byte *buf, word32 size)
return ret;
}
-static int srp_test_digest(SrpType dgstType)
+static wc_test_ret_t srp_test_digest(SrpType dgstType)
{
- int r;
+ wc_test_ret_t r;
byte clientPubKey[192]; /* A */
byte serverPubKey[192]; /* B */
@@ -19042,9 +19053,9 @@ static int srp_test_digest(SrpType dgstType)
return r;
}
-WOLFSSL_TEST_SUBROUTINE int srp_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srp_test(void)
{
- int ret;
+ wc_test_ret_t ret;
#ifndef NO_SHA
ret = srp_test_digest(SRP_TYPE_SHA);
@@ -19075,7 +19086,7 @@ WOLFSSL_TEST_SUBROUTINE int srp_test(void)
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
#if !defined(NO_AES) && !defined(WOLFCRYPT_ONLY)
-static int openssl_aes_test(void)
+static wc_test_ret_t openssl_aes_test(void)
{
#ifdef HAVE_AES_CBC
#ifdef WOLFSSL_AES_128
@@ -19981,9 +19992,9 @@ static int openssl_aes_test(void)
#endif /* !defined(NO_AES) && !defined(WOLFCRYPT_ONLY) */
-WOLFSSL_TEST_SUBROUTINE int openssl_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_test(void)
{
- int ret;
+ wc_test_ret_t ret;
EVP_MD_CTX md_ctx;
testVector a, b, c, d, e, f;
byte hash[WC_SHA256_DIGEST_SIZE*2]; /* max size */
@@ -21149,9 +21160,9 @@ WOLFSSL_TEST_SUBROUTINE int openssl_test(void)
return 0;
}
-WOLFSSL_TEST_SUBROUTINE int openSSL_evpMD_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openSSL_evpMD_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if !defined(NO_SHA256) && !defined(NO_SHA)
WOLFSSL_EVP_MD_CTX* ctx;
WOLFSSL_EVP_MD_CTX* ctx2;
@@ -21243,9 +21254,9 @@ static void show(const char *title, const char *p, unsigned int s) {
#define FOURK_BUFF 4096
-WOLFSSL_TEST_SUBROUTINE int openssl_pkey0_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_pkey0_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if !defined(NO_RSA) && !defined(HAVE_USER_RSA) && !defined(NO_SHA)
byte* prvTmp;
byte* pubTmp;
@@ -21471,9 +21482,9 @@ WOLFSSL_TEST_SUBROUTINE int openssl_pkey0_test(void)
}
-WOLFSSL_TEST_SUBROUTINE int openssl_pkey1_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_pkey1_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if !defined(NO_FILESYSTEM) && !defined(NO_RSA) && !defined(HAVE_USER_RSA) && \
!defined(NO_SHA)
EVP_PKEY_CTX* dec = NULL;
@@ -21668,7 +21679,7 @@ WOLFSSL_TEST_SUBROUTINE int openssl_pkey1_test(void)
}
-WOLFSSL_TEST_SUBROUTINE int openssl_evpSig_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_evpSig_test(void)
{
#if !defined(NO_RSA) && !defined(NO_SHA) && !defined(HAVE_USER_RSA)
byte* prvTmp;
@@ -21687,7 +21698,7 @@ WOLFSSL_TEST_SUBROUTINE int openssl_evpSig_test(void)
unsigned int sigSz;
const void* pt;
unsigned int count;
- int ret, ret1, ret2;
+ wc_test_ret_t ret, ret1, ret2;
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
XFILE keyFile;
@@ -21868,12 +21879,12 @@ WOLFSSL_TEST_SUBROUTINE int openssl_evpSig_test(void)
#ifndef NO_PWDBASED
#ifdef HAVE_SCRYPT
/* Test vectors taken from RFC 7914: scrypt PBKDF - Section 12. */
-WOLFSSL_TEST_SUBROUTINE int scrypt_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t scrypt_test(void)
{
#ifdef HAVE_FIPS
/* RFC 7914 test vector keys are too short for FIPS. */
#else
- int ret;
+ wc_test_ret_t ret;
byte derived[64];
WOLFSSL_SMALL_STACK_STATIC const byte verify1[] = {
@@ -21982,7 +21993,7 @@ WOLFSSL_TEST_SUBROUTINE int scrypt_test(void)
#endif
#ifdef HAVE_PKCS12
-WOLFSSL_TEST_SUBROUTINE int pkcs12_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void)
{
WOLFSSL_SMALL_STACK_STATIC const byte passwd[] = { 0x00, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67,
0x00, 0x00 };
@@ -22008,7 +22019,7 @@ WOLFSSL_TEST_SUBROUTINE int pkcs12_test(void)
int id = 1;
int kLen = 24;
int iterations = 1;
- int ret = wc_PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8,
+ wc_test_ret_t ret = wc_PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8,
iterations, kLen, WC_SHA256, id);
if (ret < 0)
@@ -22036,7 +22047,7 @@ WOLFSSL_TEST_SUBROUTINE int pkcs12_test(void)
#endif /* HAVE_PKCS12 */
#if defined(HAVE_PBKDF2) && !defined(NO_SHA256) && !defined(NO_HMAC)
-WOLFSSL_TEST_SUBROUTINE int pbkdf2_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf2_test(void)
{
char passwd[] = "passwordpassword";
WOLFSSL_SMALL_STACK_STATIC const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
@@ -22049,7 +22060,7 @@ WOLFSSL_TEST_SUBROUTINE int pbkdf2_test(void)
0x2d, 0xd4, 0xf9, 0x37, 0xd4, 0x95, 0x16, 0xa7, 0x2a, 0x9a, 0x21, 0xd1
};
- int ret = wc_PBKDF2_ex(derived, (byte*)passwd, (int)XSTRLEN(passwd), salt,
+ wc_test_ret_t ret = wc_PBKDF2_ex(derived, (byte*)passwd, (int)XSTRLEN(passwd), salt,
(int)sizeof(salt), iterations, kLen, WC_SHA256, HEAP_HINT, devId);
if (ret != 0)
return ret;
@@ -22063,7 +22074,7 @@ WOLFSSL_TEST_SUBROUTINE int pbkdf2_test(void)
#endif /* HAVE_PBKDF2 && !NO_SHA256 && !NO_HMAC */
#if defined(HAVE_PBKDF1) && !defined(NO_SHA)
-WOLFSSL_TEST_SUBROUTINE int pbkdf1_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf1_test(void)
{
char passwd[] = "password";
WOLFSSL_SMALL_STACK_STATIC const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
@@ -22076,7 +22087,7 @@ WOLFSSL_TEST_SUBROUTINE int pbkdf1_test(void)
0xAF, 0x10, 0xEB, 0xFB, 0x4A, 0x3D, 0x2A, 0x20
};
- int ret = wc_PBKDF1_ex(derived, kLen, NULL, 0, (byte*)passwd,
+ wc_test_ret_t ret = wc_PBKDF1_ex(derived, kLen, NULL, 0, (byte*)passwd,
(int)XSTRLEN(passwd), salt, (int)sizeof(salt), iterations, WC_SHA,
HEAP_HINT);
if (ret != 0)
@@ -22089,9 +22100,9 @@ WOLFSSL_TEST_SUBROUTINE int pbkdf1_test(void)
}
#endif /* HAVE_PBKDF2 && !NO_SHA */
-WOLFSSL_TEST_SUBROUTINE int pwdbased_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(HAVE_PBKDF1) && !defined(NO_SHA)
ret = pbkdf1_test();
@@ -22120,10 +22131,16 @@ WOLFSSL_TEST_SUBROUTINE int pwdbased_test(void)
#if defined(HAVE_HKDF) && !defined(NO_HMAC)
+#if defined(WOLFSSL_AFALG_XILINX) || defined(WOLFSSL_AFALG_XILINX_AES) || \
+ defined(WOLFSSL_AFALG_XILINX_SHA3) || defined(WOLFSSL_AFALG_HASH_KEEP) || \
+ defined(WOLFSSL_AFALG_XILINX_RSA)
/* hkdf_test has issue with WOLFSSL_TEST_SUBROUTINE set on Xilinx with afalg */
-static int hkdf_test(void)
+static wc_test_ret_t hkdf_test(void)
+#else
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
+#endif
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if !defined(NO_SHA) || !defined(NO_SHA256)
int L;
@@ -22349,9 +22366,9 @@ static const SshKdfTestVector sshKdfTestVectors[] = {
};
-int sshkdf_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sshkdf_test(void)
{
- int result = 0;
+ wc_test_ret_t result = 0;
word32 i;
word32 tc = sizeof(sshKdfTestVectors)/sizeof(SshKdfTestVector);
const SshKdfTestVector* tv = NULL;
@@ -22936,9 +22953,9 @@ static const char resMasterLabel[] = "res master";
static const char derivedLabel[] = "derived";
-WOLFSSL_TEST_SUBROUTINE int tls13_kdf_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls13_kdf_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
word32 i;
word32 tc = sizeof(tls13KdfTestVectors)/sizeof(Tls13KdfTestVector);
const Tls13KdfTestVector* tv = NULL;
@@ -23079,9 +23096,9 @@ static const int fiducial2 = WC_TEST_RET_LN; /* source code reference point --
#if defined(HAVE_ECC) && defined(HAVE_X963_KDF)
-WOLFSSL_TEST_SUBROUTINE int x963kdf_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t x963kdf_test(void)
{
- int ret;
+ wc_test_ret_t ret;
byte kek[128];
#ifndef NO_SHA
@@ -23225,9 +23242,9 @@ WOLFSSL_TEST_SUBROUTINE int x963kdf_test(void)
#if defined(HAVE_HPKE) && (defined(HAVE_ECC) || defined(HAVE_CURVE25519)) && \
defined(HAVE_AESGCM)
-static int hpke_test_single(Hpke* hpke)
+static wc_test_ret_t hpke_test_single(Hpke* hpke)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int rngRet = 0;
WC_RNG rng[1];
const char* start_text = "this is a test";
@@ -23308,9 +23325,9 @@ static int hpke_test_single(Hpke* hpke)
return ret;
}
-WOLFSSL_TEST_SUBROUTINE int hpke_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hpke_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
Hpke hpke[1];
#if defined(HAVE_ECC)
@@ -23439,9 +23456,10 @@ typedef struct eccVector {
} eccVector;
#if !defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_test_vector_item(const eccVector* vector)
+static wc_test_ret_t ecc_test_vector_item(const eccVector* vector)
{
- int ret = 0, verify = 0;
+ wc_test_ret_t ret = 0;
+ int verify = 0;
word32 sigSz;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *userA = (ecc_key *)XMALLOC(sizeof *userA, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -23545,9 +23563,9 @@ static int ecc_test_vector_item(const eccVector* vector)
return ret;
}
-static int ecc_test_vector(int keySize)
+static wc_test_ret_t ecc_test_vector(int keySize)
{
- int ret;
+ wc_test_ret_t ret;
eccVector vec;
XMEMSET(&vec, 0, sizeof(vec));
@@ -23795,9 +23813,9 @@ static int ecc_test_vector(int keySize)
defined(WOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT)) \
&& (!defined(FIPS_VERSION_GE) || FIPS_VERSION_GE(5,3))
#if defined(HAVE_ECC256)
-static int ecc_test_deterministic_k(WC_RNG* rng)
+static wc_test_ret_t ecc_test_deterministic_k(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
#ifdef WOLFSSL_SMALL_STACK
ecc_key *key = NULL;
#else
@@ -23901,9 +23919,9 @@ static int ecc_test_deterministic_k(WC_RNG* rng)
#ifdef WOLFSSL_PUBLIC_MP
#if defined(HAVE_ECC384)
/* KAT from RFC6979 */
-static int ecc384_test_deterministic_k(WC_RNG* rng)
+static wc_test_ret_t ecc384_test_deterministic_k(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
#ifdef WOLFSSL_SMALL_STACK
ecc_key *key;
mp_int *r, *s, *expR, *expS;
@@ -24014,9 +24032,9 @@ static int ecc384_test_deterministic_k(WC_RNG* rng)
#if defined(HAVE_ECC521)
/* KAT from RFC6979 */
-static int ecc521_test_deterministic_k(WC_RNG* rng)
+static wc_test_ret_t ecc521_test_deterministic_k(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
#ifdef WOLFSSL_SMALL_STACK
ecc_key *key;
mp_int *r, *s, *expR, *expS;
@@ -24138,9 +24156,9 @@ static int ecc521_test_deterministic_k(WC_RNG* rng)
#if defined(HAVE_ECC_SIGN) && defined(WOLFSSL_ECDSA_SET_K) && \
!defined(WOLFSSL_KCAPI_ECC)
-static int ecc_test_sign_vectors(WC_RNG* rng)
+static wc_test_ret_t ecc_test_sign_vectors(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *key = NULL;
#else
@@ -24238,9 +24256,9 @@ static int ecc_test_sign_vectors(WC_RNG* rng)
#endif
#if defined(HAVE_ECC_CDH) && defined(HAVE_ECC_DHE)
-static int ecc_test_cdh_vectors(WC_RNG* rng)
+static wc_test_ret_t ecc_test_cdh_vectors(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *pub_key = (ecc_key *)XMALLOC(sizeof *pub_key, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
ecc_key *priv_key = (ecc_key *)XMALLOC(sizeof *priv_key, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -24342,7 +24360,7 @@ static int ecc_test_cdh_vectors(WC_RNG* rng)
#ifdef HAVE_ECC_KEY_IMPORT
/* returns 0 on success */
-static int ecc_test_make_pub(WC_RNG* rng)
+static wc_test_ret_t ecc_test_make_pub(WC_RNG* rng)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *key = (ecc_key *)XMALLOC(sizeof *key, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -24363,7 +24381,7 @@ static int ecc_test_make_pub(WC_RNG* rng)
const byte* msg = (const byte*)"test wolfSSL ECC public gen";
word32 x;
word32 tmpSz;
- int ret = 0;
+ wc_test_ret_t ret = 0;
ecc_point* pubPoint = NULL;
#ifdef HAVE_ECC_VERIFY
int verify = 0;
@@ -24618,9 +24636,9 @@ static int ecc_test_make_pub(WC_RNG* rng)
#if defined(HAVE_ECC_KEY_EXPORT) && !defined(NO_ASN_CRYPT) && \
!defined(WC_NO_RNG) && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_test_key_decode(WC_RNG* rng, int keySize)
+static wc_test_ret_t ecc_test_key_decode(WC_RNG* rng, int keySize)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *eccKey = (ecc_key *)XMALLOC(sizeof *eccKey, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
byte *tmpBuf = (byte *)XMALLOC(ECC_BUFSIZE, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -24654,7 +24672,7 @@ static int ecc_test_key_decode(WC_RNG* rng, int keySize)
if (ret < 0) {
goto done;
}
- tmpSz = ret;
+ tmpSz = (word32)ret;
ret = wc_ecc_init(eccKey);
if (ret != 0) {
@@ -24700,9 +24718,9 @@ static int ecc_test_key_decode(WC_RNG* rng, int keySize)
#if defined(HAVE_ECC_KEY_EXPORT) && !defined(NO_ASN_CRYPT) && \
!defined(WC_NO_RNG) && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_test_key_gen(WC_RNG* rng, int keySize)
+static wc_test_ret_t ecc_test_key_gen(WC_RNG* rng, int keySize)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int derSz;
#ifdef HAVE_PKCS8
word32 pkcs8Sz;
@@ -24808,7 +24826,7 @@ static int ecc_test_key_gen(WC_RNG* rng, int keySize)
}
#endif /* HAVE_ECC_KEY_EXPORT && !NO_ASN_CRYPT */
-static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
+static wc_test_ret_t ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
int curve_id, const ecc_set_type* dp)
{
#if defined(HAVE_ECC_DHE) && !defined(WC_NO_RNG) && \
@@ -24832,7 +24850,7 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
int verify;
#endif /* HAVE_ECC_VERIFY */
#endif /* HAVE_ECC_SIGN */
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *userA = (ecc_key *)XMALLOC(sizeof *userA, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
ecc_key *userB = (ecc_key *)XMALLOC(sizeof *userB, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -25249,9 +25267,9 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
#undef ECC_TEST_VERIFY_COUNT
#define ECC_TEST_VERIFY_COUNT 2
-static int ecc_test_curve(WC_RNG* rng, int keySize)
+static wc_test_ret_t ecc_test_curve(WC_RNG* rng, int keySize)
{
- int ret;
+ wc_test_ret_t ret;
ret = ecc_test_curve_size(rng, keySize, ECC_TEST_VERIFY_COUNT,
ECC_CURVE_DEF, NULL);
@@ -25263,7 +25281,7 @@ static int ecc_test_curve(WC_RNG* rng, int keySize)
and HAVE_ECC_KOBLITZ */
}
else {
- printf("ecc_test_curve_size %d failed!: %d\n", keySize, ret);
+ printf("ecc_test_curve_size %d failed!\n", keySize);
return ret;
}
}
@@ -25272,7 +25290,7 @@ static int ecc_test_curve(WC_RNG* rng, int keySize)
#ifdef HAVE_ECC_VECTOR_TEST
ret = ecc_test_vector(keySize);
if (ret < 0) {
- printf("ecc_test_vector %d failed!: %d\n", keySize, ret);
+ printf("ecc_test_vector %d failed!\n", keySize);
return ret;
}
#endif
@@ -25285,7 +25303,7 @@ static int ecc_test_curve(WC_RNG* rng, int keySize)
/* ignore error for curves not found */
}
else {
- printf("ecc_test_key_decode %d failed!: %d\n", keySize, ret);
+ printf("ecc_test_key_decode %d failed!\n", keySize);
return ret;
}
}
@@ -25298,7 +25316,7 @@ static int ecc_test_curve(WC_RNG* rng, int keySize)
/* ignore error for curves not found */
}
else {
- printf("ecc_test_key_gen %d failed!: %d\n", keySize, ret);
+ printf("ecc_test_key_gen %d failed!\n", keySize);
return ret;
}
}
@@ -25311,9 +25329,9 @@ static int ecc_test_curve(WC_RNG* rng, int keySize)
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT) && \
!defined(WOLFSSL_NO_MALLOC) && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_point_test(void)
+static wc_test_ret_t ecc_point_test(void)
{
- int ret;
+ wc_test_ret_t ret;
ecc_point* point;
ecc_point* point2;
#ifdef HAVE_COMP_KEY
@@ -25554,9 +25572,9 @@ static int ecc_point_test(void)
#endif /* !WOLFSSL_ATECC508A && HAVE_ECC_KEY_IMPORT && HAVE_ECC_KEY_EXPORT */
#if !defined(NO_SIG_WRAPPER) && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_sig_test(WC_RNG* rng, ecc_key* key)
+static wc_test_ret_t ecc_sig_test(WC_RNG* rng, ecc_key* key)
{
- int ret;
+ wc_test_ret_t ret;
word32 sigSz;
int size;
byte out[ECC_MAX_SIG_SIZE];
@@ -25608,9 +25626,9 @@ static int ecc_sig_test(WC_RNG* rng, ecc_key* key)
#if defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT) && \
!defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_exp_imp_test(ecc_key* key)
+static wc_test_ret_t ecc_exp_imp_test(ecc_key* key)
{
- int ret;
+ wc_test_ret_t ret;
int curve_id;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *keyImp = (ecc_key *)XMALLOC(sizeof *keyImp, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -25738,9 +25756,9 @@ static int ecc_exp_imp_test(ecc_key* key)
#if defined(HAVE_ECC_KEY_IMPORT) && !defined(WOLFSSL_VALIDATE_ECC_IMPORT) && \
!defined(WOLFSSL_CRYPTOCELL) && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_mulmod_test(ecc_key* key1)
+static wc_test_ret_t ecc_mulmod_test(ecc_key* key1)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *key2 = (ecc_key *)XMALLOC(sizeof *key2, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
ecc_key *key3 = (ecc_key *)XMALLOC(sizeof *key3, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -25804,9 +25822,9 @@ static int ecc_mulmod_test(ecc_key* key1)
#if defined(HAVE_ECC_DHE) && !defined(WC_NO_RNG) && \
!defined(WOLF_CRYPTO_CB_ONLY_ECC)
-static int ecc_ssh_test(ecc_key* key, WC_RNG* rng)
+static wc_test_ret_t ecc_ssh_test(ecc_key* key, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
byte out[128];
word32 outLen = sizeof(out);
@@ -25851,9 +25869,9 @@ static int ecc_ssh_test(ecc_key* key, WC_RNG* rng)
}
#endif /* HAVE_ECC_DHE && !WC_NO_RNG */
-static int ecc_def_curve_test(WC_RNG *rng)
+static wc_test_ret_t ecc_def_curve_test(WC_RNG *rng)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *key = (ecc_key *)XMALLOC(sizeof *key, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
#else
@@ -25969,9 +25987,9 @@ static int ecc_def_curve_test(WC_RNG *rng)
#if defined(WOLFSSL_CERT_EXT) && \
(!defined(NO_ECC256) || defined(HAVE_ALL_CURVES)) && ECC_MIN_KEY_SZ <= 256
-static int ecc_decode_test(void)
+static wc_test_ret_t ecc_decode_test(void)
{
- int ret;
+ wc_test_ret_t ret;
word32 inSz;
word32 inOutIdx;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -26176,9 +26194,9 @@ static const byte eccKeyExplicitCurve[] = {
0xac, 0xf0, 0x1d, 0x86, 0xf4, 0x2f, 0x65, 0x0b
};
-static int ecc_test_custom_curves(WC_RNG* rng)
+static wc_test_ret_t ecc_test_custom_curves(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
word32 inOutIdx;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *key = (ecc_key *)XMALLOC(sizeof *key, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -26232,7 +26250,7 @@ static int ecc_test_custom_curves(WC_RNG* rng)
ret = ecc_test_curve_size(rng, 0, ECC_TEST_VERIFY_COUNT, ECC_CURVE_DEF,
&ecc_dp_brainpool256r1);
if (ret != 0) {
- printf("ECC test for custom curve failed! %d\n", ret);
+ printf("ECC test for custom curve failed!\n");
goto done;
}
#endif
@@ -26248,7 +26266,7 @@ static int ecc_test_custom_curves(WC_RNG* rng)
/* Test and demonstrate use of non-SECP curve */
ret = ecc_test_curve_size(rng, 0, ECC_TEST_VERIFY_COUNT, curve_id, NULL);
if (ret < 0) {
- printf("ECC test for curve_id %d failed! %d\n", curve_id, ret);
+ printf("ECC test for curve_id %d failed!\n", curve_id);
goto done;
}
}
@@ -26286,9 +26304,9 @@ static int ecc_test_custom_curves(WC_RNG* rng)
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ECC_SECP) && !defined(NO_ASN_TIME)
/* Make Cert / Sign example for ECC cert and ECC CA */
-static int ecc_test_cert_gen(WC_RNG* rng)
+static wc_test_ret_t ecc_test_cert_gen(WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
Cert *myCert = (Cert *)XMALLOC(sizeof *myCert, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
#ifdef WOLFSSL_TEST_CERT
@@ -26468,7 +26486,7 @@ static int ecc_test_cert_gen(WC_RNG* rng)
} while (ret == WC_PENDING_E);
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit);
- certSz = ret;
+ certSz = (word32)ret;
TEST_SLEEP();
#ifdef WOLFSSL_TEST_CERT
@@ -26521,9 +26539,9 @@ static int ecc_test_cert_gen(WC_RNG* rng)
!defined(WOLFSSL_NO_MALLOC) && !defined(WOLF_CRYPTO_CB_ONLY_ECC) && \
(!defined(NO_ECC_SECP) || defined(WOLFSSL_CUSTOM_CURVES))
/* Test for the wc_ecc_key_new() and wc_ecc_key_free() functions. */
-static int ecc_test_allocator(WC_RNG* rng)
+static wc_test_ret_t ecc_test_allocator(WC_RNG* rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
ecc_key* key;
#ifdef WC_NO_RNG
word32 idx = 0;
@@ -26657,11 +26675,12 @@ static const byte p521PubKey[] = {
/* perform verify of signature and hash using public key */
/* key is public Qx + public Qy */
/* sig is r + s */
-static int crypto_ecc_verify(const byte *key, uint32_t keySz,
+static wc_test_ret_t crypto_ecc_verify(const byte *key, uint32_t keySz,
const byte *hash, uint32_t hashSz, const byte *sig, uint32_t sigSz,
uint32_t curveSz, int curveId)
{
- int ret, verify_res = 0, count = 0;
+ wc_test_ret_t ret;
+ int verify_res = 0, count = 0;
mp_int r, s;
ecc_key ecc;
ecc_nb_ctx_t nb_ctx;
@@ -26758,11 +26777,12 @@ static int crypto_ecc_verify(const byte *key, uint32_t keySz,
}
/* perform signature operation against hash using private key */
-static int crypto_ecc_sign(const byte *key, uint32_t keySz,
+static wc_test_ret_t crypto_ecc_sign(const byte *key, uint32_t keySz,
const byte *hash, uint32_t hashSz, byte *sig, uint32_t* sigSz,
uint32_t curveSz, int curveId, WC_RNG* rng)
{
- int ret, count = 0;
+ wc_test_ret_t ret;
+ int count = 0;
mp_int r, s;
ecc_key ecc;
ecc_nb_ctx_t nb_ctx;
@@ -26853,10 +26873,10 @@ static int crypto_ecc_sign(const byte *key, uint32_t keySz,
* don't have non-blocking versions of the key checking functions, yet.
*/
#if defined(HAVE_ECC_DHE) && !defined(WOLFSSL_VALIDATE_ECC_KEYGEN)
-static int ecc_test_nonblock_dhe(int curveId, word32 curveSz,
+static wc_test_ret_t ecc_test_nonblock_dhe(int curveId, word32 curveSz,
const byte* privKey, const byte* pubKey, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
ecc_key keyA;
ecc_key keyB;
ecc_nb_ctx_t nbCtxA;
@@ -26939,11 +26959,11 @@ static int ecc_test_nonblock_dhe(int curveId, word32 curveSz,
#endif /* HAVE_ECC_DHE && !WOLFSSL_VALIDATE_ECC_KEYGEN */
#if defined(HAVE_ECC_SIGN) && defined(HAVE_ECC_VERIFY)
-static int ecc_test_nonblock_ecdsa(int curveId, word32 curveSz,
+static wc_test_ret_t ecc_test_nonblock_ecdsa(int curveId, word32 curveSz,
const byte* privKey, word32 privKeySz, const byte* pubKey, word32 pubKeySz,
WC_RNG* rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* sig = NULL;
word32 sigSz = curveSz * 2;
static const byte hash[] = {
@@ -26978,9 +26998,9 @@ static int ecc_test_nonblock_ecdsa(int curveId, word32 curveSz,
}
#endif /* HAVE_ECC_SIGN && HAVE_ECC_VERIFY */
-static int ecc_test_nonblock(WC_RNG* rng)
+static wc_test_ret_t ecc_test_nonblock(WC_RNG* rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
word32 i;
int curveIds[3] = {0, 0, 0};
word32 curveSzs[3] = {0, 0, 0};
@@ -27034,9 +27054,9 @@ static int ecc_test_nonblock(WC_RNG* rng)
}
#endif /* WC_ECC_NONBLOCK && WOLFSSL_HAVE_SP_ECC && WOLFSSL_PUBLIC_MP */
-WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test(void)
{
- int ret;
+ wc_test_ret_t ret;
WC_RNG rng;
#if defined(WOLFSSL_CERT_EXT) && \
@@ -27152,7 +27172,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
#ifdef HAVE_ECC256
ret = ecc_test_deterministic_k(&rng);
if (ret != 0) {
- printf("ecc_test_deterministic_k failed! %d\n", ret);
+ printf("ecc_test_deterministic_k failed!\n");
goto done;
}
#endif
@@ -27160,14 +27180,14 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
#if defined(HAVE_ECC384)
ret = ecc384_test_deterministic_k(&rng);
if (ret != 0) {
- printf("ecc384_test_deterministic_k failed! %d\n", ret);
+ printf("ecc384_test_deterministic_k failed!\n");
goto done;
}
#endif
#if defined(HAVE_ECC521)
ret = ecc521_test_deterministic_k(&rng);
if (ret != 0) {
- printf("ecc512_test_deterministic_k failed! %d\n", ret);
+ printf("ecc512_test_deterministic_k failed!\n");
goto done;
}
#endif
@@ -27178,7 +27198,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
!defined(WOLFSSL_KCAPI_ECC)
ret = ecc_test_sign_vectors(&rng);
if (ret != 0) {
- printf("ecc_test_sign_vectors failed! %d\n", ret);
+ printf("ecc_test_sign_vectors failed!\n");
goto done;
}
#endif
@@ -27186,7 +27206,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
defined(HAVE_ECC_DHE)
ret = ecc_test_cdh_vectors(&rng);
if (ret != 0) {
- printf("ecc_test_cdh_vectors failed! %d\n", ret);
+ printf("ecc_test_cdh_vectors failed!\n");
goto done;
}
#endif
@@ -27195,7 +27215,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(NO_ECC_SECP)
ret = ecc_test_make_pub(&rng);
if (ret != 0) {
- printf("ecc_test_make_pub failed!: %d\n", ret);
+ printf("ecc_test_make_pub failed!\n");
goto done;
}
#elif defined(HAVE_ECC_KEY_IMPORT)
@@ -27204,7 +27224,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ECC_SECP) && !defined(NO_ASN_TIME)
ret = ecc_test_cert_gen(&rng);
if (ret != 0) {
- printf("ecc_test_cert_gen failed!: %d\n", ret);
+ printf("ecc_test_cert_gen failed!\n");
goto done;
}
#endif
@@ -27213,7 +27233,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
defined(WOLFSSL_CUSTOM_CURVES))
ret = ecc_test_allocator(&rng);
if (ret != 0) {
- printf("ecc_test_allocator failed!: %d\n", ret);
+ printf("ecc_test_allocator failed!\n");
goto done;
}
#endif
@@ -27222,7 +27242,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
defined(HAVE_ECC_SIGN) && defined(HAVE_ECC_VERIFY)
ret = ecc_test_nonblock(&rng);
if (ret != 0) {
- printf("ecc_test_nonblock failed!: %d\n", ret);
+ printf("ecc_test_nonblock failed!\n");
goto done;
}
#endif
@@ -27237,7 +27257,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
(defined(WOLFSSL_AES_128) || defined(WOLFSSL_AES_256))
#if ((! defined(HAVE_FIPS)) || FIPS_VERSION_GE(5,3))
-static int ecc_ctx_kdf_salt_test(WC_RNG* rng, ecc_key* a, ecc_key* b)
+static wc_test_ret_t ecc_ctx_kdf_salt_test(WC_RNG* rng, ecc_key* a, ecc_key* b)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
byte* plaintext;
@@ -27252,7 +27272,7 @@ static int ecc_ctx_kdf_salt_test(WC_RNG* rng, ecc_key* a, ecc_key* b)
ecEncCtx* bCtx = NULL;
static const byte salt[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15};
- int ret = 0;
+ wc_test_ret_t ret = 0;
static const char message[] = "Hello wolfSSL!";
word32 plaintextLen;
word32 encryptLen = 128;
@@ -27359,9 +27379,9 @@ static int ecc_ctx_kdf_salt_test(WC_RNG* rng, ecc_key* a, ecc_key* b)
#if (!defined(NO_ECC256) || defined(HAVE_ALL_CURVES)) && \
ECC_MIN_KEY_SZ <= 256 && defined(WOLFSSL_AES_128)
-static int ecc_encrypt_kat(WC_RNG *rng)
+static wc_test_ret_t ecc_encrypt_kat(WC_RNG *rng)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#ifdef WOLFSSL_ECIES_OLD
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key* userA = NULL;
@@ -27597,10 +27617,10 @@ static int ecc_encrypt_kat(WC_RNG *rng)
}
#endif
-static int ecc_encrypt_e2e_test(WC_RNG* rng, ecc_key* userA, ecc_key* userB,
+static wc_test_ret_t ecc_encrypt_e2e_test(WC_RNG* rng, ecc_key* userA, ecc_key* userB,
byte encAlgo, byte kdfAlgo, byte macAlgo)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte msg[48];
byte plain[48];
#ifdef WOLFSSL_ECIES_OLD
@@ -27868,10 +27888,10 @@ static int ecc_encrypt_e2e_test(WC_RNG* rng, ecc_key* userA, ecc_key* userB,
#endif /* !HAVE_FIPS || FIPS_VERSION_GE(5,3) */
-WOLFSSL_TEST_SUBROUTINE int ecc_encrypt_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_encrypt_test(void)
{
WC_RNG rng;
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
ecc_key *userA;
ecc_key *userB;
@@ -28013,7 +28033,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_encrypt_test(void)
!defined(WOLFSSL_ATECC608A) && !defined(NO_ECC256) && \
defined(HAVE_ECC_VERIFY) && defined(HAVE_ECC_SIGN) && \
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(NO_ECC_SECP)
-WOLFSSL_TEST_SUBROUTINE int ecc_test_buffers(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test_buffers(void)
{
size_t bytes;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -28027,7 +28047,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test_buffers(void)
#endif
WC_RNG rng;
word32 idx = 0;
- int ret;
+ wc_test_ret_t ret;
/* pad our test message to 32 bytes so evenly divisible by AES_BLOCK_SZ */
byte in[] = "Everyone gets Friday off. ecc p";
word32 inLen = (word32)XSTRLEN((char*)in);
@@ -28192,7 +28212,7 @@ TEST_SLEEP();
#else
#define X25519_TEST_CNT 1
#endif
-static int curve25519_overflow_test(void)
+static wc_test_ret_t curve25519_overflow_test(void)
{
/* secret key for party a */
byte sa[X25519_TEST_CNT][32] = {
@@ -28303,7 +28323,7 @@ static int curve25519_overflow_test(void)
#endif
};
- int ret = 0;
+ wc_test_ret_t ret = 0;
int i;
word32 y;
byte shared[32];
@@ -28338,9 +28358,9 @@ static int curve25519_overflow_test(void)
*
* returns 0 on success and -ve on failure.
*/
-static int curve25519_check_public_test(void)
+static wc_test_ret_t curve25519_check_public_test(void)
{
- int ret;
+ wc_test_ret_t ret;
/* Little-endian values that will fail */
byte fail_le[][CURVE25519_KEYSIZE] = {
{
@@ -28458,9 +28478,9 @@ static int curve25519_check_public_test(void)
#if !defined(NO_ASN) && defined(HAVE_CURVE25519_KEY_EXPORT) && \
defined(HAVE_CURVE25519_KEY_IMPORT)
-static int curve255519_der_test(void)
+static wc_test_ret_t curve255519_der_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
/* certs/statickeys/x25519.der */
const byte kCurve25519PrivDer[] = {
0x30, 0x2E, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x6E,
@@ -28496,7 +28516,7 @@ static int curve255519_der_test(void)
outputSz = (word32)sizeof(output);
ret = wc_Curve25519PrivateKeyToDer(&key, output, outputSz);
if (ret >= 0) {
- outputSz = ret;
+ outputSz = (word32)ret;
ret = 0;
}
else {
@@ -28520,7 +28540,7 @@ static int curve255519_der_test(void)
outputSz = (word32)sizeof(output);
ret = wc_Curve25519PublicKeyToDer(&key, output, outputSz, 1);
if (ret >= 0) {
- outputSz = ret;
+ outputSz = (word32)ret;
ret = 0;
}
else {
@@ -28538,10 +28558,10 @@ static int curve255519_der_test(void)
}
#endif /* !NO_ASN && HAVE_CURVE25519_KEY_EXPORT && HAVE_CURVE25519_KEY_IMPORT */
-WOLFSSL_TEST_SUBROUTINE int curve25519_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
{
WC_RNG rng;
- int ret;
+ wc_test_ret_t ret;
#ifdef HAVE_CURVE25519_SHARED_SECRET
byte sharedA[32];
byte sharedB[32];
@@ -28627,13 +28647,13 @@ WOLFSSL_TEST_SUBROUTINE int curve25519_test(void)
/* find shared secret key */
x = sizeof(sharedA);
if ((ret = wc_curve25519_shared_secret(&userA, &userB, sharedA, &x)) != 0) {
- printf("wc_curve25519_shared_secret 1 %d\n", ret);
+ printf("wc_curve25519_shared_secret 1 failed\n");
return WC_TEST_RET_ENC_EC(ret);
}
y = sizeof(sharedB);
if ((ret = wc_curve25519_shared_secret(&userB, &userA, sharedB, &y)) != 0) {
- printf("wc_curve25519_shared_secret 2 %d\n", ret);
+ printf("wc_curve25519_shared_secret 2 failed\n");
return WC_TEST_RET_ENC_EC(ret);
}
@@ -28761,7 +28781,7 @@ WOLFSSL_TEST_SUBROUTINE int curve25519_test(void)
#ifdef HAVE_ED25519
#ifdef WOLFSSL_TEST_CERT
-static int ed25519_test_cert(void)
+static wc_test_ret_t ed25519_test_cert(void)
{
DecodedCert cert[2];
DecodedCert* serverCert = NULL;
@@ -28771,7 +28791,7 @@ static int ed25519_test_cert(void)
ed25519_key* pubKey = NULL;
int verify;
#endif /* HAVE_ED25519_VERIFY */
- int ret;
+ wc_test_ret_t ret;
byte* tmp;
size_t bytes;
XFILE file;
@@ -28859,14 +28879,14 @@ static int ed25519_test_cert(void)
return ret;
}
-static int ed25519_test_make_cert(void)
+static wc_test_ret_t ed25519_test_make_cert(void)
{
WC_RNG rng;
Cert cert;
DecodedCert decode;
ed25519_key key;
ed25519_key* privKey = NULL;
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* tmp = NULL;
wc_InitCert_ex(&cert, HEAP_HINT, devId);
@@ -28913,7 +28933,7 @@ static int ed25519_test_make_cert(void)
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
- InitDecodedCert(&decode, tmp, ret, HEAP_HINT);
+ InitDecodedCert(&decode, tmp, (word32)ret, HEAP_HINT);
ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
FreeDecodedCert(&decode);
if (ret != 0)
@@ -28930,9 +28950,9 @@ static int ed25519_test_make_cert(void)
#if defined(HAVE_ED25519_SIGN) && defined(HAVE_ED25519_KEY_EXPORT) && \
defined(HAVE_ED25519_KEY_IMPORT)
-static int ed25519ctx_test(void)
+static wc_test_ret_t ed25519ctx_test(void)
{
- int ret;
+ wc_test_ret_t ret;
byte out[ED25519_SIG_SIZE];
word32 outlen;
#ifdef HAVE_ED25519_VERIFY
@@ -29030,9 +29050,9 @@ static int ed25519ctx_test(void)
return ret;
}
-static int ed25519ph_test(void)
+static wc_test_ret_t ed25519ph_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte out[ED25519_SIG_SIZE];
word32 outlen;
#ifdef HAVE_ED25519_VERIFY
@@ -29172,9 +29192,9 @@ static int ed25519ph_test(void)
}
#endif /* HAVE_ED25519_SIGN && HAVE_ED25519_KEY_EXPORT && HAVE_ED25519_KEY_IMPORT */
-WOLFSSL_TEST_SUBROUTINE int ed25519_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ed25519_test(void)
{
- int ret;
+ wc_test_ret_t ret;
WC_RNG rng;
#if defined(HAVE_ED25519_SIGN) && defined(HAVE_ED25519_KEY_EXPORT) &&\
defined(HAVE_ED25519_KEY_IMPORT)
@@ -29780,7 +29800,7 @@ WOLFSSL_TEST_SUBROUTINE int ed25519_test(void)
*
* returns 0 on success and -ve on failure.
*/
-static int curve448_check_public_test(void)
+static wc_test_ret_t curve448_check_public_test(void)
{
/* Little-endian values that will fail */
byte fail_le[][CURVE448_KEY_SIZE] = {
@@ -29835,7 +29855,7 @@ static int curve448_check_public_test(void)
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01
};
int i;
- int ret;
+ wc_test_ret_t ret;
/* Parameter checks */
/* NULL pointer */
@@ -29896,10 +29916,10 @@ static int curve448_check_public_test(void)
#endif /* HAVE_CURVE448_SHARED_SECRET && HAVE_CURVE448_KEY_IMPORT */
-WOLFSSL_TEST_SUBROUTINE int curve448_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve448_test(void)
{
WC_RNG rng;
- int ret;
+ wc_test_ret_t ret;
#ifdef HAVE_CURVE448_SHARED_SECRET
byte sharedA[CURVE448_KEY_SIZE];
byte sharedB[CURVE448_KEY_SIZE];
@@ -30115,7 +30135,7 @@ WOLFSSL_TEST_SUBROUTINE int curve448_test(void)
#ifdef HAVE_ED448
#ifdef WOLFSSL_TEST_CERT
-static int ed448_test_cert(void)
+static wc_test_ret_t ed448_test_cert(void)
{
DecodedCert cert[2];
DecodedCert* serverCert = NULL;
@@ -30125,7 +30145,7 @@ static int ed448_test_cert(void)
ed448_key* pubKey = NULL;
int verify;
#endif /* HAVE_ED448_VERIFY */
- int ret;
+ wc_test_ret_t ret;
byte* tmp;
size_t bytes;
XFILE file;
@@ -30213,14 +30233,14 @@ static int ed448_test_cert(void)
return ret;
}
-static int ed448_test_make_cert(void)
+static wc_test_ret_t ed448_test_make_cert(void)
{
WC_RNG rng;
Cert cert;
DecodedCert decode;
ed448_key key;
ed448_key* privKey = NULL;
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* tmp = NULL;
wc_InitCert_ex(&cert, HEAP_HINT, devId);
@@ -30267,7 +30287,7 @@ static int ed448_test_make_cert(void)
if (ret < 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
- InitDecodedCert(&decode, tmp, ret, HEAP_HINT);
+ InitDecodedCert(&decode, tmp, (word32)ret, HEAP_HINT);
ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
FreeDecodedCert(&decode);
if (ret != 0)
@@ -30284,9 +30304,9 @@ static int ed448_test_make_cert(void)
#if defined(HAVE_ED448_SIGN) && defined(HAVE_ED448_KEY_EXPORT) && \
defined(HAVE_ED448_KEY_IMPORT)
-static int ed448_ctx_test(void)
+static wc_test_ret_t ed448_ctx_test(void)
{
- int ret;
+ wc_test_ret_t ret;
byte out[ED448_SIG_SIZE];
word32 outlen;
#ifdef HAVE_ED448_VERIFY
@@ -30375,9 +30395,9 @@ static int ed448_ctx_test(void)
return 0;
}
-static int ed448ph_test(void)
+static wc_test_ret_t ed448ph_test(void)
{
- int ret;
+ wc_test_ret_t ret;
byte out[ED448_SIG_SIZE];
word32 outlen;
#ifdef HAVE_ED448_VERIFY
@@ -30547,9 +30567,9 @@ static int ed448ph_test(void)
}
#endif /* HAVE_ED448_SIGN && HAVE_ED448_KEY_EXPORT && HAVE_ED448_KEY_IMPORT */
-WOLFSSL_TEST_SUBROUTINE int ed448_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ed448_test(void)
{
- int ret;
+ wc_test_ret_t ret;
WC_RNG rng;
#if defined(HAVE_ED448_SIGN) && defined(HAVE_ED448_KEY_EXPORT) &&\
defined(HAVE_ED448_KEY_IMPORT)
@@ -31297,10 +31317,10 @@ WOLFSSL_TEST_SUBROUTINE int ed448_test(void)
#ifdef WOLFSSL_HAVE_KYBER
#ifdef WOLFSSL_WC_KYBER /* OQS and PQM4 do not support KATs */
#ifdef WOLFSSL_KYBER512
-static int kyber512_kat(void)
+static wc_test_ret_t kyber512_kat(void)
{
KyberKey key;
- int ret;
+ wc_test_ret_t ret;
byte priv[KYBER512_PRIVATE_KEY_SIZE];
byte pub[KYBER512_PUBLIC_KEY_SIZE];
byte ct[KYBER512_CIPHER_TEXT_SIZE];
@@ -31783,10 +31803,10 @@ static int kyber512_kat(void)
#endif /* WOLFSSL_KYBER512 */
#ifdef WOLFSSL_KYBER768
-static int kyber768_kat(void)
+static wc_test_ret_t kyber768_kat(void)
{
KyberKey key;
- int ret;
+ wc_test_ret_t ret;
byte priv[KYBER768_PRIVATE_KEY_SIZE];
byte pub[KYBER768_PUBLIC_KEY_SIZE];
byte ct[KYBER768_CIPHER_TEXT_SIZE];
@@ -32454,10 +32474,10 @@ static int kyber768_kat(void)
#endif /* WOLFSSL_KYBER768 */
#ifdef WOLFSSL_KYBER1024
-static int kyber1024_kat(void)
+static wc_test_ret_t kyber1024_kat(void)
{
KyberKey key;
- int ret;
+ wc_test_ret_t ret;
byte priv[KYBER1024_PRIVATE_KEY_SIZE];
byte pub[KYBER1024_PUBLIC_KEY_SIZE];
byte ct[KYBER1024_CIPHER_TEXT_SIZE];
@@ -33328,9 +33348,9 @@ static int kyber1024_kat(void)
#endif /* WOLFSSL_KYBER1024 */
#endif /* WOLFSSL_WC_KYBER */
-WOLFSSL_TEST_SUBROUTINE int kyber_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t kyber_test(void)
{
- int ret;
+ wc_test_ret_t ret;
KyberKey key;
WC_RNG rng;
int i;
@@ -33454,10 +33474,10 @@ static const int fiducial3 = WC_TEST_RET_LN; /* source code reference point --
*/
#ifdef WOLFCRYPT_HAVE_ECCSI
-static int eccsi_api_test(WC_RNG* rng, EccsiKey* key, mp_int* ssk,
+static wc_test_ret_t eccsi_api_test(WC_RNG* rng, EccsiKey* key, mp_int* ssk,
ecc_point* pvt)
{
- int ret;
+ wc_test_ret_t ret;
byte id[1] = { 0x00 };
int valid;
word32 sz;
@@ -33873,9 +33893,9 @@ static int eccsi_api_test(WC_RNG* rng, EccsiKey* key, mp_int* ssk,
}
/* RFC 6507: Appendix A */
-static int eccsi_kat_verify_test(EccsiKey* key, ecc_point* pvt)
+static wc_test_ret_t eccsi_kat_verify_test(EccsiKey* key, ecc_point* pvt)
{
- int ret;
+ wc_test_ret_t ret;
int verified;
const byte msg[] = { 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x00 };
word32 msgSz = sizeof(msg);
@@ -33955,9 +33975,9 @@ static int eccsi_kat_verify_test(EccsiKey* key, ecc_point* pvt)
return 0;
}
-static int eccsi_enc_dec_pair_test(EccsiKey* priv, mp_int* ssk, ecc_point* pvt)
+static wc_test_ret_t eccsi_enc_dec_pair_test(EccsiKey* priv, mp_int* ssk, ecc_point* pvt)
{
- int ret;
+ wc_test_ret_t ret;
byte data[32 * 3];
word32 sz;
ecc_point* decPvt = NULL;
@@ -34056,9 +34076,9 @@ static int eccsi_enc_dec_pair_test(EccsiKey* priv, mp_int* ssk, ecc_point* pvt)
return ret;
}
-static int eccsi_imp_exp_key_test(EccsiKey* priv)
+static wc_test_ret_t eccsi_imp_exp_key_test(EccsiKey* priv)
{
- int ret;
+ wc_test_ret_t ret;
byte data[32 * 3];
byte out[32 * 3];
word32 sz;
@@ -34114,9 +34134,9 @@ static int eccsi_imp_exp_key_test(EccsiKey* priv)
return 0;
}
-static int eccsi_imp_exp_pubkey_test(EccsiKey* key1, EccsiKey* key2)
+static wc_test_ret_t eccsi_imp_exp_pubkey_test(EccsiKey* key1, EccsiKey* key2)
{
- int ret;
+ wc_test_ret_t ret;
byte data[32 * 2 + 1];
byte pubData[32 * 2 + 1];
word32 sz;
@@ -34160,10 +34180,10 @@ static int eccsi_imp_exp_pubkey_test(EccsiKey* key1, EccsiKey* key2)
return 0;
}
-static int eccsi_make_key_test(EccsiKey* priv, EccsiKey* pub, WC_RNG* rng,
+static wc_test_ret_t eccsi_make_key_test(EccsiKey* priv, EccsiKey* pub, WC_RNG* rng,
mp_int* ssk, ecc_point* pvt)
{
- int ret;
+ wc_test_ret_t ret;
char mail[] = "test@wolfssl.com";
byte* id = (byte*)mail;
word32 idSz = (word32) XSTRLEN(mail);
@@ -34199,10 +34219,10 @@ static int eccsi_make_key_test(EccsiKey* priv, EccsiKey* pub, WC_RNG* rng,
return 0;
}
-static int eccsi_sign_verify_test(EccsiKey* priv, EccsiKey* pub, WC_RNG* rng,
+static wc_test_ret_t eccsi_sign_verify_test(EccsiKey* priv, EccsiKey* pub, WC_RNG* rng,
mp_int* ssk, ecc_point* pvt)
{
- int ret;
+ wc_test_ret_t ret;
byte hashPriv[WC_MAX_DIGEST_SIZE];
byte hashPub[WC_MAX_DIGEST_SIZE];
byte hashSz;
@@ -34354,9 +34374,9 @@ static int eccsi_sign_verify_test(EccsiKey* priv, EccsiKey* pub, WC_RNG* rng,
return 0;
}
-int eccsi_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t eccsi_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
WC_RNG rng;
int rng_inited = 0;
EccsiKey* priv = NULL;
@@ -34463,9 +34483,9 @@ int eccsi_test(void)
#endif /* WOLFCRYPT_HAVE_ECCSI */
#ifdef WOLFCRYPT_HAVE_SAKKE
-static int sakke_api_test(WC_RNG* rng, SakkeKey* key, ecc_point* rsk)
+static wc_test_ret_t sakke_api_test(WC_RNG* rng, SakkeKey* key, ecc_point* rsk)
{
- int ret;
+ wc_test_ret_t ret;
byte id[1] = { 0x00 };
int valid;
byte data[256];
@@ -34899,7 +34919,7 @@ static int sakke_api_test(WC_RNG* rng, SakkeKey* key, ecc_point* rsk)
return 0;
}
-static int sakke_kat_derive_test(SakkeKey* key, ecc_point* rsk)
+static wc_test_ret_t sakke_kat_derive_test(SakkeKey* key, ecc_point* rsk)
{
WOLFSSL_SMALL_STACK_STATIC const byte pubData[] = {
0x59, 0x58, 0xEF, 0x1B, 0x16, 0x79, 0xBF, 0x09,
@@ -35019,7 +35039,7 @@ static int sakke_kat_derive_test(SakkeKey* key, ecc_point* rsk)
0x89, 0xE0, 0xBC, 0x66, 0x1A, 0xA1, 0xE9, 0x16,
0x38, 0xE6, 0xAC, 0xC8, 0x4E, 0x49, 0x65, 0x07
};
- int ret;
+ wc_test_ret_t ret;
int valid;
byte pubKey[sizeof(pubData) + 1];
word32 sz = sizeof(pubKey);
@@ -35133,7 +35153,7 @@ static int sakke_kat_derive_test(SakkeKey* key, ecc_point* rsk)
return 0;
}
-static int sakke_kat_encapsulate_test(SakkeKey* key)
+static wc_test_ret_t sakke_kat_encapsulate_test(SakkeKey* key)
{
static const byte pubData[] = {
0x59, 0x58, 0xEF, 0x1B, 0x16, 0x79, 0xBF, 0x09,
@@ -35220,7 +35240,7 @@ static int sakke_kat_encapsulate_test(SakkeKey* key)
0x89, 0xE0, 0xBC, 0x66, 0x1A, 0xA1, 0xE9, 0x16,
0x38, 0xE6, 0xAC, 0xC8, 0x4E, 0x49, 0x65, 0x07
};
- int ret;
+ wc_test_ret_t ret;
byte auth[257];
word16 authSz = sizeof(auth);
@@ -35247,10 +35267,10 @@ static int sakke_kat_encapsulate_test(SakkeKey* key)
return 0;
}
-static int sakke_make_key_test(SakkeKey* priv, SakkeKey* pub, SakkeKey* key,
+static wc_test_ret_t sakke_make_key_test(SakkeKey* priv, SakkeKey* pub, SakkeKey* key,
WC_RNG* rng, ecc_point* rsk)
{
- int ret;
+ wc_test_ret_t ret;
byte data[440];
byte pubData[257];
word32 sz;
@@ -35393,10 +35413,10 @@ static int sakke_make_key_test(SakkeKey* priv, SakkeKey* pub, SakkeKey* key,
return 0;
}
-static int sakke_op_test(SakkeKey* priv, SakkeKey* pub, WC_RNG* rng,
+static wc_test_ret_t sakke_op_test(SakkeKey* priv, SakkeKey* pub, WC_RNG* rng,
ecc_point* rsk)
{
- int ret;
+ wc_test_ret_t ret;
byte ssv[16];
word16 ssvSz;
byte auth[257];
@@ -35509,9 +35529,9 @@ static int sakke_op_test(SakkeKey* priv, SakkeKey* pub, WC_RNG* rng,
return 0;
}
-int sakke_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sakke_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
WC_RNG rng;
int rng_inited = 0;
SakkeKey* priv = NULL;
@@ -35629,7 +35649,7 @@ typedef struct CMAC_Test_Case {
word32 tSz;
} CMAC_Test_Case;
-WOLFSSL_TEST_SUBROUTINE int cmac_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cmac_test(void)
{
#ifdef WOLFSSL_AES_128
WOLFSSL_SMALL_STACK_STATIC const byte k128[] =
@@ -35781,7 +35801,7 @@ WOLFSSL_TEST_SUBROUTINE int cmac_test(void)
byte tag[AES_BLOCK_SIZE];
const CMAC_Test_Case* tc;
word32 i, tagSz;
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
if ((cmac = (Cmac *)XMALLOC(sizeof *cmac, HEAP_HINT, DYNAMIC_TYPE_CMAC)) == NULL)
@@ -36072,9 +36092,9 @@ static const unsigned char siphash_r16[64][SIPHASH_MAC_SIZE_16] = {
};
#endif
-WOLFSSL_TEST_SUBROUTINE int siphash_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t siphash_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int i;
#if WOLFSSL_SIPHASH_CROUNDS == 2 && WOLFSSL_SIPHASH_DROUNDS == 4
unsigned char res[SIPHASH_MAC_SIZE_16];
@@ -36432,9 +36452,9 @@ static const byte sample_text_gz[] = {
0x6F, 0x86, 0x43, 0x51, 0xB6, 0x11, 0x00, 0x00
};
-WOLFSSL_TEST_SUBROUTINE int compress_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t compress_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
word32 dSz = sizeof(sample_text);
word32 cSz = (dSz + (word32)(dSz * 0.001) + 12);
byte *c;
@@ -36542,7 +36562,7 @@ WOLFSSL_TEST_SUBROUTINE int compress_test(void)
*
* Returns 0 on success, negative on error
*/
-static int pkcs7_load_certs_keys(
+static wc_test_ret_t pkcs7_load_certs_keys(
byte* rsaClientCertBuf, word32* rsaClientCertBufSz,
byte* rsaClientPrivKeyBuf, word32* rsaClientPrivKeyBufSz,
byte* rsaServerCertBuf, word32* rsaServerCertBufSz,
@@ -36941,7 +36961,8 @@ static int myDecryptionFunc(PKCS7* pkcs7, int encryptOID, byte* iv, int ivSz,
byte* aad, word32 aadSz, byte* authTag, word32 authTagSz,
byte* in, int inSz, byte* out, void* usrCtx)
{
- int keyId = -1, ret, keySz;
+ wc_test_ret_t ret;
+ int keyId = -1, keySz;
word32 keyIdSz = 8;
const byte* key;
byte keyIdRaw[8];
@@ -37067,19 +37088,20 @@ static int myDecryptionFunc(PKCS7* pkcs7, int encryptOID, byte* iv, int ivSz,
(void)aadSz;
(void)authTag;
(void)authTagSz;
- return ret;
+ return (int)ret;
}
#endif /* !NO_AES && HAVE_AES_CBC */
#define PKCS7_BUF_SIZE 2048
-static int pkcs7enveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
+static wc_test_ret_t pkcs7enveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
byte* rsaPrivKey, word32 rsaPrivKeySz,
byte* eccCert, word32 eccCertSz,
byte* eccPrivKey, word32 eccPrivKeySz)
{
- int ret = 0, testSz = 0, i;
+ wc_test_ret_t ret = 0;
+ int testSz = 0, i;
int envelopedSz, decodedSz;
byte *enveloped = NULL;
@@ -37548,9 +37570,9 @@ static int pkcs7enveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
}
-WOLFSSL_TEST_SUBROUTINE int pkcs7enveloped_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7enveloped_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* rsaCert = NULL;
byte* rsaPrivKey = NULL;
@@ -37692,12 +37714,13 @@ typedef struct {
} pkcs7AuthEnvelopedVector;
-static int pkcs7authenveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
+static wc_test_ret_t pkcs7authenveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
byte* rsaPrivKey, word32 rsaPrivKeySz,
byte* eccCert, word32 eccCertSz,
byte* eccPrivKey, word32 eccPrivKeySz)
{
- int ret = 0, testSz = 0, i;
+ wc_test_ret_t ret = 0;
+ int testSz = 0, i;
int envelopedSz, decodedSz;
byte *enveloped = NULL;
@@ -38248,9 +38271,9 @@ static int pkcs7authenveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
return ret;
}
-WOLFSSL_TEST_SUBROUTINE int pkcs7authenveloped_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7authenveloped_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* rsaCert = NULL;
byte* rsaPrivKey = NULL;
@@ -38355,7 +38378,7 @@ static int myCEKwrapFunc(PKCS7* pkcs7, byte* cek, word32 cekSz, byte* keyId,
word32 keyIdSz, byte* orginKey, word32 orginKeySz,
byte* out, word32 outSz, int keyWrapAlgo, int type, int direction)
{
- int ret;
+ wc_test_ret_t ret;
if (cek == NULL || out == NULL)
return BAD_FUNC_ARG;
@@ -38378,7 +38401,7 @@ static int myCEKwrapFunc(PKCS7* pkcs7, byte* cek, word32 cekSz, byte* keyId,
ret = wc_AesKeyUnWrap(p7DefKey, sizeof(p7DefKey), cek, cekSz,
out, outSz, NULL);
if (ret <= 0)
- return ret;
+ return (int)ret;
break;
default:
@@ -38390,14 +38413,14 @@ static int myCEKwrapFunc(PKCS7* pkcs7, byte* cek, word32 cekSz, byte* keyId,
(void)direction;
(void)orginKey; /* used with KAKRI */
(void)orginKeySz;
- return ret;
+ return (int)ret;
}
/* returns key size on success */
-static int getFirmwareKey(PKCS7* pkcs7, byte* key, word32 keySz)
+static wc_test_ret_t getFirmwareKey(PKCS7* pkcs7, byte* key, word32 keySz)
{
- int ret;
+ wc_test_ret_t ret;
word32 atrSz;
byte atr[256];
@@ -38450,10 +38473,10 @@ static int getFirmwareKey(PKCS7* pkcs7, byte* key, word32 keySz)
/* create a KEKRI enveloped data
* return size on success */
-static int envelopedData_encrypt(byte* in, word32 inSz, byte* out,
+static wc_test_ret_t envelopedData_encrypt(byte* in, word32 inSz, byte* out,
word32 outSz)
{
- int ret;
+ wc_test_ret_t ret;
PKCS7* pkcs7;
WOLFSSL_SMALL_STACK_STATIC const byte keyId[] = { 0x00 };
@@ -38473,7 +38496,7 @@ static int envelopedData_encrypt(byte* in, word32 inSz, byte* out,
sizeof(p7DefKey), (byte*)keyId,
sizeof(keyId), NULL, NULL, 0, NULL, 0, 0);
if (ret < 0) {
- printf("wc_PKCS7_AddRecipient_KEKRI() failed, ret = %d\n", ret);
+ printf("wc_PKCS7_AddRecipient_KEKRI() failed\n");
wc_PKCS7_Free(pkcs7);
return WC_TEST_RET_ENC_EC(ret);
}
@@ -38481,7 +38504,7 @@ static int envelopedData_encrypt(byte* in, word32 inSz, byte* out,
/* encode envelopedData, returns size */
ret = wc_PKCS7_EncodeEnvelopedData(pkcs7, out, outSz);
if (ret <= 0) {
- printf("wc_PKCS7_EncodeEnvelopedData() failed, ret = %d\n", ret);
+ printf("wc_PKCS7_EncodeEnvelopedData() failed\n");
wc_PKCS7_Free(pkcs7);
return WC_TEST_RET_ENC_EC(ret);
@@ -38497,11 +38520,12 @@ static int envelopedData_encrypt(byte* in, word32 inSz, byte* out,
* keyHint is the KeyID to be set in the fwDecryptKeyID attribute
* returns size of buffer output on success
*/
-static int generateBundle(byte* out, word32 *outSz, const byte* encryptKey,
+static wc_test_ret_t generateBundle(byte* out, word32 *outSz, const byte* encryptKey,
word32 encryptKeySz, byte keyHint, byte* cert, word32 certSz,
byte* key, word32 keySz)
{
- int ret, attribNum = 1;
+ wc_test_ret_t ret;
+ int attribNum = 1;
PKCS7* pkcs7;
/* KEY ID
@@ -38538,7 +38562,7 @@ static int generateBundle(byte* out, word32 *outSz, const byte* encryptKey,
if (ret <= 0) {
return ret;
}
- attribs[1].valueSz = ret;
+ attribs[1].valueSz = (int)ret;
attribNum++;
}
@@ -38580,7 +38604,7 @@ static int generateBundle(byte* out, word32 *outSz, const byte* encryptKey,
return WC_TEST_RET_ENC_EC(ret);
} else {
- *outSz = ret;
+ *outSz = (int)ret;
}
wc_PKCS7_Free(pkcs7);
@@ -38592,9 +38616,9 @@ static int generateBundle(byte* out, word32 *outSz, const byte* encryptKey,
/* test verification and decryption of PKCS7 bundle
* return 0 on success
*/
-static int verifyBundle(byte* derBuf, word32 derSz, int keyHint)
+static wc_test_ret_t verifyBundle(byte* derBuf, word32 derSz, int keyHint)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int usrCtx = 1; /* test value to pass as user context to callback */
PKCS7* pkcs7 = NULL;
byte* sid = NULL;
@@ -38680,7 +38704,7 @@ static int verifyBundle(byte* derBuf, word32 derSz, int keyHint)
if (ret < 0)
goto out;
pkcs7->encryptionKey = key;
- pkcs7->encryptionKeySz = ret;
+ pkcs7->encryptionKeySz = (int)ret;
}
else {
decodedSz = PKCS7_BUF_SIZE;
@@ -38715,10 +38739,10 @@ static int verifyBundle(byte* derBuf, word32 derSz, int keyHint)
}
-WOLFSSL_TEST_SUBROUTINE int pkcs7callback_test(byte* cert, word32 certSz, byte* key, word32 keySz)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7callback_test(byte* cert, word32 certSz, byte* key, word32 keySz)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
word32 derSz;
byte *derBuf = (byte *)XMALLOC(FOURK_BUF, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -38787,9 +38811,9 @@ typedef struct {
} pkcs7EncryptedVector;
-WOLFSSL_TEST_SUBROUTINE int pkcs7encrypted_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7encrypted_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int i, testSz;
int encryptedSz, decodedSz, attribIdx;
PKCS7* pkcs7;
@@ -39055,9 +39079,9 @@ typedef struct {
} pkcs7CompressedVector;
-WOLFSSL_TEST_SUBROUTINE int pkcs7compressed_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7compressed_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int i, testSz;
int compressedSz, decodedSz;
PKCS7* pkcs7;
@@ -39201,7 +39225,7 @@ typedef struct {
} pkcs7SignedVector;
-static int pkcs7signed_run_vectors(
+static wc_test_ret_t pkcs7signed_run_vectors(
byte* rsaClientCertBuf, word32 rsaClientCertBufSz,
byte* rsaClientPrivKeyBuf, word32 rsaClientPrivKeyBufSz,
byte* rsaServerCertBuf, word32 rsaServerCertBufSz,
@@ -39211,7 +39235,8 @@ static int pkcs7signed_run_vectors(
byte* eccClientCertBuf, word32 eccClientCertBufSz,
byte* eccClientPrivKeyBuf, word32 eccClientPrivKeyBufSz)
{
- int ret, testSz = 0, i;
+ wc_test_ret_t ret;
+ int testSz = 0, i;
int encodedSz;
byte* out = NULL;
word32 outSz;
@@ -39712,7 +39737,7 @@ static int pkcs7signed_run_vectors(
}
-static int pkcs7signed_run_SingleShotVectors(
+static wc_test_ret_t pkcs7signed_run_SingleShotVectors(
byte* rsaClientCertBuf, word32 rsaClientCertBufSz,
byte* rsaClientPrivKeyBuf, word32 rsaClientPrivKeyBufSz,
byte* rsaServerCertBuf, word32 rsaServerCertBufSz,
@@ -39722,7 +39747,8 @@ static int pkcs7signed_run_SingleShotVectors(
byte* eccClientCertBuf, word32 eccClientCertBufSz,
byte* eccClientPrivKeyBuf, word32 eccClientPrivKeyBufSz)
{
- int ret, testSz = 0, i;
+ wc_test_ret_t ret;
+ int testSz = 0, i;
int encodedSz;
byte* out = NULL;
word32 outSz;
@@ -40251,9 +40277,9 @@ static int pkcs7signed_run_SingleShotVectors(
}
-WOLFSSL_TEST_SUBROUTINE int pkcs7signed_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs7signed_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte* rsaClientCertBuf = NULL;
byte* rsaServerCertBuf = NULL;
@@ -40400,10 +40426,10 @@ WOLFSSL_TEST_SUBROUTINE int pkcs7signed_test(void)
/* Maximum number of bytes in a number to test. */
#define MP_MAX_TEST_BYTE_LEN 32
-static int randNum(mp_int* n, int len, WC_RNG* rng, void* heap)
+static wc_test_ret_t randNum(mp_int* n, int len, WC_RNG* rng, void* heap)
{
byte d[MP_MAX_TEST_BYTE_LEN];
- int ret;
+ wc_test_ret_t ret;
(void)heap;
@@ -40420,12 +40446,12 @@ static int randNum(mp_int* n, int len, WC_RNG* rng, void* heap)
}
#if defined(WOLFSSL_SP_MATH_ALL) || !defined(USE_FAST_MATH)
-static int mp_test_div_3(mp_int* a, mp_int* r, WC_RNG* rng)
+static wc_test_ret_t mp_test_div_3(mp_int* a, mp_int* r, WC_RNG* rng)
{
int i, j;
mp_digit rem;
mp_digit rem2;
- int ret;
+ wc_test_ret_t ret;
#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \
defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY)
@@ -40514,9 +40540,9 @@ static int mp_test_div_3(mp_int* a, mp_int* r, WC_RNG* rng)
!defined(WOLFSSL_RSA_VERIFY_ONLY)) || \
(!defined WOLFSSL_SP_MATH && !defined(WOLFSSL_SP_MATH_ALL) && \
(defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY)))
-static int mp_test_radix_10(mp_int* a, mp_int* r, WC_RNG* rng)
+static wc_test_ret_t mp_test_radix_10(mp_int* a, mp_int* r, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i, j;
int size;
char str[30];
@@ -40593,9 +40619,9 @@ static int mp_test_radix_10(mp_int* a, mp_int* r, WC_RNG* rng)
#if defined(WOLFSSL_SP_MATH_ALL) || (!defined WOLFSSL_SP_MATH && \
defined(HAVE_ECC))
-static int mp_test_radix_16(mp_int* a, mp_int* r, WC_RNG* rng)
+static wc_test_ret_t mp_test_radix_16(mp_int* a, mp_int* r, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i, j;
int size;
char str[30];
@@ -40680,10 +40706,10 @@ static int mp_test_radix_16(mp_int* a, mp_int* r, WC_RNG* rng)
}
#endif
-static int mp_test_shift(mp_int* a, mp_int* r1, WC_RNG* rng)
+static wc_test_ret_t mp_test_shift(mp_int* a, mp_int* r1, WC_RNG* rng)
{
int i;
- int ret;
+ wc_test_ret_t ret;
ret = randNum(a, 4, rng, NULL);
if (ret != 0)
@@ -40717,10 +40743,10 @@ static int mp_test_shift(mp_int* a, mp_int* r1, WC_RNG* rng)
return 0;
}
-static int mp_test_add_sub_d(mp_int* a, mp_int* r1)
+static wc_test_ret_t mp_test_add_sub_d(mp_int* a, mp_int* r1)
{
int i, j;
- int ret;
+ wc_test_ret_t ret;
for (i = 0; i <= DIGIT_BIT * 2; i++) {
mp_zero(a);
@@ -40757,7 +40783,7 @@ static int mp_test_add_sub_d(mp_int* a, mp_int* r1)
return 0;
}
-static int mp_test_read_to_bin(mp_int* a)
+static wc_test_ret_t mp_test_read_to_bin(mp_int* a)
{
WOLFSSL_SMALL_STACK_STATIC const byte in[16] = {
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7, 0x08,
@@ -40766,7 +40792,7 @@ static int mp_test_read_to_bin(mp_int* a)
byte out[24];
int i, j, k;
const byte* p;
- int ret;
+ wc_test_ret_t ret;
for (i = 0; i < (int)sizeof(in); i++) {
p = in + sizeof(in) - i;
@@ -40804,7 +40830,7 @@ static int mp_test_read_to_bin(mp_int* a)
}
#if defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)
-static int mp_test_set_int(mp_int* a)
+static wc_test_ret_t mp_test_set_int(mp_int* a)
{
#if SP_ULONG_BITS == 64
unsigned long n = 0xfedcba9876543210UL;
@@ -40823,7 +40849,7 @@ static int mp_test_set_int(mp_int* a)
byte exp[1] = { 0xfe };
byte out[1] = { 0 };
#endif
- int ret;
+ wc_test_ret_t ret;
ret = mp_set_int(a, n);
if (ret != 0)
@@ -40843,7 +40869,7 @@ static int mp_test_set_int(mp_int* a)
#endif
#if defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)
-static int mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
+static wc_test_ret_t mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
{
byte buffer[16];
#if defined(HAVE_ECC) || defined(WOLFSSL_SP_MATH_ALL)
@@ -40856,7 +40882,7 @@ static int mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
defined(HAVE_COMP_KEY)
char decStr[] = "0987654321";
#endif
- int ret;
+ wc_test_ret_t ret;
#ifdef WOLFSSL_SP_MATH_ALL
mp_digit rho;
int size;
@@ -41858,10 +41884,10 @@ static int mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
#endif
#if !defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)
-static int mp_test_set_is_bit(mp_int* a)
+static wc_test_ret_t mp_test_set_is_bit(mp_int* a)
{
int i, j;
- int ret;
+ wc_test_ret_t ret;
mp_zero(a);
for (i = 0; i <= DIGIT_BIT * 2; i++) {
@@ -41950,9 +41976,9 @@ static int mp_test_set_is_bit(mp_int* a)
}
#endif /* !WOLFSSL_SP_MATH || WOLFSSL_SP_MATH_ALL */
-static int mp_test_cmp(mp_int* a, mp_int* b)
+static wc_test_ret_t mp_test_cmp(mp_int* a, mp_int* b)
{
- int ret;
+ wc_test_ret_t ret;
mp_zero(a);
mp_zero(b);
@@ -42027,9 +42053,9 @@ static int mp_test_cmp(mp_int* a, mp_int* b)
}
#if !defined(NO_DH) || defined(HAVE_ECC) || !defined(WOLFSSL_RSA_VERIFY_ONLY)
-static int mp_test_shbd(mp_int* a, mp_int* b, WC_RNG* rng)
+static wc_test_ret_t mp_test_shbd(mp_int* a, mp_int* b, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i, j, k;
#ifndef WOLFSSL_SP_MATH
@@ -42098,10 +42124,10 @@ static int mp_test_shbd(mp_int* a, mp_int* b, WC_RNG* rng)
#if defined(WOLFSSL_SP_MATH_ALL) || !defined(NO_DH) || defined(HAVE_ECC) || \
(!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \
!defined(WOLFSSL_RSA_PUBLIC_ONLY))
-static int mp_test_div(mp_int* a, mp_int* d, mp_int* r, mp_int* rem,
+static wc_test_ret_t mp_test_div(mp_int* a, mp_int* d, mp_int* r, mp_int* rem,
WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i, j, k;
mp_zero(a);
@@ -42237,9 +42263,9 @@ static int mp_test_div(mp_int* a, mp_int* d, mp_int* r, mp_int* rem,
#if defined(WOLFSSL_KEY_GEN) && (!defined(NO_DH) || !defined(NO_DSA)) && \
!defined(WC_NO_RNG)
-static int mp_test_prime(mp_int* a, WC_RNG* rng)
+static wc_test_ret_t mp_test_prime(mp_int* a, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int res;
ret = mp_rand_prime(a, 1, rng, NULL);
@@ -42341,10 +42367,10 @@ static int mp_test_prime(mp_int* a, WC_RNG* rng)
#endif
#if !defined(NO_RSA) && defined(WOLFSSL_KEY_GEN) && !defined(WC_RSA_BLINDING)
-static int mp_test_lcm_gcd(mp_int* a, mp_int* b, mp_int* r, mp_int* exp,
+static wc_test_ret_t mp_test_lcm_gcd(mp_int* a, mp_int* b, mp_int* r, mp_int* exp,
WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i;
WOLFSSL_SMALL_STACK_STATIC const int kat[][3] = {
{ 1, 1, 1 }, { 2, 1, 2 }, { 1, 2, 2 }, { 2, 4, 4 }, { 4, 2, 4 },
@@ -42427,9 +42453,9 @@ static int mp_test_lcm_gcd(mp_int* a, mp_int* b, mp_int* r, mp_int* exp,
#if (!defined(WOLFSSL_SP_MATH) && !defined(USE_FAST_MATH)) || \
defined(WOLFSSL_SP_MATH_ALL)
-static int mp_test_mod_2d(mp_int* a, mp_int* r, mp_int* t, WC_RNG* rng)
+static wc_test_ret_t mp_test_mod_2d(mp_int* a, mp_int* r, mp_int* t, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i;
int j;
@@ -42512,9 +42538,9 @@ static int mp_test_mod_2d(mp_int* a, mp_int* r, mp_int* t, WC_RNG* rng)
#if defined(WOLFSSL_SP_MATH_ALL) || defined(OPENSSL_EXTRA) || \
(defined(HAVE_ECC) && defined(HAVE_COMP_KEY))
-static int mp_test_mod_d(mp_int* a, WC_RNG* rng)
+static wc_test_ret_t mp_test_mod_d(mp_int* a, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
mp_digit r;
#if defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH)
mp_digit rem;
@@ -42561,10 +42587,10 @@ static int mp_test_mod_d(mp_int* a, WC_RNG* rng)
}
#endif
-static int mp_test_mul_sqr(mp_int* a, mp_int* b, mp_int* r1, mp_int* r2,
+static wc_test_ret_t mp_test_mul_sqr(mp_int* a, mp_int* b, mp_int* r1, mp_int* r2,
WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
int i;
for (i = 1; i < 16; i++) {
@@ -42650,9 +42676,9 @@ static int mp_test_mul_sqr(mp_int* a, mp_int* b, mp_int* r1, mp_int* r2,
#if !defined(NO_RSA) || defined(HAVE_ECC) || !defined(NO_DSA) || \
defined(OPENSSL_EXTRA)
-static int mp_test_invmod(mp_int* a, mp_int* m, mp_int* r)
+static wc_test_ret_t mp_test_invmod(mp_int* a, mp_int* m, mp_int* r)
{
- int ret;
+ wc_test_ret_t ret;
mp_set(a, 0);
mp_set(m, 1);
@@ -42761,9 +42787,9 @@ static int mp_test_invmod(mp_int* a, mp_int* m, mp_int* r)
#if !defined(NO_RSA) || !defined(NO_DSA) || !defined(NO_DH) || \
(defined(HAVE_ECC) && defined(HAVE_COMP_KEY)) || defined(OPENSSL_EXTRA)
-static int mp_test_exptmod(mp_int* b, mp_int* e, mp_int* m, mp_int* r)
+static wc_test_ret_t mp_test_exptmod(mp_int* b, mp_int* e, mp_int* m, mp_int* r)
{
- int ret;
+ wc_test_ret_t ret;
mp_set(b, 0x2);
mp_set(e, 0x3);
@@ -42891,9 +42917,9 @@ static int mp_test_exptmod(mp_int* b, mp_int* e, mp_int* m, mp_int* r)
#if defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_HAVE_SP_DH) || \
defined(HAVE_ECC) || (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY))
-static int mp_test_mont(mp_int* a, mp_int* m, mp_int* n, mp_int* r, WC_RNG* rng)
+static wc_test_ret_t mp_test_mont(mp_int* a, mp_int* m, mp_int* n, mp_int* r, WC_RNG* rng)
{
- int ret;
+ wc_test_ret_t ret;
mp_digit mp;
static int exp[] = { 7, 8, 16, 27, 32, 64,
127, 128, 255, 256,
@@ -43001,11 +43027,11 @@ static int mp_test_mont(mp_int* a, mp_int* m, mp_int* n, mp_int* r, WC_RNG* rng)
}
#endif
-WOLFSSL_TEST_SUBROUTINE int mp_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mp_test(void)
{
WC_RNG rng;
int rng_inited = 0;
- int ret;
+ wc_test_ret_t ret;
#if defined(HAVE_ECC) || defined(WOLFSSL_KEY_GEN)
int i, j;
#ifndef WOLFSSL_SP_MATH
@@ -43389,9 +43415,9 @@ static const unsigned char controlPrime[] = {
static const unsigned char testOne[] = { 1 };
-static int GenerateNextP(mp_int* p1, mp_int* p2, int k)
+static wc_test_ret_t GenerateNextP(mp_int* p1, mp_int* p2, int k)
{
- int ret;
+ wc_test_ret_t ret;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
mp_int *ki = (mp_int *)XMALLOC(sizeof(*ki), HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
@@ -43434,7 +43460,7 @@ static int GenerateNextP(mp_int* p1, mp_int* p2, int k)
}
-static int GenerateP(mp_int* p1, mp_int* p2, mp_int* p3,
+static wc_test_ret_t GenerateP(mp_int* p1, mp_int* p2, mp_int* p3,
const pairs_t* ecPairs, int ecPairsSz,
const int* k)
{
@@ -43443,7 +43469,8 @@ static int GenerateP(mp_int* p1, mp_int* p2, mp_int* p3,
#else
mp_int x[1], y[1];
#endif
- int ret, i;
+ wc_test_ret_t ret;
+ int i;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
if (((x = (mp_int *)XMALLOC(sizeof(*x), HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER)) == NULL) ||
@@ -43510,7 +43537,7 @@ static int GenerateP(mp_int* p1, mp_int* p2, mp_int* p3,
return ret;
}
-WOLFSSL_TEST_SUBROUTINE int prime_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t prime_test(void)
{
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
mp_int *n = (mp_int *)XMALLOC(sizeof *n, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER),
@@ -43523,7 +43550,8 @@ WOLFSSL_TEST_SUBROUTINE int prime_test(void)
p2[1],
p3[1];
#endif
- int ret, isPrime = 0;
+ wc_test_ret_t ret;
+ int isPrime = 0;
WC_RNG rng;
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -43663,9 +43691,9 @@ typedef struct berDerTestData {
word32 outSz;
} berDerTestData;
-WOLFSSL_TEST_SUBROUTINE int berder_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t berder_test(void)
{
- int ret;
+ wc_test_ret_t ret;
int i;
word32 len = 0, l;
byte out[32];
@@ -43781,9 +43809,9 @@ static void my_Logging_cb(const int logLevel, const char *const logMessage)
}
#endif /* DEBUG_WOLFSSL */
-WOLFSSL_TEST_SUBROUTINE int logging_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t logging_test(void)
{
- int ret;
+ wc_test_ret_t ret;
#ifdef DEBUG_WOLFSSL
const char* msg = "Testing, testing. 1, 2, 3, 4 ...";
byte a[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -43847,9 +43875,9 @@ WOLFSSL_TEST_SUBROUTINE int logging_test(void)
}
#if defined(__INCLUDE_NUTTX_CONFIG_H)
-WOLFSSL_TEST_SUBROUTINE int wolfcrypt_mutex_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t wolfcrypt_mutex_test(void)
#else
-WOLFSSL_TEST_SUBROUTINE int mutex_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mutex_test(void)
#endif
{
#ifdef WOLFSSL_PTHREADS
@@ -43857,7 +43885,7 @@ WOLFSSL_TEST_SUBROUTINE int mutex_test(void)
#endif
#if defined(WOLFSSL_PTHREADS) || (!defined(WOLFSSL_NO_MALLOC) && \
!defined(WOLFSSL_USER_MUTEX) && defined(WOLFSSL_STATIC_MEMORY))
- int ret;
+ wc_test_ret_t ret;
#endif
#if !defined(WOLFSSL_NO_MALLOC) && !defined(WOLFSSL_USER_MUTEX)
#ifndef WOLFSSL_STATIC_MEMORY
@@ -43919,9 +43947,9 @@ WOLFSSL_TEST_SUBROUTINE int mutex_test(void)
#if !defined(WOLFSSL_NO_MALLOC) && !defined(WOLFSSL_LINUXKM) && \
!defined(WOLFSSL_STATIC_MEMORY)
-static int malloc_cnt = 0;
-static int realloc_cnt = 0;
-static int free_cnt = 0;
+static wc_test_ret_t malloc_cnt = 0;
+static wc_test_ret_t realloc_cnt = 0;
+static wc_test_ret_t free_cnt = 0;
#ifdef WOLFSSL_DEBUG_MEMORY
static void *my_Malloc_cb(size_t size, const char* func, unsigned int line)
@@ -43981,9 +44009,9 @@ static void *my_Realloc_cb(void *ptr, size_t size)
}
#endif /* !WOLFSSL_NO_MALLOC */
-WOLFSSL_TEST_SUBROUTINE int memcb_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memcb_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if !defined(WOLFSSL_NO_MALLOC) && !defined(WOLFSSL_LINUXKM) && \
!defined(WOLFSSL_STATIC_MEMORY)
byte* b = NULL;
@@ -44052,9 +44080,9 @@ WOLFSSL_TEST_SUBROUTINE int memcb_test(void)
#if defined(WOLFSSL_CAAM_BLOB)
-WOLFSSL_TEST_SUBROUTINE int blob_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blob_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
byte out[112];
byte blob[112];
word32 outSz;
@@ -44139,9 +44167,9 @@ typedef struct {
* ctx callback ctx
* returen 0 on success, otherwise return negative
*/
-static int rsa_onlycb_test(myCryptoDevCtx *ctx)
+static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if !defined(NO_RSA)
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -44301,9 +44329,9 @@ static int rsa_onlycb_test(myCryptoDevCtx *ctx)
* ctx callback ctx
* returen 0 on success, otherwise return negative
*/
-static int ecc_onlycb_test(myCryptoDevCtx *ctx)
+static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
#if defined(HAVE_ECC)
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -45247,9 +45275,9 @@ static int myCryptoCbFind(int currentId, int algoType)
#endif /* WOLF_CRYPTO_CB_FIND */
-WOLFSSL_TEST_SUBROUTINE int cryptocb_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void)
{
- int ret = 0;
+ wc_test_ret_t ret = 0;
int origDevId = devId;
myCryptoDevCtx myCtx;
@@ -45361,9 +45389,9 @@ WOLFSSL_TEST_SUBROUTINE int cryptocb_test(void)
#endif /* WOLF_CRYPTO_CB */
#ifdef WOLFSSL_CERT_PIV
-WOLFSSL_TEST_SUBROUTINE int certpiv_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certpiv_test(void)
{
- int ret;
+ wc_test_ret_t ret;
wc_CertPIV piv;
/* Template for Identiv PIV cert, nonce and signature */
@@ -45450,10 +45478,10 @@ static time_t time_cb(time_t* t)
return 99;
}
-WOLFSSL_TEST_SUBROUTINE int time_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t time_test(void)
{
time_t t;
- int ret;
+ wc_test_ret_t ret;
ret = wc_SetTimeCb(time_cb);
if (ret != 0)
@@ -45492,7 +45520,7 @@ typedef struct {
#define AES_SIV_TEST_VECTORS 7
-WOLFSSL_TEST_SUBROUTINE int aes_siv_test(void)
+WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_siv_test(void)
{
/* These test vectors come from chrony 4.1's SIV unit tests. */
WOLFSSL_SMALL_STACK_STATIC const AesSivTestVector testVectors[AES_SIV_TEST_VECTORS] = {
@@ -45576,7 +45604,7 @@ WOLFSSL_TEST_SUBROUTINE int aes_siv_test(void)
byte computedCiphertext[82];
byte computedPlaintext[82];
byte siv[AES_BLOCK_SIZE];
- int ret = 0;
+ wc_test_ret_t ret = 0;
for (i = 0; i < AES_SIV_TEST_VECTORS; ++i) {
ret = wc_AesSivEncrypt(testVectors[i].key, testVectors[i].keySz,
diff --git a/wolfcrypt/test/test.h b/wolfcrypt/test/test.h
index f3ca1f374d..e1888d2125 100644
--- a/wolfcrypt/test/test.h
+++ b/wolfcrypt/test/test.h
@@ -23,11 +23,18 @@
#ifndef WOLFCRYPT_TEST_H
#define WOLFCRYPT_TEST_H
+#include
#ifdef __cplusplus
extern "C" {
#endif
+#ifdef WC_TEST_RET_CUSTOM_TYPE
+ typedef WC_TEST_RET_CUSTOM_TYPE wc_test_ret_t;
+#else
+ typedef sword32 wc_test_ret_t;
+#endif
+
#ifdef HAVE_CONFIG_H
#include
#endif
@@ -36,11 +43,11 @@
#ifdef HAVE_STACK_SIZE
THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args);
#else
-int wolfcrypt_test(void* args);
+wc_test_ret_t wolfcrypt_test(void* args);
#endif
#ifndef NO_MAIN_DRIVER
-int wolfcrypt_test_main(int argc, char** argv);
+wc_test_ret_t wolfcrypt_test_main(int argc, char** argv);
#endif
#if defined(WOLFSSL_ESPIDF) || defined(_WIN32_WCE)
@@ -49,13 +56,13 @@ int wolf_test_task(void);
#ifndef WC_TEST_RET_HAVE_CUSTOM_MACROS
-#define WC_TEST_RET_TAG_NC 0
-#define WC_TEST_RET_TAG_EC 1
-#define WC_TEST_RET_TAG_ERRNO 2
-#define WC_TEST_RET_TAG_I 3
+#define WC_TEST_RET_TAG_NC 0L
+#define WC_TEST_RET_TAG_EC 1L
+#define WC_TEST_RET_TAG_ERRNO 2L
+#define WC_TEST_RET_TAG_I 3L
#define WC_TEST_RET_ENC(line, i, tag) \
- (-((line) + ((int)((unsigned)(i) & 0x7ff) * 100000) + ((tag) << 29)))
+ (-((wc_test_ret_t)(line) + ((wc_test_ret_t)((word32)(i) & 0x7ffL) * 100000L) + ((wc_test_ret_t)(tag) << 29L)))
#ifndef WC_TEST_RET_LN
#define WC_TEST_RET_LN __LINE__
@@ -79,16 +86,16 @@ int wolf_test_task(void);
#define WC_TEST_RET_ENC_ERRNO WC_TEST_RET_ENC_NC
#endif
-#define WC_TEST_RET_DEC_TAG(x) ((-(x)) >> 29)
+#define WC_TEST_RET_DEC_TAG(x) ((-(x)) >> 29L)
/* decode line number */
-#define WC_TEST_RET_DEC_LN(x) (((-(x)) & ~(3 << 29)) % 100000)
+#define WC_TEST_RET_DEC_LN(x) ((int)(((-(x)) & ~(3L << 29L)) % 100000L))
/* decode integer or errno */
-#define WC_TEST_RET_DEC_I(x) (((-(x)) & ~(3 << 29)) / 100000)
+#define WC_TEST_RET_DEC_I(x) ((int)((((-(x)) & ~(3L << 29L)) / 100000L)))
/* decode error code */
-#define WC_TEST_RET_DEC_EC(x) (-WC_TEST_RET_DEC_I(x))
+#define WC_TEST_RET_DEC_EC(x) ((int)(-WC_TEST_RET_DEC_I(x)))
#endif /* !WC_TEST_RET_HAVE_CUSTOM_MACROS */
diff --git a/wolfssl/wolfcrypt/mem_track.h b/wolfssl/wolfcrypt/mem_track.h
index 483f14ab79..a375132fb4 100644
--- a/wolfssl/wolfcrypt/mem_track.h
+++ b/wolfssl/wolfcrypt/mem_track.h
@@ -24,8 +24,6 @@
#ifndef WOLFSSL_MEM_TRACK_H
#define WOLFSSL_MEM_TRACK_H
-#if defined(USE_WOLFSSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
-
/* The memory tracker overrides the wolfSSL memory callback system and uses a
* static to track the total, peak and currently allocated bytes.
*
@@ -61,7 +59,9 @@
*/
#include "wolfssl/wolfcrypt/settings.h"
+#include "wolfssl/wolfcrypt/types.h"
#include "wolfssl/wolfcrypt/logging.h"
+#include "wolfssl/wolfcrypt/error-crypt.h"
#include "wolfssl/wolfcrypt/memory.h"
#if defined(WOLFSSL_TRACK_MEMORY) || defined(HAVE_STACK_SIZE) || \
@@ -77,13 +77,14 @@
#endif
#endif
-#if defined(WOLFSSL_TRACK_MEMORY)
- #define DO_MEM_STATS
- #if (defined(__linux__) && !defined(WOLFSSL_LINUXKM)) || defined(__MACH__)
- #define DO_MEM_LIST
- #endif
-#endif
+/* Track Memory */
+#if defined(WOLFSSL_TRACK_MEMORY) && defined(USE_WOLFSSL_MEMORY) && \
+ !defined(WOLFSSL_STATIC_MEMORY)
+#define DO_MEM_STATS
+#if (defined(__linux__) && !defined(WOLFSSL_LINUXKM)) || defined(__MACH__)
+ #define DO_MEM_LIST
+#endif
typedef struct memoryStats {
long totalAllocs; /* number of allocations */
@@ -93,12 +94,12 @@ typedef struct memoryStats {
long currentBytes; /* total current bytes in use */
#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
long peakAllocsTripOdometer; /* peak number of concurrent allocations,
- * subject to reset by
- * wolfCrypt_heap_peak_checkpoint()
- */
+ * subject to reset by
+ * wolfCrypt_heap_peak_checkpoint()
+ */
long peakBytesTripOdometer; /* peak concurrent bytes, subject to reset
- * by wolfCrypt_heap_peak_checkpoint()
- */
+ * by wolfCrypt_heap_peak_checkpoint()
+ */
#endif
} memoryStats;
@@ -119,7 +120,8 @@ typedef struct memHint {
typedef struct memoryTrack {
union {
memHint hint;
- byte alignit[sizeof(memHint) + ((16-1) & ~(16-1))]; /* make sure we have strong alignment */
+ /* make sure we have strong alignment */
+ byte alignit[sizeof(memHint) + ((16-1) & ~(16-1))];
} u;
} memoryTrack;
@@ -132,7 +134,7 @@ typedef struct memoryList {
} memoryList;
#endif
-#if defined(WOLFSSL_TRACK_MEMORY)
+
static memoryStats ourMemStats;
#ifdef DO_MEM_LIST
@@ -140,7 +142,6 @@ static memoryStats ourMemStats;
static memoryList ourMemList;
static pthread_mutex_t memLock = PTHREAD_MUTEX_INITIALIZER;
#endif
-#endif
#ifdef WOLFSSL_DEBUG_MEMORY
static WC_INLINE void* TrackMalloc(size_t sz, const char* func,
@@ -169,7 +170,8 @@ static WC_INLINE void* TrackMalloc(size_t sz)
#ifdef WOLFSSL_DEBUG_MEMORY
#ifdef WOLFSSL_DEBUG_MEMORY_PRINT
- wc_mem_printf("Alloc: %p -> %u at %s:%d\n", header->thisMemory, (word32)sz, func, line);
+ wc_mem_printf("Alloc: %p -> %u at %s:%d\n",
+ header->thisMemory, (word32)sz, func, line);
#else
(void)func;
(void)line;
@@ -180,18 +182,23 @@ static WC_INLINE void* TrackMalloc(size_t sz)
ourMemStats.totalAllocs++;
ourMemStats.totalBytes += sz;
ourMemStats.currentBytes += sz;
+#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
+ if (ourMemStats.peakAllocsTripOdometer < ourMemStats.totalAllocs -
+ ourMemStats.totalDeallocs) {
+ ourMemStats.peakAllocsTripOdometer = ourMemStats.totalAllocs -
+ ourMemStats.totalDeallocs;
+ }
+ if (ourMemStats.peakBytesTripOdometer < ourMemStats.currentBytes)
+#endif
+ {
#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
- if (ourMemStats.peakAllocsTripOdometer < ourMemStats.totalAllocs - ourMemStats.totalDeallocs)
- ourMemStats.peakAllocsTripOdometer = ourMemStats.totalAllocs - ourMemStats.totalDeallocs;
- if (ourMemStats.peakBytesTripOdometer < ourMemStats.currentBytes) {
ourMemStats.peakBytesTripOdometer = ourMemStats.currentBytes;
#endif
if (ourMemStats.currentBytes > ourMemStats.peakBytes)
ourMemStats.peakBytes = ourMemStats.currentBytes;
- #ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
}
- #endif
-#endif
+#endif /* DO_MEM_STATS */
+
#ifdef DO_MEM_LIST
if (pthread_mutex_lock(&memLock) == 0) {
#ifdef WOLFSSL_DEBUG_MEMORY
@@ -214,7 +221,7 @@ static WC_INLINE void* TrackMalloc(size_t sz)
pthread_mutex_unlock(&memLock);
}
-#endif
+#endif /* DO_MEM_LIST */
return header->thisMemory;
}
@@ -332,7 +339,6 @@ static WC_INLINE void* TrackRealloc(void* ptr, size_t sz)
return ret;
}
-#ifdef WOLFSSL_TRACK_MEMORY
static wolfSSL_Malloc_cb mfDefault = NULL;
static wolfSSL_Free_cb ffDefault = NULL;
static wolfSSL_Realloc_cb rfDefault = NULL;
@@ -353,27 +359,26 @@ static WC_INLINE int InitMemoryTracker(void)
#ifdef DO_MEM_LIST
if (pthread_mutex_lock(&memLock) == 0)
- {
-#endif
-
-#ifdef DO_MEM_STATS
- ourMemStats.totalAllocs = 0;
- ourMemStats.totalDeallocs = 0;
- ourMemStats.totalBytes = 0;
- ourMemStats.peakBytes = 0;
- ourMemStats.currentBytes = 0;
-#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
- ourMemStats.peakAllocsTripOdometer = 0;
- ourMemStats.peakBytesTripOdometer = 0;
-#endif
#endif
+ {
+ #ifdef DO_MEM_STATS
+ ourMemStats.totalAllocs = 0;
+ ourMemStats.totalDeallocs = 0;
+ ourMemStats.totalBytes = 0;
+ ourMemStats.peakBytes = 0;
+ ourMemStats.currentBytes = 0;
+ #ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
+ ourMemStats.peakAllocsTripOdometer = 0;
+ ourMemStats.peakBytesTripOdometer = 0;
+ #endif
+ #endif /* DO_MEM_STATS */
-#ifdef DO_MEM_LIST
- XMEMSET(&ourMemList, 0, sizeof(ourMemList));
+ #ifdef DO_MEM_LIST
+ XMEMSET(&ourMemList, 0, sizeof(ourMemList));
- pthread_mutex_unlock(&memLock);
+ pthread_mutex_unlock(&memLock);
+ #endif
}
-#endif
return ret;
}
@@ -382,36 +387,38 @@ static WC_INLINE void ShowMemoryTracker(void)
{
#ifdef DO_MEM_LIST
if (pthread_mutex_lock(&memLock) == 0)
- {
-#endif
-
-#ifdef DO_MEM_STATS
- wc_mem_printf("total Allocs = %9ld\n", ourMemStats.totalAllocs);
- wc_mem_printf("total Deallocs = %9ld\n", ourMemStats.totalDeallocs);
- wc_mem_printf("total Bytes = %9ld\n", ourMemStats.totalBytes);
- wc_mem_printf("peak Bytes = %9ld\n", ourMemStats.peakBytes);
- wc_mem_printf("current Bytes = %9ld\n", ourMemStats.currentBytes);
#endif
+ {
+ #ifdef DO_MEM_STATS
+ wc_mem_printf("total Allocs = %9ld\n", ourMemStats.totalAllocs);
+ wc_mem_printf("total Deallocs = %9ld\n", ourMemStats.totalDeallocs);
+ wc_mem_printf("total Bytes = %9ld\n", ourMemStats.totalBytes);
+ wc_mem_printf("peak Bytes = %9ld\n", ourMemStats.peakBytes);
+ wc_mem_printf("current Bytes = %9ld\n", ourMemStats.currentBytes);
+ #endif
-#ifdef DO_MEM_LIST
- if (ourMemList.count > 0) {
- /* print list of allocations */
- memHint* header;
- for (header = ourMemList.head; header != NULL; header = header->next) {
- #ifdef WOLFSSL_DEBUG_MEMORY
- wc_mem_printf("Leak: Ptr %p, Size %u, Func %s, Line %d\n",
- (byte*)header + sizeof(memHint), (unsigned int)header->thisSize,
- header->func, header->line);
-#else
- wc_mem_printf("Leak: Ptr %p, Size %u\n",
- (byte*)header + sizeof(memHint), (unsigned int)header->thisSize);
-#endif
+ #ifdef DO_MEM_LIST
+ if (ourMemList.count > 0) {
+ /* print list of allocations */
+ memHint* header;
+ for (header = ourMemList.head;
+ header != NULL;
+ header = header->next) {
+ #ifdef WOLFSSL_DEBUG_MEMORY
+ wc_mem_printf("Leak: Ptr %p, Size %u, Func %s, Line %d\n",
+ (byte*)header + sizeof(memHint),
+ (unsigned int)header->thisSize, header->func, header->line);
+ #else
+ wc_mem_printf("Leak: Ptr %p, Size %u\n",
+ (byte*)header + sizeof(memHint),
+ (unsigned int)header->thisSize);
+ #endif
+ }
}
- }
- pthread_mutex_unlock(&memLock);
+ pthread_mutex_unlock(&memLock);
+ #endif
}
-#endif
}
static WC_INLINE int CleanupMemoryTracker(void)
@@ -419,9 +426,8 @@ static WC_INLINE int CleanupMemoryTracker(void)
/* restore default allocators */
return wolfSSL_SetAllocators(mfDefault, ffDefault, rfDefault);
}
-#endif /* WOLFSSL_TRACK_MEMORY */
-
-#endif /* USE_WOLFSSL_MEMORY && !WOLFSSL_STATIC_MEMORY */
+#endif /* WOLFSSL_TRACK_MEMORY && USE_WOLFSSL_MEMORY && \
+ !WOLFSSL_STATIC_MEMORY */
#ifdef HAVE_STACK_SIZE
@@ -432,10 +438,6 @@ static WC_INLINE int CleanupMemoryTracker(void)
#include
#include
-#include
-#include
-#include
-
typedef void* (*thread_func)(void* args);
#define STACK_CHECK_VAL 0x01
@@ -557,7 +559,8 @@ int StackSizeHWMReset(void)
_ret = StackSizeHWMReset(); \
if ((max >= 0) && (HWM > (ssize_t)(max))) { \
wc_mem_printf( \
- " relative stack usage at %s L%d exceeds designated max %ld bytes.\n", \
+ " relative stack usage at %s L%d exceeds designated " \
+ "max %ld bytes.\n", \
__FILE__, __LINE__, (long int)(max)); \
_ret = -1; \
} \
@@ -720,7 +723,8 @@ static WC_INLINE int StackSizeCheck_launch(struct func_args* args,
return 0;
}
-static WC_INLINE int StackSizeCheck_reap(pthread_t threadId, void *stack_context)
+static WC_INLINE int StackSizeCheck_reap(pthread_t threadId,
+ void *stack_context)
{
struct stack_size_debug_context *shim_args =
(struct stack_size_debug_context *)stack_context;
@@ -755,7 +759,6 @@ static WC_INLINE int StackSizeCheck_reap(pthread_t threadId, void *stack_context
return (int)((size_t)status);
}
-
#endif /* HAVE_STACK_SIZE */
diff --git a/wolfssl/wolfcrypt/port/caam/caam_driver.h b/wolfssl/wolfcrypt/port/caam/caam_driver.h
index e3e277d566..940e6e9e7b 100644
--- a/wolfssl/wolfcrypt/port/caam/caam_driver.h
+++ b/wolfssl/wolfcrypt/port/caam/caam_driver.h
@@ -455,5 +455,6 @@ struct DESCSTRUCT {
#define MAX_ECDSA_SIGN_ADDR 8
#define BLACK_KEY_MAC_SZ 16
#define BLACK_BLOB_KEYMOD_SZ 16
-#define RED_BLOB_KEYMOD_SZ 8
+#define RED_BLOB_KEYMOD_SZ 16
+#define SM_BLOB_KEYMOD_SZ 8
#endif /* CAAM_DRIVER_H */
diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam.h b/wolfssl/wolfcrypt/port/caam/wolfcaam.h
index ba9d75135b..6c96edc416 100644
--- a/wolfssl/wolfcrypt/port/caam/wolfcaam.h
+++ b/wolfssl/wolfcrypt/port/caam/wolfcaam.h
@@ -91,8 +91,9 @@ WOLFSSL_API int wc_caamCoverKey(byte* in, word32 inSz, byte* out, word32* outSz,
#define WC_CAAM_MAC_SZ 16
#define WC_CAAM_BLOB_RED 1
#define WC_CAAM_BLOB_BLACK 2
-#define WC_CAAM_RED_KEYMOD_SZ 8
+#define WC_CAAM_RED_KEYMOD_SZ 16
#define WC_CAAM_BLACK_KEYMOD_SZ 16
+#define WC_SM_BLOB_KEYMOD_SZ 8
#define WC_CAAM_MAX_ENTROPY 44
#if !defined(WOLFSSL_QNX_CAAM) && !defined(WOLFSSL_SECO_CAAM) && \
diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h
index aaf4ab489e..12a57e0e89 100644
--- a/wolfssl/wolfcrypt/settings.h
+++ b/wolfssl/wolfcrypt/settings.h
@@ -1886,11 +1886,13 @@ extern void uITRON4_free(void *p) ;
#endif
#endif
-#ifdef _MSC_VER
- #ifndef HAVE_SSIZE_T
- #include
- typedef SSIZE_T ssize_t;
- #endif
+#if defined(NO_WC_SSIZE_TYPE) || defined(ssize_t)
+ /* ssize_t comes from system headers or user_settings.h */
+#elif defined(WC_SSIZE_TYPE)
+ typedef WC_SSIZE_TYPE ssize_t;
+#elif defined(_MSC_VER)
+ #include
+ typedef SSIZE_T ssize_t;
#endif
/* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */
@@ -2612,6 +2614,11 @@ extern void uITRON4_free(void *p) ;
#endif
#endif
+/* Make sure setting OPENSSL_ALL also sets OPENSSL_EXTRA. */
+#if defined(OPENSSL_ALL) && !defined(OPENSSL_EXTRA)
+ #define OPENSSL_EXTRA
+#endif
+
#ifdef HAVE_SNI
#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55
#endif
@@ -3103,6 +3110,7 @@ extern void uITRON4_free(void *p) ;
/* Ciphersuite check done in internal.h */
#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif