After a struggle (because I've not done much compilation before), I think I've got cryptodev-linux kernel module working, and I have compiled a fresh OpenSSL from source, with the flags to use cryptodev engine.
I have also compiled OpenVPN to use my new OpenSSL, as OpenVPN is what I want to use the accelerated crypto for.
I have two questions:
1. Do my speed test results below indicate that the hardware crypto is indeed enabled (the times for the accelerated version look odd!)?
2. How do I set up a self-compiled copy of OpenVPN so that it can run as a service etc? (I've always previously used apt-get rather than built it myself, so the init script etc have just been sorted out for me...)
Do I need to install it via apt-get and then overwrite it with my own version?
Here are my speed tests - first with the stock OpenSSL:
Code: Select all
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
Code: Select all
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
Code: Select all
pi@raspberrypi3:/opt/openvpn/sbin $ ./openvpn --version
OpenVPN 2.3.10 armv7l-unknown-linux-gnueabihf [SSL (OpenSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Mar 23 2016
library versions: OpenSSL 1.0.2g 1 Mar 2016, LZO 2.09
Originally developed by James Yonan
Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
Compile time defines: enable_crypto=yes enable_crypto_ofb_cfb=yes enable_debug=yes enable_def_auth=yes enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown enable_fast_install=yes enable_fragment=yes enable_http_proxy=yes enable_iproute2=no enable_libtool_lock=yes enable_lzo=yes enable_lzo_stub=no enable_management=yes enable_multi=yes enable_multihome=yes enable_pam_dlopen=no enable_pedantic=no enable_pf=yes enable_pkcs11=no enable_plugin_auth_pam=yes enable_plugin_down_root=yes enable_plugins=yes enable_port_share=yes enable_selinux=no enable_server=yes enable_shared=yes enable_shared_with_static_runtimes=no enable_small=no enable_socks=yes enable_ssl=yes enable_static=yes enable_strict=no enable_strict_options=no enable_systemd=no enable_win32_dll=yes enable_x509_alt_username=no with_crypto_library=openssl with_gnu_ld=yes with_lzo_headers=/usr/local/include with_lzo_lib=/usr/local/lib with_mem_check=no with_plugindir='$(libdir)/openvpn/plugins' with_sysroot=no