From b329a1683215e090e6af91450fe8e70c82e3307a Mon Sep 17 00:00:00 2001 From: Kareem Date: Mon, 23 May 2022 13:45:30 -0700 Subject: [PATCH 1/5] Update Zephyr fs.h path. --- wolfssl/wolfcrypt/wc_port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 9c056ba4f..f6a7180e1 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -417,7 +417,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void); #define XFGETS(b,s,f) -2 /* Not ported yet */ #elif defined(WOLFSSL_ZEPHYR) - #include + #include #define XFILE struct fs_file_t* #define STAT struct fs_dirent From 26a92977f02a018baea4b3f7a08ef9bfca76ec3a Mon Sep 17 00:00:00 2001 From: Kareem Date: Mon, 23 May 2022 14:25:54 -0700 Subject: [PATCH 2/5] Remove MCAPI project's dependency on zlib version. --- mcapi/README | 6 ++--- mcapi/zlib.X/nbproject/configurations.xml | 32 +++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mcapi/README b/mcapi/README index 2cfb368b4..bea33d983 100644 --- a/mcapi/README +++ b/mcapi/README @@ -54,10 +54,10 @@ Included Project Files This project builds the zlib library for use in the wolfcrypt_test.X and wolfcrypt_mcapi.X projects. This project expects the zlib sources - to be located under the wolfSSL root directory. Currently it is set up - to work with zlib 1.2.8, and looks for sources under: + to be located under the wolfSSL root directory. It is set up to work + with the latest zlib, and looks for sources under: - /zlib-1.2.8 + /zlib PIC32MX/PIC32MZ --------------- diff --git a/mcapi/zlib.X/nbproject/configurations.xml b/mcapi/zlib.X/nbproject/configurations.xml index cf780f4e7..16174b768 100644 --- a/mcapi/zlib.X/nbproject/configurations.xml +++ b/mcapi/zlib.X/nbproject/configurations.xml @@ -12,21 +12,21 @@ - ../../zlib-1.2.8/adler32.c - ../../zlib-1.2.8/compress.c - ../../zlib-1.2.8/crc32.c - ../../zlib-1.2.8/deflate.c - ../../zlib-1.2.8/gzclose.c - ../../zlib-1.2.8/gzlib.c - ../../zlib-1.2.8/gzread.c - ../../zlib-1.2.8/gzwrite.c - ../../zlib-1.2.8/infback.c - ../../zlib-1.2.8/inffast.c - ../../zlib-1.2.8/inflate.c - ../../zlib-1.2.8/inftrees.c - ../../zlib-1.2.8/trees.c - ../../zlib-1.2.8/uncompr.c - ../../zlib-1.2.8/zutil.c + ../../zlib/adler32.c + ../../zlib/compress.c + ../../zlib/crc32.c + ../../zlib/deflate.c + ../../zlib/gzclose.c + ../../zlib/gzlib.c + ../../zlib/gzread.c + ../../zlib/gzwrite.c + ../../zlib/infback.c + ../../zlib/inffast.c + ../../zlib/inflate.c + ../../zlib/inftrees.c + ../../zlib/trees.c + ../../zlib/uncompr.c + ../../zlib/zutil.c - + From 350f1d64963c5cd57173629eeca4aec964243651 Mon Sep 17 00:00:00 2001 From: Kareem Date: Mon, 23 May 2022 14:31:36 -0700 Subject: [PATCH 3/5] Only use __builtin_offsetof on GCC 4+. It is not supported in GCC 3 or earlier. --- wolfssl/wolfcrypt/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 60de8a6ae..acbc38d86 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -828,7 +828,7 @@ decouple library dependencies with standard string, memory and so on. #endif #ifndef OFFSETOF - #if defined(__clang__) || defined(__GNUC__) + #if defined(__clang__) || (__GNUC__ >= 4) #define OFFSETOF(type, field) __builtin_offsetof(type, field) #else #define OFFSETOF(type, field) ((size_t)&(((type *)0)->field)) From 03e086a1397a2d985621a8d03588b5fbb0aa3021 Mon Sep 17 00:00:00 2001 From: Kareem Date: Tue, 24 May 2022 13:12:59 -0700 Subject: [PATCH 4/5] Code review feedback. --- wolfssl/wolfcrypt/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index acbc38d86..4992e0aca 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -828,7 +828,7 @@ decouple library dependencies with standard string, memory and so on. #endif #ifndef OFFSETOF - #if defined(__clang__) || (__GNUC__ >= 4) + #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 4)) #define OFFSETOF(type, field) __builtin_offsetof(type, field) #else #define OFFSETOF(type, field) ((size_t)&(((type *)0)->field)) From bcb5ff5ed9f0d28637ccf6432d3e68f1f23cbfb3 Mon Sep 17 00:00:00 2001 From: Kareem Date: Tue, 24 May 2022 13:20:52 -0700 Subject: [PATCH 5/5] Increase MAX_ECC_STRING to include the trailing \0 for longer order strings (in eg. SECP160R1). Note that this now matches the check in wc_EccPublicKeyDecode. --- wolfssl/wolfcrypt/ecc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/ecc.h b/wolfssl/wolfcrypt/ecc.h index d0defd94b..e4676f593 100644 --- a/wolfssl/wolfcrypt/ecc.h +++ b/wolfssl/wolfcrypt/ecc.h @@ -293,7 +293,7 @@ typedef struct ecc_set_type { } ecc_set_type; #else #define MAX_ECC_NAME 16 -#define MAX_ECC_STRING ((MAX_ECC_BYTES * 2) + 1) +#define MAX_ECC_STRING ((MAX_ECC_BYTES * 2) + 2) /* The values are stored as text strings. */ typedef struct ecc_set_type {