From 23d0d8caf42b6b55e531b2405d949c6606ed3e85 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 25 Nov 2018 12:01:44 +0100 Subject: [PATCH] tls: on x86, use xorbuf_aligned_AES_BLOCK_SIZE() even with non-aligned source function old new delta aesgcm_GHASH 228 223 -5 Signed-off-by: Denys Vlasenko --- networking/tls_aesgcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/networking/tls_aesgcm.c b/networking/tls_aesgcm.c index fd72540c4..32ca40260 100644 --- a/networking/tls_aesgcm.c +++ b/networking/tls_aesgcm.c @@ -116,8 +116,10 @@ void FAST_FUNC aesgcm_GHASH(byte* h, blocks = cSz / AES_BLOCK_SIZE; partial = cSz % AES_BLOCK_SIZE; while (blocks--) { - //xorbuf_aligned_AES_BLOCK_SIZE(x, c); - c is not guaranteed to be aligned - xorbuf(x, c, AES_BLOCK_SIZE); + if (BB_UNALIGNED_MEMACCESS_OK) // c is not guaranteed to be aligned + xorbuf_aligned_AES_BLOCK_SIZE(x, c); + else + xorbuf(x, c, AES_BLOCK_SIZE); GMULT(x, h); c += AES_BLOCK_SIZE; }