From 10f853ae4d4e5f94b7bb1388ac32a7c7370c476a Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 3 Apr 2015 12:19:40 -0600 Subject: [PATCH] adjustment to chacha for big endian --- configure.ac | 6 ------ wolfcrypt/src/chacha.c | 9 ++++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 566492b74..45a687368 100644 --- a/configure.ac +++ b/configure.ac @@ -1201,12 +1201,6 @@ AC_ARG_ENABLE([chacha], [ ENABLED_CHACHA=yes ] ) -# not ready for big endian yet -if test "x$ac_cv_c_bigendian" = "xyes" -then - ENABLED_CHACHA=no -fi - # lean psk does't need chacha if test "$ENABLED_LEANPSK" = "yes" then diff --git a/wolfcrypt/src/chacha.c b/wolfcrypt/src/chacha.c index fb8ace64c..4e95bdbd0 100644 --- a/wolfcrypt/src/chacha.c +++ b/wolfcrypt/src/chacha.c @@ -48,7 +48,6 @@ #ifdef BIG_ENDIAN_ORDER #define LITTLE32(x) ByteReverseWord32(x) - #error "CHACHA Not ready for Big Endian yet" #else #define LITTLE32(x) (x) #endif @@ -164,10 +163,10 @@ int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz) ctx->X[ 9] = U8TO32_LITTLE(k + 4); ctx->X[10] = U8TO32_LITTLE(k + 8); ctx->X[11] = U8TO32_LITTLE(k + 12); - ctx->X[ 0] = U8TO32_LITTLE(constants + 0); - ctx->X[ 1] = U8TO32_LITTLE(constants + 1); - ctx->X[ 2] = U8TO32_LITTLE(constants + 2); - ctx->X[ 3] = U8TO32_LITTLE(constants + 3); + ctx->X[ 0] = constants[0]; + ctx->X[ 1] = constants[1]; + ctx->X[ 2] = constants[2]; + ctx->X[ 3] = constants[3]; return 0; }