diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/keylog-env.c | 15 | ||||
-rwxr-xr-x | tests/keylog-env.sh | 32 |
3 files changed, 37 insertions, 16 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 34e3c5a970..efef919e38 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -105,7 +105,7 @@ noinst_LTLIBRARIES = libutils.la libutils_la_SOURCES = utils.h utils.c seccomp.c utils-adv.c libutils_la_LIBADD = ../lib/libgnutls.la -indirect_tests = tls13/prf-early system-override-hash system-override-sig +indirect_tests = tls13/prf-early system-override-hash system-override-sig keylog-env ctests = tls13/supported_versions tls13/tls12-no-tls13-exts \ tls13/post-handshake-with-cert tls13/post-handshake-without-cert \ @@ -191,7 +191,7 @@ ctests += mini-record-2 simple gnutls_hmac_fast set_pkcs12_cred cert certuniquei set_x509_key_file_der set_x509_pkcs12_key crt_apis tls12-cert-key-exchange \ tls11-cert-key-exchange tls10-cert-key-exchange ssl30-cert-key-exchange \ dtls12-cert-key-exchange dtls10-cert-key-exchange x509-cert-callback-legacy \ - keylog-env ssl2-hello tlsfeature-ext dtls-rehandshake-cert-2 dtls-session-ticket-lost \ + ssl2-hello tlsfeature-ext dtls-rehandshake-cert-2 dtls-session-ticket-lost \ tlsfeature-crt dtls-rehandshake-cert-3 resume-with-false-start \ set_x509_key_file_ocsp client-fastopen rng-sigint srp rng-pthread \ safe-renegotiation/srn0 safe-renegotiation/srn1 safe-renegotiation/srn2 \ @@ -492,7 +492,7 @@ dist_check_SCRIPTS += fastopen.sh pkgconfig.sh starttls.sh starttls-ftp.sh start ocsp-tests/ocsp-test cipher-listings.sh sni-hostname.sh server-multi-keys.sh \ psktool.sh ocsp-tests/ocsp-load-chain gnutls-cli-save-data.sh gnutls-cli-debug.sh \ sni-resume.sh ocsp-tests/ocsptool cert-reencoding.sh pkcs7-cat.sh long-crl.sh \ - serv-udp.sh logfile-option.sh gnutls-cli-resume.sh profile-tests.sh + serv-udp.sh logfile-option.sh gnutls-cli-resume.sh profile-tests.sh keylog-env.sh if !DISABLE_SYSTEM_CONFIG dist_check_SCRIPTS += system-override-sig-hash.sh system-override-versions.sh system-override-invalid.sh \ diff --git a/tests/keylog-env.c b/tests/keylog-env.c index 5f5f74e176..bdc079f868 100644 --- a/tests/keylog-env.c +++ b/tests/keylog-env.c @@ -98,16 +98,6 @@ static void run(const char *filename, const char *prio, const char **p; int ret; -#ifdef _WIN32 - { - char buf[512]; - snprintf(buf, sizeof(buf), "SSLKEYLOGFILE=%s", filename); - _putenv(buf); - } -#else - setenv("SSLKEYLOGFILE", filename, 1); -#endif - if (debug) { gnutls_global_set_log_level(6); gnutls_global_set_log_function(tls_log_func); @@ -151,11 +141,10 @@ static void run(const char *filename, const char *prio, void doit(void) { - char filename[TMPNAME_SIZE]; + const char *filename = getenv("SSLKEYLOGFILE"); - assert(get_tmpname(filename)!=NULL); + assert(filename != NULL); - remove(filename); global_init(); run(filename, diff --git a/tests/keylog-env.sh b/tests/keylog-env.sh new file mode 100755 index 0000000000..6290877d5b --- /dev/null +++ b/tests/keylog-env.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Copyright (C) 2019 Tim Ruehsen +# +# Author: Tim Ruehsen +# +# This file is part of GnuTLS. +# +# GnuTLS is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GnuTLS is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GnuTLS; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +TMPFILE=c.$$.tmp + +export SSLKEYLOGFILE="${TMPFILE}" + +${builddir}/keylog-env +if test $? != 0; then + exit 1 +fi + +exit 0 |