Skip to content

Commit

Permalink
Merge pull request project-chip#8 from mihai-ignat/fix/crosscompile
Browse files Browse the repository at this point in the history
Fix/cross compile for non tinycrypt based platforms
  • Loading branch information
doru91 authored Mar 28, 2022
2 parents daba06f + 6d53eff commit ff0151c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 59 deletions.
1 change: 0 additions & 1 deletion src/crypto/CHIPCryptoPALmbedTLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,6 @@ CHIP_ERROR P256Keypair::Deserialize(P256SerializedKeypair & input)
keypair = nullptr;
mInitialized = true;

exit:
_log_mbedTLS_error(result);
return error;

Expand Down
52 changes: 0 additions & 52 deletions third_party/nxp/tinycrypt/fixes/mbedtls_config_h.patch

This file was deleted.

8 changes: 5 additions & 3 deletions third_party/nxp/tinycrypt/fixes/mbedtls_platform_util_c.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/library/platform_util.c b/library/platform_util.c
index 98fe5deb2..ef5fde8b9 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -32,9 +32,39 @@
@@ -32,9 +32,41 @@
#include "mbedtls/platform.h"
#include "mbedtls/threading.h"

Expand All @@ -16,11 +16,13 @@ index 98fe5deb2..ef5fde8b9 100644
+#include "mbedtls/entropy_poll.h"
+#endif
+
+#if defined(MBEDTLS_USE_TINYCRYPT)
+#if defined(MBEDTLS_PLATFORM_FAULT_CALLBACKS)
+#include "platform_fault.h"
+#else
+static void mbedtls_platform_fault(){}
+#endif
+#endif /* MBEDTLS_USE_TINYCRYPT */
+
#include <stddef.h>
#include <string.h>
Expand All @@ -42,7 +44,7 @@ index 98fe5deb2..ef5fde8b9 100644
#if !defined(MBEDTLS_PLATFORM_ZEROIZE_ALT)
/*
* This implementation should never be optimized out by the compiler
@@ -62,6 +92,34 @@
@@ -62,6 +94,34 @@
* mbedtls_platform_zeroize() to use a suitable implementation for their
* platform and needs.
*/
Expand Down Expand Up @@ -77,7 +79,7 @@ index 98fe5deb2..ef5fde8b9 100644
static void * (* const volatile memset_func)( void *, int, size_t ) = memset;

void mbedtls_platform_zeroize( void *buf, size_t len )
@@ -71,8 +129,284 @@ void mbedtls_platform_zeroize( void *buf, size_t len )
@@ -71,8 +131,284 @@ void mbedtls_platform_zeroize( void *buf, size_t len )
if( len > 0 )
memset_func( buf, 0, len );
}
Expand Down
2 changes: 1 addition & 1 deletion third_party/nxp/tinycrypt/fixes/openthread_ecdsa_cpp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ index b66371d17..ac5460c28 100644
+ Error error;
+ mbedtls_pk_context pk;
+ mbedtls_uecc_keypair *keyPair;
+ int ret;
+// int ret;
+
+ SuccessOrExit(error = Parse(&pk));
+
Expand Down
2 changes: 0 additions & 2 deletions third_party/nxp/tinycrypt/patch_tinycrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ SOURCE_DIR=$(cd "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)

patch -N --binary -d "$PW_PROJECT_ROOT"/third_party/mbedtls/repo -p1 <"$SOURCE_DIR/fixes/mbedtls_check_config_h.patch"

patch -N --binary -d "$PW_PROJECT_ROOT"/third_party/mbedtls/repo -p1 <"$SOURCE_DIR/fixes/mbedtls_config_h.patch"

patch -N --binary -d "$PW_PROJECT_ROOT"/third_party/mbedtls/repo -p1 <"$SOURCE_DIR/fixes/mbedtls_oid_h.patch"

patch -N --binary -d "$PW_PROJECT_ROOT"/third_party/mbedtls/repo -p1 <"$SOURCE_DIR/fixes/mbedtls_pk_h.patch"
Expand Down

0 comments on commit ff0151c

Please sign in to comment.