commit 273de864d0a8b4541cbc8c2d38820c9bf5eeb6fd Author: Bernard Spil Date: Wed Aug 31 14:56:35 2016 +0200 Fix build issues with LibreSSL LibreSSL defines OPENSSL_VERSION_NUMBER 0x20000000L breaking checks for e.g. OpenSSL 1.1.0. Additionnaly LibreSSL defines LIBRESSL_VERSION_NUMBER which is used in these patches. Signed-off-by: Bernard Spil diff --git a/openssl-esp.c b/openssl-esp.c index 2c1aa49..c41c0d4 100644 --- a/openssl-esp.c +++ b/openssl-esp.c @@ -27,7 +27,7 @@ #include #include -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) #define EVP_CIPHER_CTX_free(c) do { \ EVP_CIPHER_CTX_cleanup(c); \ @@ -85,7 +85,7 @@ static int init_esp_ciphers(struct openconnect_info *vpninfo, struct esp *esp, } EVP_CIPHER_CTX_set_padding(esp->cipher, 0); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) esp->hmac = malloc(sizeof(*esp->hmac)); esp->pkt_hmac = malloc(sizeof(*esp->pkt_hmac)); if (!esp->hmac || &esp->pkt_hmac) { diff --git a/openssl.c b/openssl.c index 3d90436..2bf7e71 100644 --- a/openssl.c +++ b/openssl.c @@ -36,7 +36,7 @@ #include #include -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) #define X509_up_ref(x) CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509) #define X509_get0_notAfter(x) X509_get_notAfter(x) #define EVP_MD_CTX_new EVP_MD_CTX_create @@ -1068,7 +1068,7 @@ static int set_peer_cert_hash(struct openconnect_info *vpninfo) return 0; } -#if OPENSSL_VERSION_NUMBER < 0x10002000L +#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined (LIBRESSL_VERSION_NUMBER) static int match_hostname_elem(const char *hostname, int helem_len, const char *match, int melem_len) {