Repository navigation
JIT AES, PMULL and SHA-1 to speed up AArch64 crypto - #5
Merged
Merged
Conversation
losfair
marked this pull request as ready for review
October 25, 2026 07:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AArch64 crypto libraries select AES, PMULL and SHA-1 using kemu’s advertised capabilities, but those instructions currently invoke the interpreter individually. This translates them directly and removes the scalar lane moves/shifts that otherwise keep OpenSSL’s GHASH loop entering the kernel.
KEMU_CPUVM override for testing absent CPU features.Performance was measured against main
9ee0d5don an i7-13700H shared development host, Linux 6.18 under QEMU/KVM, one vCPU and 2 GiB RAM pinned to host CPU 2. Our builds and stress tests were stopped during timing. Native x86_64 and emulated arm64 OpenSSL are both version 3.5.7 with default hardware feature selection.OpenSSL medians from three alternating baseline/patched VM runs, using
speed -elapsed -seconds 2 -bytes 16384 -evp <algorithm>. Native measurements run in the same patched VM as the arm64 measurements. Throughput is decimal MB/s:AES-GCM remains 9.4× below native, and SHA-1 8.5× below native. Guest vectors still reside in memory between translated instructions, and SHA-1 uses the portable AVX2 lowering.
Instruction microbenchmarks (
tests/bench/crypto.c+crypto.S): median of three runs, 2,000,000 iterations per case after warming translations. Times include loop and operand-handling overhead and are not full cipher/hash throughput:Validation on the final implementation: