This is an automated archive.

The original was posted on /r/openssl by /u/kevkevverson on 2023-07-18 15:58:28+00:00.


My program is spending most of its CPU time in openssl functions (servicing curl https requests) and it looks like it is not using any hardware acceleration. Do I have to explicitly enable this somehow? I have a standard Ubuntu 22 installation with curl/openssl installed via apt.

$ uname -a
Linux 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

It seems like the machine can do it:

$ grep aes /proc/cpuinfo | wc -l
28

But the metrics are the same with and without -evp:

$ openssl speed -elapsed aes-128-cbc 
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-128-cbc for 3s on 16 size blocks: 263113079 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 64 size blocks: 79169247 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 256 size blocks: 20252411 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 5108777 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 8192 size blocks: 631382 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 16384 size blocks: 321626 aes-128-cbc's in 3.00s
version: 3.0.2
built on: Wed May 24 17:12:55 2023 UTC
options: bn(64,64)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -ffile-prefix-map=/build/openssl-Z1YLmC/openssl-3.0.2=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
CPUINFO: OPENSSL_ia32cap=0x7ffef3bfffebffff:0x800d39ef7eb
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-128-cbc    1403269.75k  1688943.94k  1728205.74k  1743795.88k  1724093.78k  1756506.79k

$ openssl speed -elapsed -evp aes-128-cbc 
You have chosen to measure elapsed time instead of user CPU time.
Doing AES-128-CBC for 3s on 16 size blocks: 214679139 AES-128-CBC's in 3.00s
Doing AES-128-CBC for 3s on 64 size blocks: 78848087 AES-128-CBC's in 3.00s
Doing AES-128-CBC for 3s on 256 size blocks: 20372792 AES-128-CBC's in 3.00s
Doing AES-128-CBC for 3s on 1024 size blocks: 4986893 AES-128-CBC's in 3.00s
Doing AES-128-CBC for 3s on 8192 size blocks: 618327 AES-128-CBC's in 3.00s
Doing AES-128-CBC for 3s on 16384 size blocks: 316746 AES-128-CBC's in 3.00s
version: 3.0.2
built on: Wed May 24 17:12:55 2023 UTC
options: bn(64,64)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -ffile-prefix-map=/build/openssl-Z1YLmC/openssl-3.0.2=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
CPUINFO: OPENSSL_ia32cap=0x7ffef3bfffebffff:0x800d39ef7eb
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
AES-128-CBC    1144955.41k  1682092.52k  1738478.25k  1702192.81k  1688444.93k  1729855.49k

What have I missed? Thanks in advance