mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-10-11 19:13:59 +00:00
Check elf_aux_info() return value in hasFastAes()
Check the result of elf_aux_info() on FreeBSD and OpenBSD ARM and fall back to no AES support if the call fails, rather than relying on the output variable being left untouched.
This commit is contained in:
committed by
Cameron Gutman
parent
8369d1a0e1
commit
a2486eaf94
@@ -222,12 +222,14 @@ bool StreamUtils::hasFastAes()
|
||||
// Everything that runs Catalina and later has AES-NI or ARMv8 crypto instructions
|
||||
return true;
|
||||
#elif (defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 4
|
||||
unsigned long hwcap2 = 0;
|
||||
elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
|
||||
unsigned long hwcap2;
|
||||
if (elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2)) != 0)
|
||||
hwcap2 = 0;
|
||||
return (hwcap2 & HWCAP2_AES);
|
||||
#elif (defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 8
|
||||
unsigned long hwcap = 0;
|
||||
elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
|
||||
unsigned long hwcap;
|
||||
if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) != 0)
|
||||
hwcap = 0;
|
||||
return (hwcap & HWCAP_AES);
|
||||
#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 4
|
||||
return getauxval(AT_HWCAP2) & HWCAP2_AES;
|
||||
|
||||
Reference in New Issue
Block a user