|
@@ -25,7 +25,6 @@ package aes_hw_intel
|
|
|
|
|
|
import "base:intrinsics"
|
|
import "base:intrinsics"
|
|
import "core:crypto/_aes"
|
|
import "core:crypto/_aes"
|
|
-import "core:simd"
|
|
|
|
import "core:simd/x86"
|
|
import "core:simd/x86"
|
|
|
|
|
|
@(private = "file")
|
|
@(private = "file")
|
|
@@ -58,14 +57,11 @@ GHASH_STRIDE_BYTES_HW :: GHASH_STRIDE_HW * _aes.GHASH_BLOCK_SIZE
|
|
// chunks. We number chunks from 0 to 3 in left to right order.
|
|
// chunks. We number chunks from 0 to 3 in left to right order.
|
|
|
|
|
|
@(private = "file")
|
|
@(private = "file")
|
|
-byteswap_index := transmute(x86.__m128i)simd.i8x16{
|
|
|
|
- // Note: simd.i8x16 is reverse order from x86._mm_set_epi8.
|
|
|
|
- 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
|
|
|
|
-}
|
|
|
|
|
|
+_BYTESWAP_INDEX: x86.__m128i : { 0x08090a0b0c0d0e0f, 0x0001020304050607 }
|
|
|
|
|
|
@(private = "file", require_results, enable_target_feature = "sse2,ssse3")
|
|
@(private = "file", require_results, enable_target_feature = "sse2,ssse3")
|
|
byteswap :: #force_inline proc "contextless" (x: x86.__m128i) -> x86.__m128i {
|
|
byteswap :: #force_inline proc "contextless" (x: x86.__m128i) -> x86.__m128i {
|
|
- return x86._mm_shuffle_epi8(x, byteswap_index)
|
|
|
|
|
|
+ return x86._mm_shuffle_epi8(x, _BYTESWAP_INDEX)
|
|
}
|
|
}
|
|
|
|
|
|
// From a 128-bit value kw, compute kx as the XOR of the two 64-bit
|
|
// From a 128-bit value kw, compute kx as the XOR of the two 64-bit
|