summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-03-29 13:38:14 -0400
committerteor <teor@torproject.org>2019-04-06 11:06:22 +1000
commit680fd3f8fb7157432398a3552ee9c98c72bd7397 (patch)
tree6959ab895666bf16e2c09b33fb171d6d523d0ff5 /src/lib
parent3b9e3cca94dbeb083bfd64dfd4eb22a905cd2748 (diff)
downloadtor-680fd3f8fb7157432398a3552ee9c98c72bd7397.tar.gz
tor-680fd3f8fb7157432398a3552ee9c98c72bd7397.zip
NSS: Log an error message when SSL_ExportKeyingMaterial() fails
Diagnostic for 29241.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/tls/tortls_nss.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/tls/tortls_nss.c b/src/lib/tls/tortls_nss.c
index 00c4af0e97..4e107fae7b 100644
--- a/src/lib/tls/tortls_nss.c
+++ b/src/lib/tls/tortls_nss.c
@@ -726,10 +726,18 @@ tor_tls_export_key_material,(tor_tls_t *tls, uint8_t *secrets_out,
tor_assert(context_len <= UINT_MAX);
SECStatus s;
+ /* Make sure that the error code is set here, so that we can be sure that
+ * any error code set after a failure was in fact caused by
+ * SSL_ExportKeyingMaterial. */
+ PR_SetError(PR_UNKNOWN_ERROR, 0);
s = SSL_ExportKeyingMaterial(tls->ssl,
label, (unsigned)strlen(label),
PR_TRUE, context, (unsigned)context_len,
secrets_out, DIGEST256_LEN);
+ if (s != SECSuccess) {
+ tls_log_errors(tls, LOG_WARN, LD_CRYPTO,
+ "exporting key material for a TLS handshake");
+ }
return (s == SECSuccess) ? 0 : -1;
}