aboutsummaryrefslogtreecommitdiff
path: root/networking/tls_aesgcm.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-11-25 14:03:59 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-11-25 14:03:59 +0100
commitbe5ca42e8d5f36145cca6c2120899e7e2ad4f0b3 (patch)
tree82128dc2958a2ff9a295ecba1c6c78073d2676d3 /networking/tls_aesgcm.c
parent23d0d8caf42b6b55e531b2405d949c6606ed3e85 (diff)
downloadbusybox-be5ca42e8d5f36145cca6c2120899e7e2ad4f0b3.tar.gz
tls: code shrink
function old new delta aesgcm_GHASH 223 196 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tls_aesgcm.c')
-rw-r--r--networking/tls_aesgcm.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/networking/tls_aesgcm.c b/networking/tls_aesgcm.c
index 32ca40260..688df85fb 100644
--- a/networking/tls_aesgcm.c
+++ b/networking/tls_aesgcm.c
@@ -87,8 +87,8 @@ void FAST_FUNC aesgcm_GHASH(byte* h,
)
{
byte x[AES_BLOCK_SIZE] ALIGNED_long;
- byte scratch[AES_BLOCK_SIZE] ALIGNED_long;
- word32 blocks, partial;
+// byte scratch[AES_BLOCK_SIZE] ALIGNED_long;
+ unsigned blocks, partial;
//was: byte* h = aes->H;
//XMEMSET(x, 0, AES_BLOCK_SIZE);
@@ -133,9 +133,17 @@ void FAST_FUNC aesgcm_GHASH(byte* h,
}
/* Hash in the lengths of A and C in bits */
- FlattenSzInBits(&scratch[0], aSz);
- FlattenSzInBits(&scratch[8], cSz);
- xorbuf_aligned_AES_BLOCK_SIZE(x, scratch);
+ //FlattenSzInBits(&scratch[0], aSz);
+ //FlattenSzInBits(&scratch[8], cSz);
+ //xorbuf_aligned_AES_BLOCK_SIZE(x, scratch);
+ // simpler:
+#define P32(v) ((uint32_t*)v)
+ //P32(x)[0] ^= 0;
+ P32(x)[1] ^= SWAP_BE32(aSz * 8);
+ //P32(x)[2] ^= 0;
+ P32(x)[3] ^= SWAP_BE32(cSz * 8);
+#undef P32
+
GMULT(x, h);
/* Copy the result into s. */