Skip to content

Commit

Permalink
openssl: load zlib from an explicit path
Browse files Browse the repository at this point in the history
Load zlib from an explicit path instead of relying on dyld's fallback
path, which is empty in a SIP context. This patch will be unnecessary
when we begin building openssl with no-comp to disable TLS compression.

This helps us load Python's "cryptography" library from system Python.

See https://langui.sh/2015/11/27/sip-and-dlopen for background.

Closes Homebrew/legacy-homebrew#47650.
  • Loading branch information
tdsmith committed Jan 11, 2016
1 parent f27573a commit ab0b764
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Formula/openssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Openssl < Formula
mirror "https://dl.bintray.com/homebrew/mirror/openssl-1.0.2e.tar.gz"
mirror "https://www.mirrorservice.org/sites/ftp.openssl.org/source/openssl-1.0.2e.tar.gz"
sha256 "e23ccafdb75cfcde782da0151731aa2185195ac745eea3846133f2e05c0e0bff"
revision 1

bottle do
sha256 "a49cd2eaaeb44a8ae80bc57204a51890c807d2d13284e68b8c2ca17d1ec0366b" => :el_capitan
Expand Down Expand Up @@ -51,6 +52,14 @@ def configure_args; %W[
end

def install
# Load zlib from an explicit path instead of relying on dyld's fallback
# path, which is empty in a SIP context. This patch will be unnecessary
# when we begin building openssl with no-comp to disable TLS compression.
# https://langui.sh/2015/11/27/sip-and-dlopen
inreplace "crypto/comp/c_zlib.c",
'zlib_dso = DSO_load(NULL, "z", NULL, 0);',
'zlib_dso = DSO_load(NULL, "/usr/lib/libz.dylib", NULL, DSO_FLAG_NO_NAME_TRANSLATION);'

if build.universal?
ENV.permit_arch_flags
archs = Hardware::CPU.universal_archs
Expand Down

0 comments on commit ab0b764

Please sign in to comment.