我使用的是 iMX8MP EVK 和 imx-yocto-L5.10.52。
首先,测试openssl:
root@imx8mpevk:~# openssl speed sha256
Doing sha256 for 3s on 16 size blocks: 11536688 sha256's in 3.00s
Doing sha256 for 3s on 64 size blocks: 8664550 sha256's in 3.00s
Doing sha256 for 3s on 256 size blocks: 5114298 sha256's in 2.99s
Doing sha256 for 3s on 1024 size blocks: 1932152 sha256's in 3.00s
Doing sha256 for 3s on 8192 size blocks: 284675 sha256's in 3.00s
Doing sha256 for 3s on 16384 size blocks: 144224 sha256's in 3.00s
OpenSSL 1.1.1k 25 Mar 2021
built on: Thu Mar 25 13:28:38 2021 UTC
op
tions:bn(64,64) rc4(char) des(int) aes(partial) blowfish(ptr)
compiler: aarch64-poky-linux-gcc -mcpu=cortex-a53 -march=armv8-a+crc+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes
sha256 61529.00k 184843.73k 437879.69k 659507.88k 777352.53k 787655.34k
然后,使用 cryptodev 引擎测试 openssl:
root@imx8mpevk:~# modprobe cryptodev
[ 151.419636] cryptodev: loading out-of-tree module taints kernel.
[ 151.420713] cryptodev: driver 1.12 loaded.
root@imx8mpevk:~# openssl engine
(devcrypto) /dev/crypto engine
(dynamic) Dynamic engine loading support
root@imx8mpevk:~# openssl speed -engine devcrypto sha256
engine "devcrypto" set.
Doing sha256 for 3s on 16 size blocks: 11536289 sha256's in 3.00s
Doing sha256 for 3s on 64 size blocks: 8664651 sha256's in 3.00s
Doing sha256 for 3s on 256 size blocks: 5114791 sha256's in 3.00s
Doing sha256 for 3s on 1024 size blocks: 1917203 sha256's in 2.99s
Doing sha256 for 3s on 8192 size blocks: 284712 sha256's in 3.00s
Doing sha256 for 3s on 16384 size blocks: 144242 sha256's in 3.00s
OpenSSL 1.1.1k 25 Mar 2021
built on: Thu Mar 25 13:28:38 2021 UTC
options:bn(64,64) rc4(char) des(int) aes(partial) blowfish(ptr)
compiler: aarch64-poky-linux-gcc -mcpu=cortex-a53 -march=armv8-a+crc+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes
sha256 61526.87k 184845.89k 436462.17k 656593.94k 777453.57k 787753.64k
测试结果一样!
为什么 cryptodev 没有提高 openssl 的性能?
如何测试 caam 对 openssl 的性能提升?