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

sm4: simd support for armv8, x86_64 #390

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zonyitoo
Copy link

@zonyitoo zonyitoo commented Nov 3, 2023

  • x86_64: aesni, avx2
  • armv8: crypto-extension, neon

@newpavlov
Copy link
Member

Thank you! It's a relatively sizable PR, so it will take some time for us to properly review it.

@zonyitoo
Copy link
Author

Hello @newpavlov , what do you think about this PR?

Comment on lines +1 to +3
//! SM4 with X86 AES-NI instruction set
//!
//! Implementation was borrowed from <https://www.cnblogs.com/kentle/p/15826075.html> by kentle.
Copy link
Member

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!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is.

@tarcieri
Copy link
Member

@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

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 this pull request may close these issues.

3 participants