Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

openssl AES-NI on freebsd 8.0 says illegal instructions

64 views
Skip to first unread message

Jeseem S

unread,
Oct 3, 2010, 7:20:42 PM10/3/10
to
Hi
  I am trying to run aesni on latest openssl from head on a freebsd machine with cpu ( xeon 5620 , which supports AESNI ).

running the command "openssl speed -evp aes256 -engine aesni
It doesn't look like the aesni engine is being used as I see no performance improvement.

I found the check for enabling engine wasn't triggered and so bypassed it as below
--- eng_aesni.c.orig 2010-10-03 23:18:09.000000000 -0700
+++ eng_aesni.c 2010-10-03 23:03:45.000000000 -0700
@@ -329,6 +329,7 @@
  IA32CAP OPENSSL_ia32_cpuid(void);
  engage = (OPENSSL_ia32_cpuid() >> 57) & 1;
  }
+ engage=1;
 
  /* Register everything or return with an error */
  if (!ENGINE_set_id(e, aesni_id) ||



However am hitting following error
aesni engine added
To get the most accurate results, try to run this
program when this computer is idle.
Doing aes-256-cbc for 3s on 16 size blocks: Illegal instruction

Any ideas.
 the os is freebsd 8.0, gcc is 4.4 and as is 2.19

thanks
jeseem

sergio borghese

unread,
Oct 4, 2010, 5:39:54 AM10/4/10
to
Hi Jeseem,

are you sure that the cpu you are using has AESNI enabled?
The toolchain you are using is definitly correct, but the fact that the engine check was not triggered sounds like your SKU has the instraction disabled.

You can do a check on the CPU with the below code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <cpuid.h>

int Check_CPU_support_AES()
{
#if defined(__INTEL_COMPILER)
    int CPUInfo[4] = {-1};
    __cpuid(CPUInfo, 1);
    return (CPUInfo[2] & 0x2000000);
#else
    unsigned int a=1,b,c,d;
    __cpuid(1, a,b,c,d);
    return (c & 0x2000000);
#endif
}


int main()
{
    printf("AESNI support: %X \n", Check_CPU_support_AES());
    return 0;
}

Hope this helps

Best Regards
Sergio
--
preferisco ammazzare il tempo,
preferisco sparare cazzate,
preferisco fare esplodere una moda,
preferisco morire d'amore.
(Caparezza)

0 new messages