Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM64 support #20

Closed
sunoru opened this issue Dec 21, 2023 · 4 comments · Fixed by #21
Closed

ARM64 support #20

sunoru opened this issue Dec 21, 2023 · 4 comments · Fixed by #21

Comments

@sunoru
Copy link
Member

sunoru commented Dec 21, 2023

Currently the implementation of AES-NI and ARM completely depends on the AES-NI instruction sets (llvm.x86.aesni.*) provided by Intel processors. As Apple Silicon becomes very popular, it would be very nice if ARM64 platforms can also be supported.

@pthariensflame
Copy link
Contributor

pthariensflame commented Dec 21, 2023

I have a WIP branch doing the conversion, but tests are failing at the moment. Part of what makes this more difficult than it should be is that while both Arm(64) and x86(_64) have their own acceleration instructions for AES, those instructions do different things. (Arm breaks them into smaller and more flexible pieces than x86 does and omits the keygen facilities completely.)

Trying to rebuild the x86 versions from the Arm versions has indeed been done in projects like SIMD-Everywhere and SSE2NEON, but consulting those hasn't helped me make things work; the algorithms in this package rely on some pretty specific aspects of the x86 implementation it seems. The original C++ version of Random123 also doesn't support Arm intrinsics, so we'd be the first to try this.

@pthariensflame
Copy link
Contributor

pthariensflame commented Dec 21, 2023

If you want to play around it with, the LLVM intrinsics for 64-bit Arm AES acceleration are llvm.aarch64.crypto.aes*, where the * is one of e, d, mc, or imc. Any 64-bit Arm machine with NIST crypto (FEAT_AES) enabled should execute those just fine; even a RasPi 4 or 5, or a legacy AWS Graviton 1 instance, would do.

EDIT: Or QEMU!

@sunoru
Copy link
Member Author

sunoru commented Dec 21, 2023

Thank you so much! The suggestions look really helpful and I will also look into them.

@pthariensflame
Copy link
Contributor

@sunoru See #21! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants