One-liner to check if OpenSSL AES-NI works

Here is a quick single line benchmark command to check if OpenSSL is using AES acceleration. Works on both 32 and 64 bit Intel & AMD CPUs.

The benchmark

OPENSSL_ia32cap="~0x200000200000000" openssl speed -elapsed -evp aes-128-cbc |& grep ^aes && openssl speed -elapsed -evp aes-128-cbc |& grep ^aes

This little benchmark will return two lines, the first line showing aes-128-cbc performance without AES-NI, the second line running your system defaults. The second line should have notiably higher scores.

aes-128-cbc     305364.03k   336685.44k   341990.06k   345230.68k   347564.71k
aes-128-cbc     619026.50k   659893.23k   670590.72k   673323.35k   674010.45k

The results being 1000s of bytes processed for respectively 16, 64, 256, 1024 and 8192 bytes.