]> git.ipfire.org Git - thirdparty/openvpn.git/commit
mbedtls: add RFC 5705 keying material exporter support
authorSteffan Karger <steffan@karger.me>
Sun, 10 Nov 2019 23:10:18 +0000 (00:10 +0100)
committerGert Doering <gert@greenie.muc.de>
Sun, 19 Jan 2020 16:28:17 +0000 (17:28 +0100)
commitab27c9f77b7cd10d530b3c6380465322969a9d21
treef78d71dc738f967346bbdb6a0dc4c98104eb03e6
parent36215dc5c3e08a935392460ab236030d6d9cde8b
mbedtls: add RFC 5705 keying material exporter support

Since mbed TLS 2.18, mbed TLS can also implement RFC 5705. As a first
step towards using the keying material exporter as a method to generate
key material for the data channel, implement the
--keying-material-exporter function we already have for OpenSSL also for
mbed TLS builds.

Implementing RFC 5705 for mbed TLS is a bit more cumbersome, because the
library itself only provides a callback that is called during connection
setup, which enables us to implement RFC 5705 ourselves. To protect
ourselves against mistakes, we immediately perform the required key
derivation to generate the exporterd keying material, and only cache the
derived key material until we can actually export it to the environment
(similar to the OpenSSL builds).

To test this, I found it easiest to temporarily move the call to
key_state_export_keying_material outside the if statement, and use a
script that runs after connection setup (e.g. --ipchange) that prints
the environment. E.g.

  #!/bin/sh
  env | sort

This should show the same value for the exported_keying_material env
variable for both mbed TLS and OpenSSL builds. Of course you can also
use the code as-is, and write a plugin to verify the same thing.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20191110231018.30621-1-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19111.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c
src/openvpn/options.c
src/openvpn/options.h
src/openvpn/ssl_mbedtls.c
src/openvpn/ssl_mbedtls.h
src/openvpn/ssl_openssl.c
src/openvpn/syshead.h