I currently use a Pi 2 as my OpenVPN server at home. I bought a Pi 3 to see if it was much faster, especially because it should have hardware accelerated AES crypto (hardware crypto features are included in the ARM Cortex-A53, I believe).
I think I've succeeded in compiling and installing the cryptodev-linux
kernel module, and I think I've managed to build a working OpenSSL which uses the cryptodev engine.
But the results of speed tests are confusing. Do they look right? How come the (hopefully) accelerated version has such short times, if it's supposed to run for 3 seconds?
First, the stock openssl, as provided in the latest Raspbian Jessie Lite:
pi@raspberrypi3:~ $ openssl speed -evp aes-256-cbc
Doing aes-256-cbc for 3s on 16 size blocks: 5543752 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 64 size blocks: 1629278 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 256 size blocks: 424968 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 1024 size blocks: 107249 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 8192 size blocks: 13438 aes-256-cbc's in 3.00s
OpenSSL 1.0.1k 8 Jan 2015
built on: Tue Mar 1 16:38:12 2016
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) blowfish(ptr)
compiler: -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-256-cbc 29566.68k 34757.93k 36263.94k 36607.66k 36694.70k
Next, the compiled openssl, with cryptodev engine enabled:
pi@raspberrypi3:~ $ /usr/local/ssl/bin/openssl speed -evp aes-256-cbc
Doing aes-256-cbc for 3s on 16 size blocks: 596490 aes-256-cbc's in 0.25s
Doing aes-256-cbc for 3s on 64 size blocks: 424524 aes-256-cbc's in 0.24s
Doing aes-256-cbc for 3s on 256 size blocks: 200017 aes-256-cbc's in 0.09s
Doing aes-256-cbc for 3s on 1024 size blocks: 64655 aes-256-cbc's in 0.05s
Doing aes-256-cbc for 3s on 8192 size blocks: 8710 aes-256-cbc's in 0.00s
OpenSSL 1.0.2g 1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) idea(int) blowfish(ptr)
compiler: gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -march=armv7-a -Wa,--noexecstack -O3 -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-256-cbc 38175.36k 113206.40k 568937.24k 1324134.40k infk
I'm relatively new to the compilation of kernels and modules etc... so it's been a steep learning curve trying to get this working - and I'm still not sure if I've succeeded or not!