From ffb80126ffc54a3fabcb07a01396eb0f2fed43b9 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 1 Nov 2019 16:00:06 -0600 Subject: [PATCH] Implement porting efforts from ZD5241 and ZD5815 --- wolfcrypt/src/wc_port.c | 13 +++++++++++++ wolfssl/wolfcrypt/settings.h | 19 ++++++++++++++++++- wolfssl/wolfcrypt/wc_port.h | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index d24a21569..aa26c7e4b 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -1175,6 +1175,19 @@ int wolfSSL_CryptHwMutexUnLock(void) { return 0; } + int ebsnet_fseek(int a, long b, int c) + { + int retval; + + retval = vf_lseek(a, b, c); + if (retval > 0) + retval = 0; + else + retval = -1; + + return(retval); + } + #elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) int wc_InitMutex(wolfSSL_Mutex* m) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 2234c0e64..084753e9e 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -794,7 +794,24 @@ extern void uITRON4_free(void *p) ; #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) #define XFREE(p, h, type) (rtp_free(p)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) + #define XREALLOC(p, n, h, t) (rtp_realloc((p), (n))) + + #if (WINMSP3) + #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) + #else + #sslpro: settings.h - please implement XSTRNCASECMP - needed for HAVE_ECC + #endif + + #define WOLFSSL_HAVE_MAX + #define WOLFSSL_HAVE_MIN + + #define USE_FAST_MATH + #define TFM_TIMING_RESISTANT + #define WC_RSA_BLINDING + #define ECC_TIMING_RESISTANT + + #define HAVE_ECC + #define WOLFSSL_STATIC_RSA #endif /* EBSNET */ diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 3a1dd2b8b..c5bb88152 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -282,7 +282,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void); #define XFILE int #define XFOPEN(NAME, MODE) vf_open((const char *)NAME, VO_RDONLY, 0); - #define XFSEEK vf_lseek + #define XFSEEK ebsnet_fseek #define XFTELL vf_tell #define XREWIND vf_rewind #define XFREAD(BUF, SZ, AMT, FD) vf_read(FD, BUF, SZ*AMT)