summaryrefslogtreecommitdiff
path: root/src/lib/tls/tortls_nss.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/tls/tortls_nss.c')
-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;
}