1 files changed, 22 insertions, 0 deletions
diff --git a/src/sslkeylog.sh b/src/sslkeylog.sh
new file mode 100755
@@ -0,0 +1,22 @@
+# Invokes the given command, displaying the pre-master secrets to stderr
+# (or to the file given by envvar SSLKEYLOGFILE).
+# Example usage:
+# SSLKEYLOGFILE=premaster.txt ./sslkeylog.sh curl https://lekensteyn.nl/
+# Do not load the library into gdb or the shell launched by gdb. This prevent
+# crashes when the library is built with -fsanitize=address and such.
+ export -n LD_PRELOAD
+ command gdb -q \
+ -ex 'set startup-with-shell off' \
+ -ex "set environment LD_PRELOAD=$LD_PRELOAD" \
+export LD_PRELOAD=$(dirname "$0")/libsslkeylog.so
+# Run the command