* SOFTWARE.
*/
+#define BR_ENABLE_INTRINSICS 1
#include "inner.h"
#if BR_AES_X86NI
-#if BR_AES_X86NI_GCC
-#include <smmintrin.h>
-#include <wmmintrin.h>
-#define bswap32 __builtin_bswap32
-#endif
-
-#if BR_AES_X86NI_MSC
-#include <stdlib.h>
-#include <intrin.h>
-#define bswap32 _byteswap_ulong
-#endif
+/* see bearssl_block.h */
+const br_block_ctr_class *
+br_aes_x86ni_ctr_get_vtable(void)
+{
+ return br_aes_x86ni_supported() ? &br_aes_x86ni_ctr_vtable : NULL;
+}
/* see bearssl_block.h */
void
ctx->num_rounds = br_aes_x86ni_keysched_enc(ctx->skey.skni, key, len);
}
+BR_TARGETS_X86_UP
+
/* see bearssl_block.h */
BR_TARGET("sse2,sse4.1,aes")
uint32_t
while (len > 0) {
__m128i x0, x1, x2, x3;
- x0 = _mm_insert_epi32(ivx, bswap32(cc + 0), 3);
- x1 = _mm_insert_epi32(ivx, bswap32(cc + 1), 3);
- x2 = _mm_insert_epi32(ivx, bswap32(cc + 2), 3);
- x3 = _mm_insert_epi32(ivx, bswap32(cc + 3), 3);
+ x0 = _mm_insert_epi32(ivx, br_bswap32(cc + 0), 3);
+ x1 = _mm_insert_epi32(ivx, br_bswap32(cc + 1), 3);
+ x2 = _mm_insert_epi32(ivx, br_bswap32(cc + 2), 3);
+ x3 = _mm_insert_epi32(ivx, br_bswap32(cc + 3), 3);
x0 = _mm_xor_si128(x0, sk[0]);
x1 = _mm_xor_si128(x1, sk[0]);
x2 = _mm_xor_si128(x2, sk[0]);
return cc;
}
+BR_TARGETS_X86_DOWN
+
/* see bearssl_block.h */
const br_block_ctr_class br_aes_x86ni_ctr_vtable = {
sizeof(br_aes_x86ni_ctr_keys),
&br_aes_x86ni_ctr_run
};
-/* see bearssl_block.h */
-const br_block_ctr_class *
-br_aes_x86ni_ctr_get_vtable(void)
-{
- return br_aes_x86ni_supported() ? &br_aes_x86ni_ctr_vtable : NULL;
-}
-
#else
/* see bearssl_block.h */