OpenVPN - OpenSSL cryptodev failure. How to throubleshoot
Posted: Fri Dec 29, 2017 5:01 am
I'm trying to use the AES engine build into then Mediatek MT7628 SoC. The OS is the latest Lede (OpenWRT) build. It is using OpenVPN 2.4.4 in combination with OpenSSL 1.0.2n. The cryptodev module is v1.9. All compiled from source using the Lede toolchains.
Encrypting and Decrypting a file using the OpenSSL-utils is working normally. To ensure no defects in the hardware-engine cross-checked by encrypting using HW and decrypting using software and visa-versa. Doing a compare between the original file and the decrypted output.
I want to use it with OpenVPN but I can't seem to be able to figure out where it goes wrong. It seems buffer-related, but I'm not an expert/developer.
I modified the crypto.c the dirty way to give me some more clues by outputting the buffer length cause that seemed the be my primary problem. I also changed the starting "for-loop" to 100 to rule out very small packages. The first run, shows my source and output buffer are the same but the test still fails. The next run shows different errors but all have a "0" buffer lenght in common.
For reference the discussion about this on the Lede-forum: https://forum.lede-project.org/t/openvp ... ot/10008/7
Encrypting and Decrypting a file using the OpenSSL-utils is working normally. To ensure no defects in the hardware-engine cross-checked by encrypting using HW and decrypting using software and visa-versa. Doing a compare between the original file and the decrypted output.
I want to use it with OpenVPN but I can't seem to be able to figure out where it goes wrong. It seems buffer-related, but I'm not an expert/developer.
I modified the crypto.c the dirty way to give me some more clues by outputting the buffer length cause that seemed the be my primary problem. I also changed the starting "for-loop" to 100 to rule out very small packages. The first run, shows my source and output buffer are the same but the test still fails. The next run shows different errors but all have a "0" buffer lenght in common.
For reference the discussion about this on the Lede-forum: https://forum.lede-project.org/t/openvp ... ot/10008/7
Code: Select all
root@OpenWrt:/tmp# openvpn --test-crypto --secret key --cipher AES-256-CBC --engine cryptodev
Sun Dec 17 11:56:01 2017 disabling NCP mode (--ncp-disable) because not in P2MP client or server mode
Sun Dec 17 11:56:01 2017 OpenVPN 2.4.4 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Sun Dec 17 11:56:02 2017 library versions: OpenSSL 1.0.2n 7 Dec 2017, LZO 2.10
Sun Dec 17 11:56:02 2017 OpenVPN 2.4.4 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Sun Dec 17 11:56:03 2017 Initializing OpenSSL support for engine 'cryptodev'
Sun Dec 17 11:56:03 2017 Entering OpenVPN crypto self-test mode.
Sun Dec 17 11:56:03 2017 TESTING ENCRYPT/DECRYPT of packet length=100
Sun Dec 17 11:56:03 2017 OpenVPNEnc. buf.len=148
Sun Dec 17 11:56:03 2017 OpenVPNDec buf.len=100
Sun Dec 17 11:56:03 2017 SELF TEST FAILED, pos=0 in=87 out=75
Sun Dec 17 11:56:03 2017 Exiting due to fatal error
root@OpenWrt:/tmp# openvpn --test-crypto --secret key --cipher AES-256-CBC --engine cryptodev
Sun Dec 17 11:56:44 2017 disabling NCP mode (--ncp-disable) because not in P2MP client or server mode
Sun Dec 17 11:56:44 2017 OpenVPN 2.4.4 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Sun Dec 17 11:56:44 2017 library versions: OpenSSL 1.0.2n 7 Dec 2017, LZO 2.10
Sun Dec 17 11:56:44 2017 OpenVPN 2.4.4 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Sun Dec 17 11:56:45 2017 Initializing OpenSSL support for engine 'cryptodev'
Sun Dec 17 11:56:45 2017 Entering OpenVPN crypto self-test mode.
Sun Dec 17 11:56:45 2017 TESTING ENCRYPT/DECRYPT of packet length=100
Sun Dec 17 11:56:45 2017 OpenVPNEnc. buf.len=148
Sun Dec 17 11:56:45 2017 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #3800655692 / time = (2990300221) Tue Aug 28 16:28:45 1928 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
Sun Dec 17 11:56:45 2017 OpenVPNDec buf.len=0
Sun Dec 17 11:56:45 2017 SELF TEST FAILED, src.len=100 buf.len=0
Sun Dec 17 11:56:45 2017 Exiting due to fatal error
root@OpenWrt:/tmp# openvpn --test-crypto --secret key --cipher AES-256-CBC --engine cryptodev
Sun Dec 17 11:56:51 2017 disabling NCP mode (--ncp-disable) because not in P2MP client or server mode
Sun Dec 17 11:56:51 2017 OpenVPN 2.4.4 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Sun Dec 17 11:56:51 2017 library versions: OpenSSL 1.0.2n 7 Dec 2017, LZO 2.10
Sun Dec 17 11:56:51 2017 OpenVPN 2.4.4 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
Sun Dec 17 11:56:52 2017 Initializing OpenSSL support for engine 'cryptodev'
Sun Dec 17 11:56:52 2017 Entering OpenVPN crypto self-test mode.
Sun Dec 17 11:56:52 2017 TESTING ENCRYPT/DECRYPT of packet length=100
Sun Dec 17 11:56:52 2017 OpenVPNEnc. buf.len=148
Sun Dec 17 11:56:52 2017 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #2887217725 / time = (4121479353) Fri Jul 3 00:54:17 1964 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
Sun Dec 17 11:56:52 2017 OpenVPNDec buf.len=0
Sun Dec 17 11:56:52 2017 SELF TEST FAILED, src.len=100 buf.len=0
Sun Dec 17 11:56:52 2017 Exiting due to fatal error
root@OpenWrt:/tmp#