diff options
author | Emmanuel Deloget | 2017-06-12 15:43:27 +0200 |
---|---|---|
committer | Gert Doering | 2017-06-18 14:52:37 +0200 |
commit | c481ef002803f360743c72727ae3ca971ce59a5d (patch) | |
tree | c11e9cf0e9980798483db01faef89d99109a6dd0 /src/openvpn/openssl_compat.h | |
parent | 21a540f92bf65f39eb92967476eba0bcd2a34ef6 (diff) | |
download | openvpn-c481ef002803f360743c72727ae3ca971ce59a5d.zip openvpn-c481ef002803f360743c72727ae3ca971ce59a5d.tar.gz |
OpenSSL: don't use direct access to the internal of EVP_MD_CTX
OpenSSL 1.1 does not allow us to directly access the internal of
any data type, including EVP_MD_CTX. We have to use the defined
functions to do so.
Compatibility with OpenSSL 1.0 is kept by defining the corresponding
functions when they are not found in the library.
Signed-off-by: Emmanuel Deloget <logout@free.fr>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20170612134330.20971-6-logout@free.fr>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14793.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/openssl_compat.h')
-rw-r--r-- | src/openvpn/openssl_compat.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index eeacb52..3d8fad1 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -45,6 +45,49 @@ #include <openssl/ssl.h> #include <openssl/x509.h> +#if !defined(HAVE_EVP_MD_CTX_RESET) +/** + * Reset a message digest context + * + * @param ctx The message digest context + * @return 1 on success, 0 on error + */ +static inline int +EVP_MD_CTX_reset(EVP_MD_CTX *ctx) +{ + EVP_MD_CTX_cleanup(ctx); + return 1; +} +#endif + +#if !defined(HAVE_EVP_MD_CTX_FREE) +/** + * Free an existing message digest context + * + * @param ctx The message digest context + */ +static inline void +EVP_MD_CTX_free(EVP_MD_CTX *ctx) +{ + free(ctx); +} +#endif + +#if !defined(HAVE_EVP_MD_CTX_NEW) +/** + * Allocate a new message digest object + * + * @return A zero'ed message digest object + */ +static inline EVP_MD_CTX * +EVP_MD_CTX_new(void) +{ + EVP_MD_CTX *ctx = NULL; + ALLOC_OBJ_CLEAR(ctx, EVP_MD_CTX); + return ctx; +} +#endif + #if !defined(HAVE_SSL_CTX_GET_DEFAULT_PASSWD_CB_USERDATA) /** * Fetch the default password callback user data from the SSL context |