Skip to content

Commit

Permalink
aesv8-gcm-armv8: De-interleave aes_gcm_{enc,dec}_kernel
Browse files Browse the repository at this point in the history
Context: On AArch64 platforms without EOR3 (e.g. Graviton2),
AWS-LC leverages the assembly kernels aes_gcm_enc_kernel and
aes_gcm_dec_kernel for fast AES-GCM computations. These kernels
are highly interleaved in consideration of instruction latencies,
which drastically improves performance even on out of order
cores like Graviton2. However, the interleaving also impedes
an intuitive understanding of what is happening, and thereby
hardens modification and verification efforts.

To facilitate auditability and verification, this commit adds a
separate source file which contains partially deinterleaved versions
of the non-EOR3 AES-GCM assembly kernels. The interleaving is 'partial'
in the sense that, within a control flow block, instructions are freely
reordered, but not across control flow boundaries. In particular,
software pipelining is still present in the de-interleaved versions.

There is further potential for clarifying the de-interleaved code,
for example by (a) the use of macros, or (b) de-interleaving across
loop boundaries. Potential changes along those lines are left for
future commits.

The de-interleaved versions are provided in a separate file
aesv8-gcm-armv8-deinterleaved.pl.
  • Loading branch information
hanno-becker committed Jul 8, 2024
1 parent 5d53371 commit 1bc6b36
Show file tree
Hide file tree
Showing 6 changed files with 6,146 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crypto/fipsmodule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if(ARCH STREQUAL "aarch64")

aesv8-armx.${ASM_EXT}
aesv8-gcm-armv8.${ASM_EXT}
aesv8-gcm-armv8-deinterleaved.${ASM_EXT}
aesv8-gcm-armv8-unroll8.${ASM_EXT}
armv8-mont.${ASM_EXT}
bn-armv8.${ASM_EXT}
Expand Down Expand Up @@ -122,6 +123,7 @@ if(PERL_EXECUTABLE)
perlasm(aesp8-ppc.${ASM_EXT} aes/asm/aesp8-ppc.pl)
perlasm(aesv8-armx.${ASM_EXT} aes/asm/aesv8-armx.pl)
perlasm(aesv8-gcm-armv8.${ASM_EXT} modes/asm/aesv8-gcm-armv8.pl)
perlasm(aesv8-gcm-armv8-deinterleaved.${ASM_EXT} modes/asm/aesv8-gcm-armv8-deinterleaved.pl)
perlasm(aesv8-gcm-armv8-unroll8.${ASM_EXT} modes/asm/aesv8-gcm-armv8-unroll8.pl)
perlasm(armv4-mont.${ASM_EXT} bn/asm/armv4-mont.pl)
perlasm(armv8-mont.${ASM_EXT} bn/asm/armv8-mont.pl)
Expand Down
Loading

0 comments on commit 1bc6b36

Please sign in to comment.