]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Remove cipher_kt_t and change type to const char* in API
authorArne Schwabe <arne@rfc2549.org>
Mon, 13 Dec 2021 15:06:53 +0000 (16:06 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 13 Dec 2021 17:20:49 +0000 (18:20 +0100)
commitce2954a0ca3f352df8d1492f5a2f2f809d309918
tree444f13f9cc5173bc06baa8c24b39961646cc5506
parentbae0945d598891883b8676116c801ad72c5d1b27
Remove cipher_kt_t and change type to const char* in API

Make the external crypto consumer oblivious to the internal cipher
type that both mbed TLS and OpenSSL use. This change is mainly done
so the cipher type that is used can be stay a const type but instead
of an SSL library type, we now use a simple string to identify a
cipher. This has the disadvantages that we do a cipher lookup every
time a function is called that needs to query properties of a cipher.
But none of these queries are in a critical path.

This patch also fixes the memory leaks introduced by the
EVP_fetch_cipher commit by always freeing the EVP_CIPHER.

This also changes kt->cipher to be always defined with the name of
the cipher. This only affects the "none" cipher cipher which was
previously represented by kt->cipher to be NULL.

Patch v2: rebase on master

Patch v3: fix errors with mbed TLS without having md_kt to const char *
          patch also applied, fix logic inversion in tls_crypt_tk

Patch v4: fix issue if cipher does not get changed by NCP that null cipher
          is then used

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211213150654.3993358-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211213150654.3993358-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
17 files changed:
src/openvpn/auth_token.c
src/openvpn/crypto.c
src/openvpn/crypto.h
src/openvpn/crypto_backend.h
src/openvpn/crypto_mbedtls.c
src/openvpn/crypto_mbedtls.h
src/openvpn/crypto_openssl.c
src/openvpn/crypto_openssl.h
src/openvpn/init.c
src/openvpn/openssl_compat.h
src/openvpn/openvpn.h
src/openvpn/options.c
src/openvpn/ssl.c
src/openvpn/ssl_ncp.c
src/openvpn/tls_crypt.c
tests/unit_tests/openvpn/test_crypto.c
tests/unit_tests/openvpn/test_ncp.c