Skip to content

Commit e2e34b0

Browse files
Dave Watsonherbertx
authored andcommitted
crypto: aesni - Move ghash_mul to GCM_COMPLETE
Prepare to handle partial blocks between scatter/gather calls. For the last partial block, we only want to calculate the aadhash in GCM_COMPLETE, and a new partial block macro will handle both aadhash update and encrypting partial blocks between calls. Signed-off-by: Dave Watson <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 9660474 commit e2e34b0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

arch/x86/crypto/aesni-intel_asm.S

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ _zero_cipher_left_\@:
346346
pxor %xmm0, %xmm8
347347
.endif
348348

349-
GHASH_MUL %xmm8, %xmm13, %xmm9, %xmm10, %xmm11, %xmm5, %xmm6
350349
movdqu %xmm8, AadHash(%arg2)
351350
.ifc \operation, enc
352351
# GHASH computation for the last <16 byte block
@@ -379,6 +378,15 @@ _multiple_of_16_bytes_\@:
379378
.macro GCM_COMPLETE
380379
movdqu AadHash(%arg2), %xmm8
381380
movdqu HashKey(%rsp), %xmm13
381+
382+
mov PBlockLen(%arg2), %r12
383+
384+
cmp $0, %r12
385+
je _partial_done\@
386+
387+
GHASH_MUL %xmm8, %xmm13, %xmm9, %xmm10, %xmm11, %xmm5, %xmm6
388+
389+
_partial_done\@:
382390
mov AadLen(%arg2), %r12 # %r13 = aadLen (number of bytes)
383391
shl $3, %r12 # convert into number of bits
384392
movd %r12d, %xmm15 # len(A) in %xmm15

0 commit comments

Comments
 (0)