From 3c8eb7e9909dcfb05523d3c1c21f59687588bbfa Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Wed, 23 Nov 2022 14:50:03 +0000 Subject: [PATCH] Provide external definition of mbedtls_xor Signed-off-by: Dave Rodgman --- library/common.h | 2 +- library/platform_util.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/library/common.h b/library/common.h index c3847cdbf6..e502b5de13 100644 --- a/library/common.h +++ b/library/common.h @@ -414,7 +414,7 @@ extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const c * \param b Pointer to input (buffer of at least \p n bytes) * \param n Number of bytes to process. */ -static inline void mbedtls_xor( unsigned char *r, unsigned char const *a, unsigned char const *b, size_t n ) +inline void mbedtls_xor( unsigned char *r, unsigned char const *a, unsigned char const *b, size_t n ) { #if defined(MBEDTLS_ALLOW_UNALIGNED_ACCESS) uint32_t *a32 = (uint32_t *)a; diff --git a/library/platform_util.c b/library/platform_util.c index 916a7f444c..8fba664d27 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -143,3 +143,8 @@ struct tm *mbedtls_platform_gmtime_r( const mbedtls_time_t *tt, void (*mbedtls_test_hook_test_fail)( const char *, int, const char *); #endif /* MBEDTLS_TEST_HOOKS */ +/* + * Provide an external definition of mbedtls_xor so that the compiler + * has the option to not inline it + */ +extern inline void mbedtls_xor( unsigned char *r, unsigned char const *a, unsigned char const *b, size_t n );