Skip to content

Commit

Permalink
merge to upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi committed Jun 24, 2023
2 parents 96c0287 + 18032cd commit 97ccccf
Show file tree
Hide file tree
Showing 60 changed files with 1,540 additions and 4,630 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
34 changes: 24 additions & 10 deletions IDE/MCUEXPRESSO/RT1170/fsl_caam_c.patch
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down Expand Up @@ -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);
+ }
Expand Down Expand Up @@ -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);
+ }
Expand Down Expand Up @@ -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);
+ }
Expand Down Expand Up @@ -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);
+ }
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
+ }
Expand Down
12 changes: 7 additions & 5 deletions IDE/MCUEXPRESSO/RT1170/fsl_caam_h.patch
Original file line number Diff line number Diff line change
@@ -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 */

Expand Down Expand Up @@ -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
+
+/*!
Expand Down
71 changes: 56 additions & 15 deletions IDE/MDK-ARM/MDK-ARM/wolfSSL/config-BARE-METAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
Expand Down Expand Up @@ -204,6 +204,60 @@
// </e>
// </h>

// <h>Math / Memory
// <o> 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

// <e>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
// </e>
// </h>

// <h>Others

// <e>Inline
Expand Down Expand Up @@ -253,22 +307,9 @@
#define NO_ERROR_STRINGS
#endif
// </e>

// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 0
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#endif
// </e>
// </h>


// </h>

//</h>
// <<< end of configuration section >>>
70 changes: 55 additions & 15 deletions IDE/MDK-ARM/MDK-ARM/wolfSSL/config-FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
Expand Down Expand Up @@ -241,6 +241,60 @@
// </e>
// </h>

// <h>Math / Memory
// <o> 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

// <e>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
// </e>
// </h>

// <h>Others

// <e>Inline
Expand Down Expand Up @@ -291,20 +345,6 @@
#endif
// </e>

// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 0
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#endif
// </e>


// </h>

//</h>
Expand Down
Loading

0 comments on commit 97ccccf

Please sign in to comment.