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
feat: Add _mm_aesdec_si128 #559
Conversation
20a059d
to
6aca545
Compare
@@ -9533,6 +9533,17 @@ FORCE_INLINE __m128i _mm_aesenc_si128(__m128i EncBlock, __m128i RoundKey) | |||
#endif | |||
} | |||
|
|||
FORCE_INLINE __m128i _mm_aesdec_si128(__m128i a, __m128i RoundKey) | |||
{ | |||
#if defined(__aarch64__) |
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.
You shall take the following into consideration:
- Armv8-A without Cryptographic extension
- Armv8-A and A32 with Cryptographic extension
- Armv7-A
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.
It seems we don't have tests for function guarded by "__ARM_FEATURE_CRYPTO" macro. I think maybe I should add another makefile target to run test with +crypto
?
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.
Exactly, we shall have conditional +crypto
in feasible permutations.
5237fda
to
f8c1fde
Compare
// add round key | ||
return vreinterpretq_m128i_u8(w) ^ RoundKey; | ||
#else /* ARMv7-A NEON implementation */ | ||
/* FIXME: optimized for NEON */ |
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.
@jserv the tables for table-based AES algorithm are way too many and huge. Therefore, I am using plain pure C implementation here instead of the table-based AES which is used in _mm_aesenc_si128
.
I am trying to optimize it.
A simple table-based AES needs tables like this https://github.com/iVishalr/AES-Encryption/blob/master/lookup.h
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.
The implementation of both helper_aesenc
and helper_aesdec
are table-based AES. Here are its tables https://github.com/qemu/qemu/blob/266469947161aa10b1d36843580d369d5aa38589/crypto/aes.c
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.
Agree. Let's stick to shorter implementation since Armv7 path exits for compatibility purpose.
3fb144f
to
58c67b6
Compare
eeb2ce0
to
a34db2c
Compare
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.
Resolve the conflicts.
This PR solve solve
_mm_aesdec_si128
of #477This PR referred the following resources.