hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit e512d3d42dcfd2c9a5dcfca0c7c536e301d61eb7
parent c32f97583b5bf9aca2a6a460c2c565b66f39b78c
Author: Lorenz (xha) <me@xha.li>
Date:   Thu,  7 Dec 2023 06:47:31 +0100

crypto::aes check for AVX before using the native interface

Signed-off-by: Lorenz (xha) <me@xha.li>

Diffstat:
Mcrypto/aes/+x86_64/ni.ha | 2+-
Mrt/+x86_64/cpuid.ha | 1+
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/aes/+x86_64/ni.ha b/crypto/aes/+x86_64/ni.ha @@ -21,7 +21,7 @@ const x86ni_vtable: cipher::blockvtable = cipher::blockvtable { // Checks if the native AES interface is available. fn x86ni_available() bool = { - return rt::cpuid_hasflags(0, rt::cpuid_ecxflag::AES); + return rt::cpuid_hasflags(0, rt::cpuid_ecxflag::AES | rt::cpuid_ecxflag::AVX); }; // Returns a native AES [[crypto::cipher::block]] implementation for x86_64 diff --git a/rt/+x86_64/cpuid.ha b/rt/+x86_64/cpuid.ha @@ -65,6 +65,7 @@ export type cpuid_edxflag = enum uint { export type cpuid_ecxflag = enum uint { SSE3 = 1 << 0, AES = 1 << 25, + AVX = 1 << 28, }; fn cpuid_getvendorstr(v: *[12]u8) void;