Skip to content

Commit

Permalink
kerberos5: Fix build with libressl
Browse files Browse the repository at this point in the history
Fixes https://trac.macports.org/ticket/53017

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
  • Loading branch information
jeremyhu authored and anddam committed Dec 21, 2016
1 parent 6a3b024 commit 22190bd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions net/kerberos5/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ worksrcdir ${worksrcdir}/src
patchfiles patch-util__verto__Makefile.in-use-nonzero-compat-version.diff \
patch-config__shlib.conf-do-not-pass-dylib-file-ldflags.diff \
patch-lib_rpc_Makefile.in-explicitly-link-krb5support.diff \
libressl.patch \
no-Werror.patch

# AI_NUMERICSERV not available for OS X < 10.6
Expand Down
60 changes: 60 additions & 0 deletions net/kerberos5/files/libressl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff -Naupr krb5-1.15.orig/src/lib/crypto/openssl/crypto_mod.h krb5-1.15/src/lib/crypto/openssl/crypto_mod.h
--- lib/crypto/openssl/crypto_mod.h 2016-12-01 14:31:24.000000000 -0800
+++ lib/crypto/openssl/crypto_mod.h 2016-12-16 23:51:41.000000000 -0800
@@ -39,7 +39,7 @@

/* 1.1 standardizes constructor and destructor names, renaming
* EVP_MD_CTX_create and EVP_MD_CTX_destroy. */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define EVP_MD_CTX_new EVP_MD_CTX_create
#define EVP_MD_CTX_free EVP_MD_CTX_destroy
#endif
diff -Naupr krb5-1.15.orig/src/lib/crypto/openssl/hmac.c krb5-1.15/src/lib/crypto/openssl/hmac.c
--- lib/crypto/openssl/hmac.c 2016-12-01 14:31:24.000000000 -0800
+++ lib/crypto/openssl/hmac.c 2016-12-16 23:50:49.000000000 -0800
@@ -55,7 +55,7 @@
#include <openssl/hmac.h>
#include <openssl/evp.h>

-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)

/* OpenSSL 1.1 makes HMAC_CTX opaque, while 1.0 does not have pointer
* constructors or destructors. */
diff -Naupr krb5-1.15.orig/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c krb5-1.15/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
--- plugins/preauth/pkinit/pkinit_crypto_openssl.c 2016-12-01 14:31:25.000000000 -0800
+++ plugins/preauth/pkinit/pkinit_crypto_openssl.c 2016-12-16 23:51:55.000000000 -0800
@@ -191,7 +191,7 @@ pkinit_pkcs11_code_to_text(int err);
(*_x509_pp) = PKCS7_cert_from_signer_info(_p7,_si)
#endif

-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)

/* 1.1 standardizes constructor and destructor names, renaming
* EVP_MD_CTX_{create,destroy} and deprecating ASN1_STRING_data. */
diff -Naurp krb5-1.15.orig/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c krb5-1.15/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
--- plugins/preauth/pkinit/pkinit_crypto_openssl.c 2016-12-16 23:54:30.000000000 -0800
+++ plugins/preauth/pkinit/pkinit_crypto_openssl.c 2016-12-16 23:58:00.000000000 -0800
@@ -3059,7 +3059,7 @@ cleanup:
return retval;
}

-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)

/*
* We need to decode DomainParameters from RFC 3279 section 2.3.3. We would
diff -Naurp krb5-1.15.orig/src/plugins/preauth/pkinit/pkinit_crypto_openssl.h krb5-1.15/src/plugins/preauth/pkinit/pkinit_crypto_openssl.h
--- plugins/preauth/pkinit/pkinit_crypto_openssl.h 2016-12-01 14:31:25.000000000 -0800
+++ plugins/preauth/pkinit/pkinit_crypto_openssl.h 2016-12-16 23:58:32.000000000 -0800
@@ -46,7 +46,7 @@
#include <openssl/asn1.h>
#include <openssl/pem.h>

-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
#include <openssl/asn1t.h>
#else
#include <openssl/asn1_mac.h>

0 comments on commit 22190bd

Please sign in to comment.