-
Notifications
You must be signed in to change notification settings - Fork 131
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
sm4: simd support for armv8, x86_64 #390
base: master
Are you sure you want to change the base?
Conversation
zonyitoo
commented
Nov 3, 2023
- x86_64: aesni, avx2
- armv8: crypto-extension, neon
- x86_64: aesni, avx2 - armv8: crypto-extension, neon
Thank you! It's a relatively sizable PR, so it will take some time for us to properly review it. |
Hello @newpavlov , what do you think about this PR? |
//! SM4 with X86 AES-NI instruction set | ||
//! | ||
//! Implementation was borrowed from <https://www.cnblogs.com/kentle/p/15826075.html> by kentle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found an English description of the approach being used here which helped me understand how this actually works:
https://github.com/mjosaarinen/sm4ni
The trick is to use affine transforms to emulate the SM4 S-Box with the AES S-Box. The S-Boxes are both based on finite field inversion, but use different affine transforms and even polynomial basis for the finite field. However, different polynomial bases are affine isomorphic.
Interesting approach!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
@zonyitoo it looks pretty impressive but as @newpavlov said it is large and because of that hard to review, especially because it contains so many backends in a single PR. We're about to start making some breaking changes and I was looking through to see if we should land this PR first. I think it would probably make sense to try to land this as part of our next breaking release cycle. See #394 |