aboutsummaryrefslogtreecommitdiff
path: root/core/crypto
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2024-07-16 20:03:20 +0900
committerYawning Angel <yawning@schwanenlied.me>2024-08-10 18:32:37 +0900
commitdfc4df9807b37477c0bc03e6f628039254681390 (patch)
treed3af582b62c43f1f2ae4b356a27af9b435bfdb96 /core/crypto
parentb9293334cabdf3ae1c35db94c75fd5d1ca709149 (diff)
core/crypto/_aes/hw_intel: Use a constant for the PSHUFB indicies
Diffstat (limited to 'core/crypto')
-rw-r--r--core/crypto/_aes/hw_intel/api.odin2
-rw-r--r--core/crypto/_aes/hw_intel/ghash.odin8
2 files changed, 3 insertions, 7 deletions
diff --git a/core/crypto/_aes/hw_intel/api.odin b/core/crypto/_aes/hw_intel/api.odin
index 5cb5a68bb..1796bb093 100644
--- a/core/crypto/_aes/hw_intel/api.odin
+++ b/core/crypto/_aes/hw_intel/api.odin
@@ -3,7 +3,7 @@ package aes_hw_intel
import "core:sys/info"
-// is_supporte returns true iff hardware accelerated AES
+// is_supported returns true iff hardware accelerated AES
// is supported.
is_supported :: proc "contextless" () -> bool {
features, ok := info.cpu_features.?
diff --git a/core/crypto/_aes/hw_intel/ghash.odin b/core/crypto/_aes/hw_intel/ghash.odin
index 9a5208523..39351393f 100644
--- a/core/crypto/_aes/hw_intel/ghash.odin
+++ b/core/crypto/_aes/hw_intel/ghash.odin
@@ -25,7 +25,6 @@ package aes_hw_intel
import "base:intrinsics"
import "core:crypto/_aes"
-import "core:simd"
import "core:simd/x86"
@(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.
@(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")
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