summaryrefslogtreecommitdiff
path: root/src/sslkeylog.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-11-20 18:26:19 +0000
committerPeter Wu <peter@lekensteyn.nl>2019-11-20 18:26:19 +0000
commita8143e50357d796b4f59b58a6add97e2b0c319b1 (patch)
tree8d9a429228beef55ff52d77c948a47005286ad47 /src/sslkeylog.c
parentde25eb75c8d90282ba90396218210c4601603347 (diff)
downloadwireshark-notes-a8143e50357d796b4f59b58a6add97e2b0c319b1.tar.gz
sslkeylog: add macOS support
Tested with macOS 10.15.1 (Catalina). Works with python3 3.7.5 (requests library) and openssl 1.1.1d (s_client) from Homebrew. Does not work with curl 7.64.1 in /usr/bin/curl because it is signed and does not allow DYLD environment variables to be passed when SIP is enabled.
Diffstat (limited to 'src/sslkeylog.c')
-rw-r--r--src/sslkeylog.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/sslkeylog.c b/src/sslkeylog.c
index 3706689..9d176c9 100644
--- a/src/sslkeylog.c
+++ b/src/sslkeylog.c
@@ -9,6 +9,13 @@
* Usage:
* cc sslkeylog.c -shared -o libsslkeylog.so -fPIC -ldl
* SSLKEYLOGFILE=premaster.txt LD_PRELOAD=./libsslkeylog.so openssl ...
+ *
+ * Usage for macOS:
+ * cc sslkeylog.c -shared -o libsslkeylog.dylib -fPIC -ldl \
+ * -I/usr/local/opt/openssl@1.1/include \
+ * -L/usr/local/opt/openssl@1.1/lib -lssl
+ * DYLD_INSERT_LIBRARIES=./libsslkeylog.dylib DYLD_FORCE_FLAT_NAMESPACE=1 \
+ * SSLKEYLOGFILE=premaster.txt /usr/local/opt/openssl@1.1/bin/openssl ...
*/
/*
@@ -39,9 +46,17 @@
#include <stdio.h>
#ifndef OPENSSL_SONAME
-/* fallback library if OpenSSL is not already loaded. Other values to try:
- * libssl.so.0.9.8 libssl.so.1.0.0 libssl.so.1.1 */
+/* fallback library if OpenSSL is not already loaded. */
+# ifdef __APPLE__
+/* libssl.dylib is a symlink, Homebrew installs:
+ * OpenSSL 1.0.2 /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
+ * OpenSSL 1.1.1 /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
+ */
+# define OPENSSL_SONAME "libssl.dylib"
+# else
+/* Other values to try: libssl.so.0.9.8 libssl.so.1.0.0 libssl.so.1.1 */
# define OPENSSL_SONAME "libssl.so"
+# endif
#endif
#define FIRSTLINE "# SSL key logfile generated by sslkeylog.c\n"