tls: on x86, use xorbuf_aligned_AES_BLOCK_SIZE() even with non-aligned source
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 25 Nov 2018 11:01:44 +0000 (12:01 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 25 Nov 2018 11:02:45 +0000 (12:02 +0100)
function                                             old     new   delta
aesgcm_GHASH                                         228     223      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/tls_aesgcm.c

index fd72540c4091b7c2180d2b4f665087b5d6ecff89..32ca40260bcba6cc6fbdb28f9513ca8fe7e85b9e 100644 (file)
@@ -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;
         }