Skip to content

Commit

Permalink
Bug 1183318, Allow applications to disable logging of TLS/SSL key mat…
Browse files Browse the repository at this point in the history
…erial, r=martin.thomson
  • Loading branch information
kaie committed Apr 21, 2016
1 parent b754cd0 commit 459b03f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ssl/ssl3con.c
Expand Up @@ -6350,6 +6350,7 @@ sendRSAClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
goto loser;
}

#ifndef DISABLE_SSLKEYLOGFILE
if (ssl_keylog_iob) {
SECStatus extractRV = PK11_ExtractKeyValue(pms);
if (extractRV == SECSuccess) {
Expand Down Expand Up @@ -6381,6 +6382,7 @@ sendRSAClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
}
}
}
#endif

rv = ssl3_AppendHandshakeHeader(ss, client_key_exchange,
isTLS ? enc_pms.len + 2
Expand Down Expand Up @@ -11674,6 +11676,7 @@ ssl3_SendNextProto(sslSocket *ss)
static void
ssl3_RecordKeyLog(sslSocket *ss)
{
#ifndef DISABLE_SSLKEYLOGFILE
SECStatus rv;
SECItem *keyData;
char buf[14 /* "CLIENT_RANDOM " */ +
Expand Down Expand Up @@ -11724,6 +11727,7 @@ ssl3_RecordKeyLog(sslSocket *ss)
return;
fflush(ssl_keylog_iob);
return;
#endif
}

/* called from ssl3_SendClientSecondRound
Expand Down
6 changes: 6 additions & 0 deletions lib/ssl/sslsock.c
Expand Up @@ -127,7 +127,11 @@ int ssl_lock_readers = 1; /* default true. */
char ssl_debug;
char ssl_trace;
FILE *ssl_trace_iob;

#ifndef DISABLE_SSLKEYLOGFILE
FILE *ssl_keylog_iob;
#endif

char lockStatus[] = "Locks are ENABLED. ";
#define LOCKSTATUS_OFFSET 10 /* offset of ENABLED */

Expand Down Expand Up @@ -3361,6 +3365,7 @@ ssl_SetDefaultsFromEnvironment(void)
SSL_TRACE(("SSL: debugging set to %d", ssl_debug));
}
#endif /* DEBUG */
#ifndef DISABLE_SSLKEYLOGFILE
ev = PR_GetEnvSecure("SSLKEYLOGFILE");
if (ev && ev[0]) {
ssl_keylog_iob = fopen(ev, "a");
Expand All @@ -3374,6 +3379,7 @@ ssl_SetDefaultsFromEnvironment(void)
SSL_TRACE(("SSL: logging SSL/TLS secrets to %s", ev));
}
}
#endif
#ifndef NO_PKCS11_BYPASS
ev = PR_GetEnvSecure("SSLBYPASS");
if (ev && ev[0]) {
Expand Down

0 comments on commit 459b03f

Please sign in to comment.