Changes to compile without XTREAM_ALIGN

Use macro to load 32 bits from input parameters key in hc128.c and input
in rabbit.c
Also fix warning about string copy.
pull/4070/head
Sean Parkinson 2021-06-30 09:45:19 +10:00 committed by Elms
parent 56d879f422
commit 6694775d4b
4 changed files with 18 additions and 7 deletions

View File

@ -1531,7 +1531,7 @@ AC_ARG_ENABLE([aligndata],
if test "$ENABLED_ALIGN_DATA" = "yes"
then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_USE_ALIGN -DXSTREAM_ALIGN"
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_USE_ALIGN"
fi
# INTEL RDRAND

View File

@ -26312,7 +26312,7 @@ int wolfSSL_X509_VERIFY_PARAM_set1_ip_asc(WOLFSSL_X509_VERIFY_PARAM *param,
param->ipasc[0] = '\0';
}
else {
XSTRNCPY(param->ipasc, ipasc, WOLFSSL_MAX_IPSTR-1);
XSTRNCPY(param->ipasc, ipasc, WOLFSSL_MAX_IPSTR);
param->ipasc[WOLFSSL_MAX_IPSTR-1] = '\0';
}
ret = WOLFSSL_SUCCESS;

View File

@ -40,6 +40,12 @@
#endif
#define LOAD_LE32(a) \
(((word32)(a)[0] << 0) | \
((word32)(a)[1] << 8) | \
((word32)(a)[2] << 16) | \
((word32)(a)[3] << 24))
#ifdef BIG_ENDIAN_ORDER
#define LITTLE32(x) ByteReverseWord32(x)
#else
@ -278,7 +284,7 @@ static WC_INLINE int DoKey(HC128* ctx, const byte* key, const byte* iv)
/* Key size in bits 128 */
for (i = 0; i < HC128_KEY_NUMBYTES; i++)
ctx->key[i] = LITTLE32(((word32*)key)[i]);
ctx->key[i] = LOAD_LE32(key + i * 4);
for ( ; i < 8 ; i++) ctx->key[i] = ctx->key[i-4];

View File

@ -38,6 +38,11 @@
#include <wolfcrypt/src/misc.c>
#endif
#define LOAD_LE32(a) \
(((word32)(a)[0] << 0) | \
((word32)(a)[1] << 8) | \
((word32)(a)[2] << 16) | \
((word32)(a)[3] << 24))
#ifdef BIG_ENDIAN_ORDER
#define LITTLE32(x) ByteReverseWord32(x)
@ -256,16 +261,16 @@ static WC_INLINE int DoProcess(Rabbit* ctx, byte* output, const byte* input,
RABBIT_next_state(&(ctx->workCtx));
/* Encrypt/decrypt 16 bytes of data */
*(word32*)(output+ 0) = *(word32*)(input+ 0) ^
*(word32*)(output+ 0) = LOAD_LE32(input+ 0) ^
LITTLE32(ctx->workCtx.x[0] ^ (ctx->workCtx.x[5]>>16) ^
U32V(ctx->workCtx.x[3]<<16));
*(word32*)(output+ 4) = *(word32*)(input+ 4) ^
*(word32*)(output+ 4) = LOAD_LE32(input+ 4) ^
LITTLE32(ctx->workCtx.x[2] ^ (ctx->workCtx.x[7]>>16) ^
U32V(ctx->workCtx.x[5]<<16));
*(word32*)(output+ 8) = *(word32*)(input+ 8) ^
*(word32*)(output+ 8) = LOAD_LE32(input+ 8) ^
LITTLE32(ctx->workCtx.x[4] ^ (ctx->workCtx.x[1]>>16) ^
U32V(ctx->workCtx.x[7]<<16));
*(word32*)(output+12) = *(word32*)(input+12) ^
*(word32*)(output+12) = LOAD_LE32(input+12) ^
LITTLE32(ctx->workCtx.x[6] ^ (ctx->workCtx.x[3]>>16) ^
U32V(ctx->workCtx.x[1]<<16));