How to check aes-ni are supported by the processor?
I am looking for a solution how to test aes-ni on CPU. I need to put this information into my application, so I'm not looking for any CPU-Z, bash or whatever commands. I know it displays as aes . I have no idea how to check this in assembly or c. The main application is written in C #, but that doesn't matter.
+3
s3ven
source
to share
2 answers
This information is returned by the command cpuid
. Go to eax=1
, and bit # 25 in will ecx
display support. See the intel instruction manual for more details. Sample code:
mov eax, 1
cpuid
test ecx, 1<<25
jz no_aesni
Alternatively, you can just try executing it and catch the exception.
+4
Jester
source
to share
In Visual C ++
static bool GetNNICapability()
{
unsigned int b;
__asm
{
mov eax, 1
cpuid
mov b, ecx
}
return (b & (1 << 25)) != 0;
}
+2
JGU
source
to share