Fixes for data types, cast warnings and shift operations when using 16-bit platform. Added new --enable-16bit build option, which defines WC_16BIT_CPU. Fix build error when using WOLFSSL_LEANPSK and NO_WOLFSSL_MEMORY.

Tested using `avr-gcc` version 8.3.0 with: `./configure --host=avr --enable-16bit --disable-filesystem --enable-singlethreaded CFLAGS="-DWOLFSSL_GENSEED_FORTEST -DWOLFSSL_USER_CURRTIME -DWOLFSSL_USER_IO -DWOLFSSL_NO_SOCK -DNO_WRITEV -DUSER_TICKS" --enable-tls13 --enable-compkey --enable-certgen --enable-certext --enable-keygen --enable-session-ticket --enable-maxfragment`. Also with `--enable-fastmath`.
This commit is contained in:
David Garske
2019-03-01 15:54:08 -08:00
parent 809c30a5b9
commit 621e1656b4
17 changed files with 178 additions and 141 deletions

View File

@@ -289,14 +289,14 @@ STATIC WC_INLINE void c32toa(word32 wc_u32, byte* c)
/* convert a 24 bit integer into a 32 bit one */
STATIC WC_INLINE void c24to32(const word24 wc_u24, word32* wc_u32)
{
*wc_u32 = (wc_u24[0] << 16) | (wc_u24[1] << 8) | wc_u24[2];
*wc_u32 = ((word32)wc_u24[0] << 16) | (wc_u24[1] << 8) | wc_u24[2];
}
/* convert opaque to 24 bit integer */
STATIC WC_INLINE void ato24(const byte* c, word32* wc_u24)
{
*wc_u24 = (c[0] << 16) | (c[1] << 8) | c[2];
*wc_u24 = ((word32)c[0] << 16) | (c[1] << 8) | c[2];
}
/* convert opaque to 16 bit integer */
@@ -308,7 +308,7 @@ STATIC WC_INLINE void ato16(const byte* c, word16* wc_u16)
/* convert opaque to 32 bit integer */
STATIC WC_INLINE void ato32(const byte* c, word32* wc_u32)
{
*wc_u32 = ((word32)c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
*wc_u32 = ((word32)c[0] << 24) | ((word32)c[1] << 16) | (c[2] << 8) | c[3];
}