ICP: gcm: Allocate hash subkey table separately

While evaluating other assembler implementations it turns out that
the precomputed hash subkey tables vary in size, from 8*16 bytes
(avx2/avx512) up to 48*16 bytes (avx512-vaes), depending on the
implementation.

To be able to handle the size differences later, allocate
`gcm_Htable` dynamically rather then having a fixed size array, and
adapt consumers.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #11102
This commit is contained in:
Attila Fülöp
2020-10-30 23:24:21 +01:00
committed by Brian Behlendorf
parent 2c37e1416b
commit c6b0680d9b
5 changed files with 93 additions and 13 deletions
+14 -4
View File
@@ -718,6 +718,8 @@ aesni_gcm_decrypt:
.cfi_offset %r14,-48
pushq %r15
.cfi_offset %r15,-56
pushq %r9
.cfi_offset %r9,-64
vzeroupper
vmovdqu (%r8),%xmm1
@@ -730,7 +732,8 @@ aesni_gcm_decrypt:
andq $-128,%rsp
vmovdqu (%r11),%xmm0
leaq 128(%rcx),%rcx
leaq 32+32(%r9),%r9
movq 32(%r9),%r9
leaq 32(%r9),%r9
movl 504-128(%rcx),%ebp // ICP has a larger offset for rounds.
vpshufb %xmm0,%xmm8,%xmm8
@@ -786,7 +789,9 @@ aesni_gcm_decrypt:
vmovups %xmm14,-16(%rsi)
vpshufb (%r11),%xmm8,%xmm8
vmovdqu %xmm8,-64(%r9)
movq -56(%rax),%r9
.cfi_restore %r9
vmovdqu %xmm8,(%r9)
vzeroupper
movq -48(%rax),%r15
@@ -924,6 +929,8 @@ aesni_gcm_encrypt:
.cfi_offset %r14,-48
pushq %r15
.cfi_offset %r15,-56
pushq %r9
.cfi_offset %r9,-64
vzeroupper
vmovdqu (%r8),%xmm1
@@ -966,7 +973,8 @@ aesni_gcm_encrypt:
call _aesni_ctr32_6x
vmovdqu (%r9),%xmm8
leaq 32+32(%r9),%r9
movq 32(%r9),%r9
leaq 32(%r9),%r9
subq $12,%rdx
movq $192,%r10
vpshufb %xmm0,%xmm8,%xmm8
@@ -1157,7 +1165,9 @@ aesni_gcm_encrypt:
vpxor %xmm7,%xmm2,%xmm2
vpxor %xmm2,%xmm8,%xmm8
vpshufb (%r11),%xmm8,%xmm8
vmovdqu %xmm8,-64(%r9)
movq -56(%rax),%r9
.cfi_restore %r9
vmovdqu %xmm8,(%r9)
vzeroupper
movq -48(%rax),%r15