aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-11-23 18:55:15 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-11-23 18:55:15 +0100
commit25569c3ca987f37075e457d5203fb7b6c3d6ae84 (patch)
treec88ebd364de3689d7e6bd21119839ddf024eef6d
parent219c9d4b5d12b3b965da838eb467b955ef928170 (diff)
downloadbusybox-w32-25569c3ca987f37075e457d5203fb7b6c3d6ae84.tar.gz
busybox-w32-25569c3ca987f37075e457d5203fb7b6c3d6ae84.tar.bz2
busybox-w32-25569c3ca987f37075e457d5203fb7b6c3d6ae84.zip
tls: make local buffers in aesgcm_GHASH() explicitly 32-bit aligned
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tls_aesgcm.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/networking/tls_aesgcm.c b/networking/tls_aesgcm.c
index 1a7ddb2e2..360e6f4ff 100644
--- a/networking/tls_aesgcm.c
+++ b/networking/tls_aesgcm.c
@@ -11,11 +11,6 @@ typedef uint32_t word32;
11#define XMEMSET memset 11#define XMEMSET memset
12#define XMEMCPY memcpy 12#define XMEMCPY memcpy
13 13
14#define TLS_MAJ 3
15#define TLS_MIN 3
16#define RECHDR_LEN 5
17#define OUTBUF_PFX (8 + AES_BLOCK_SIZE)
18
19void FAST_FUNC xorbuf(void* buf, const void* mask, unsigned count) 14void FAST_FUNC xorbuf(void* buf, const void* mask, unsigned count)
20{ 15{
21 word32 i; 16 word32 i;
@@ -39,12 +34,12 @@ static ALWAYS_INLINE void FlattenSzInBits(byte* buf, word32 sz)
39// buf[1] = (szHi >> 16) & 0xff; 34// buf[1] = (szHi >> 16) & 0xff;
40// buf[2] = (szHi >> 8) & 0xff; 35// buf[2] = (szHi >> 8) & 0xff;
41// buf[3] = szHi & 0xff; 36// buf[3] = szHi & 0xff;
42 move_to_unaligned32(buf, 0); 37 *(uint32_t*)(buf + 0) = 0;
43// buf[4] = (sz >> 24) & 0xff; 38// buf[4] = (sz >> 24) & 0xff;
44// buf[5] = (sz >> 16) & 0xff; 39// buf[5] = (sz >> 16) & 0xff;
45// buf[6] = (sz >> 8) & 0xff; 40// buf[6] = (sz >> 8) & 0xff;
46// buf[7] = sz & 0xff; 41// buf[7] = sz & 0xff;
47 move_to_unaligned32(buf + 4, SWAP_BE32(sz)); 42 *(uint32_t*)(buf + 4) = SWAP_BE32(sz);
48} 43}
49 44
50static void RIGHTSHIFTX(byte* x) 45static void RIGHTSHIFTX(byte* x)
@@ -100,8 +95,8 @@ void FAST_FUNC aesgcm_GHASH(byte* h,
100 byte* s //, unsigned sSz 95 byte* s //, unsigned sSz
101) 96)
102{ 97{
103 byte x[AES_BLOCK_SIZE]; 98 byte x[AES_BLOCK_SIZE] ALIGNED(4);
104 byte scratch[AES_BLOCK_SIZE]; 99 byte scratch[AES_BLOCK_SIZE] ALIGNED(4);
105 word32 blocks, partial; 100 word32 blocks, partial;
106 //was: byte* h = aes->H; 101 //was: byte* h = aes->H;
107 102