aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-11-14 21:33:38 +0200
committerRiccardo Spagni <ric@spagni.net>2018-11-14 21:33:38 +0200
commit8ba3f89b44658f47eccdb7feb61743f047584e24 (patch)
tree32a19f32ff45011bf325f976d88b76c41617da09 /src/crypto
parentMerge pull request #4753 (diff)
parentcrypto: fix AES encryption on big endian (diff)
downloadmonero-8ba3f89b44658f47eccdb7feb61743f047584e24.tar.xz
Merge pull request #4755
42d8d508 crypto: fix AES encryption on big endian (xiphon)
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/aesb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/aesb.c b/src/crypto/aesb.c
index 5d57b8af4..8a22a4b93 100644
--- a/src/crypto/aesb.c
+++ b/src/crypto/aesb.c
@@ -19,6 +19,7 @@ Issue Date: 20/12/2007
*/
#include <stdint.h>
+#include "common/int-util.h"
#if defined(__cplusplus)
extern "C"
@@ -50,7 +51,7 @@ extern "C"
#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
#define to_byte(x) ((x) & 0xff)
-#define bval(x,n) to_byte((x) >> (8 * (n)))
+#define bval(x,n) to_byte(SWAP32LE(x) >> (8 * (n)))
#define fwd_var(x,r,c)\
( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
@@ -58,7 +59,7 @@ extern "C"
: r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
: ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2)))
-#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c))
+#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ SWAP32LE(four_tables(x,t_use(f,n),fwd_var,rf1,c)))
#define sb_data(w) {\
w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\