icp: Add AES-GCM acceleration for ARMv8 on Apple Silicon#33
Open
lundman wants to merge 2 commits intomacOS_20250602from
Open
icp: Add AES-GCM acceleration for ARMv8 on Apple Silicon#33lundman wants to merge 2 commits intomacOS_20250602from
lundman wants to merge 2 commits intomacOS_20250602from
Conversation
This adds a new GHASH backend leveraging the PMULL instruction available on ARMv8 (Apple Silicon). Combined with the existing aesv8 encryption path, this enables full AES-GCM acceleration in both userland and kernel. Key changes: - Added `gcm_ghash_v8()` and `gcm_ghash_v8_4x()` from OpenSSL - Added `gcm_init_htab()` (and optional `gcm_init_v8()` v8 variant) - Extended `gcm_impl_ops_t` with `.ghash`, `.ghash_init`, and `.needs_htable` - Registered new backend as `ghashv8`, selected automatically when AES and PMULL are available. (Always true on Apple hardware) - Updated `gcm_init()` to initialize `Htable` when required - Replaced use of `.mul` with `.ghash` calls in GHASH macro for modern paths The implementation maintains compatibility with existing infrastructure and does not affect platforms without ARMv8 crypto extensions. Tested: - Userland via `crypto_test` with `aesv8+ghashv8` - Confirmed fallback to generic if PMULL unavailable Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Add ARMv8 cipher options for testing. Stop core when NULL is passed to strcmp(). Signed-off-by: Jorgen Lundman <lundman@lundman.net>
81e7091 to
c027ddb
Compare
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.
This adds a new GHASH backend leveraging the PMULL instruction available on ARMv8 (Apple Silicon). Combined with the existing aesv8 encryption path, this enables full AES-GCM acceleration in both userland and kernel.
Key changes:
gcm_ghash_v8()andgcm_ghash_v8_4x()using ARM NEON + PMULLgcm_init_htab_v8()(and optionalgcm_init_v8()assembly variant) to precompute GHASH tablesgcm_impl_ops_tto support.ghash,.ghash_4x,.ghash_init, and.needs_htableghashv8, selected automatically when AES and PMULL are availablegcm_init()to initializeHtablewhen required.mulwith.ghashcalls in GHASH macro for modern pathsMotivation and Context
More speed. More! Speed! MOAR!
Description
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by.