瀏覽代碼

Add check for PCLMUL instruction too. Virtually all CPUs with AES-NI have it but good to be sure.

Adam Ierymenko 6 年之前
父節點
當前提交
8faaaec710
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      node/AES.cpp

+ 1 - 1
node/AES.cpp

@@ -62,7 +62,7 @@ static bool _zt_aesni_supported()
 		: "=a"(eax),"=b"(ebx),"=c"(ecx),"=d"(edx)
 		: "=a"(eax),"=b"(ebx),"=c"(ecx),"=d"(edx)
 		: "a"(1),"c"(0)
 		: "a"(1),"c"(0)
 	);
 	);
-	return ((ecx & (1 << 25)) != 0);
+	return (((ecx & (1 << 25)) != 0) && ((ecx & (1 << 1)) != 0)); // check for both AES-NI and PCLMUL
 #endif
 #endif
 }
 }
 const bool AES::HW_ACCEL = _zt_aesni_supported();
 const bool AES::HW_ACCEL = _zt_aesni_supported();