Hey Kaleb,

Yes, that makes perfect sense.

Thanks a lot.
Z.

Hi,

I'm working on a personal project (file encryption) and did some benchmarks on the AES (with and without AESNI).
The software implementation works as expected, got similar encryption and decryption speeds.

Library built with:

./autogen.sh
./configure --enable-aescbc
make src/libwolfssl.la

test code built with:

gcc -O3 -Wall -o aes_test aes_enc_dec.c -lwolfssl

Software AES, AMD A4-5050 @ 1.5GHz

> encrypt/AES256/CBC mode: 1178.002 msec,  64 MB,    54 MB/sec [     432.00 mbit/sec |   0.4 gbit/sec ]
> decrypt/AES256/CBC mode: 1146.915 msec,  64 MB,    55 MB/sec [     440.00 mbit/sec |   0.4 gbit/sec ]

Software AES, i7-9880H

> encrypt/AES256/CBC mode: 288.164 msec,  64 MB,   222 MB/sec [    1776.00 mbit/sec |   1.7 gbit/sec ]
> decrypt/AES256/CBC mode: 290.760 msec,  64 MB,   220 MB/sec [    1760.00 mbit/sec |   1.7 gbit/sec ]

Now with AESNI:

Library built with:

./autogen.sh
./configure --enable-aesni --enable-intelasm --enable-intelrand --enable-harden
make src/libwolfssl.la

test code built, as before, with:

gcc -O3 -Wall -o aes_test aes_enc_dec.c -lwolfssl

AESNI, AMD A4-5050 @ 1.5GHz

> encrypt/AES256/CBC mode: 257.483 msec,  64 MB,   248 MB/sec [    1984.00 mbit/sec |   1.9 gbit/sec ]
> decrypt/AES256/CBC mode:  58.154 msec,  64 MB,  1100 MB/sec [    8800.00 mbit/sec |   8.6 gbit/sec ]

AESNI, i7-9880H

> encrypt/AES256/CBC mode:  69.183 msec,  64 MB,   925 MB/sec [    7400.00 mbit/sec |   7.2 gbit/sec ]
> decrypt/AES256/CBC mode:  15.122 msec,  64 MB,  4232 MB/sec [   33856.00 mbit/sec |  33.1 gbit/sec ]

There's a huge performance increase when using AESNI. But I'm curious why the decryption process is more than 4 times faster.
As far as I know the encryption and decryption performance should be more-or-less the same. The software implementation shows this as well.

Is there something I've missed?

Thanks.
Zoli.