1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-17 12:53:54 +02:00
openwrt-packages/net/chaosvpn/patches/010-openssl-deprecated.patch
Rosen Penev 0b16458cf4 chaosvpn: Fix compilation without deprecated OpenSSL APIs
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2018-12-13 14:33:22 -08:00

48 lines
1.1 KiB
Diff

--- a/crypto.c
+++ b/crypto.c
@@ -14,6 +14,12 @@
#include <openssl/pem.h>
#include <openssl/ssl.h>
+#ifndef OPENSSL_VERSION
+#define OPENSSL_VERSION SSLEAY_VERSION
+#define OpenSSL_version(x) SSLeay_version(x)
+#define OpenSSL_version_num SSLeay
+#endif
+
/*
This checks data in a struct string against a signature in a second
@@ -250,14 +256,18 @@ bail_out:
void
crypto_init(void)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
/* Just load the crypto library error strings, not SSL */
ERR_load_crypto_strings();
+#endif
}
void
crypto_finish(void)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
ERR_free_strings();
+#endif
}
void
@@ -268,10 +278,10 @@ crypto_warn_openssl_version_changed(void)
* OpenSSL library used.
* Output a warning if not.
*/
- if (SSLeay() != OPENSSL_VERSION_NUMBER) {
+ if (OpenSSL_version_num() != OPENSSL_VERSION_NUMBER) {
log_info("Note: compiled using OpenSSL version '%s' headers, but linked to "
"OpenSSL version '%s' library",
OPENSSL_VERSION_TEXT,
- SSLeay_version(SSLEAY_VERSION));
+ OpenSSL_version(OPENSSL_VERSION));
}
}