Skip to content

Commit b4d901e

Browse files
committed
Add WOLFSSL_OPTEE to support building wolfCrypt into an OP-TEE trusted application
1 parent 10ae136 commit b4d901e

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎wolfcrypt/src/wc_port.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6144,7 +6144,7 @@ char* wolfSSL_strnstr(const char* s1, const char* s2, size_t n)
61446144

61456145
#if (defined(__unix__) || defined(__APPLE__)) && \
61466146
!defined(WOLFSSL_KERNEL_MODE) && !defined(WOLFSSL_ZEPHYR) && \
6147-
!defined(WOLFSSL_SGX)
6147+
!defined(WOLFSSL_SGX) && !defined(WOLFSSL_OPTEE)
61486148

61496149
#include <fcntl.h>
61506150
#include <errno.h>

‎wolfssl/wolfcrypt/settings.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,6 +3515,20 @@
35153515
#define USE_CERT_BUFFERS_2048
35163516
#endif /* WOLFSSL_SGX */
35173517

3518+
/* OP-TEE trusted application. Runs against libutee rather than a C library,
3519+
* so there are no file descriptors, sockets, directories or wall clock, and
3520+
* a TA is single threaded. The TA toolchain is a Linux cross compiler and
3521+
* still predefines __unix__, so the environment has to be named explicitly. */
3522+
#ifdef WOLFSSL_OPTEE
3523+
#define NO_FILESYSTEM
3524+
#define NO_WOLFSSL_DIR
3525+
#define NO_WRITEV
3526+
#define NO_MAIN_DRIVER
3527+
#define SINGLE_THREADED
3528+
#define NO_ASN_TIME /* no wall clock in a TA */
3529+
#define USER_TICKS
3530+
#endif /* WOLFSSL_OPTEE */
3531+
35183532
/* FreeScale MMCAU hardware crypto has 4 byte alignment.
35193533
However, KSDK fsl_mmcau.h gives API with no alignment
35203534
requirements (4 byte alignment is managed internally by fsl_mmcau.c) */

0 commit comments

Comments
 (0)