Skip to content

Commit

Permalink
Bug 1287711 - Remove RSA premaster secret from keylog file, r=mt
Browse files Browse the repository at this point in the history
Since the master secret is logged via "CLIENT_RANDOM", there is little
reason to log the RSA premaster secret.

Differential Revision: https://phabricator.services.mozilla.com/D85

--HG--
extra : amend_source : 60a02f0ed6f53c83f82013f451cff179f74a50e7
  • Loading branch information
martinthomson committed Oct 3, 2017
1 parent 07d50b5 commit 7e8450f
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions lib/ssl/ssl3con.c
Expand Up @@ -6054,35 +6054,14 @@ ssl3_SendRSAClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
goto loser;
}

#ifdef NSS_ALLOW_SSLKEYLOGFILE
if (ssl_keylog_iob) {
#ifdef TRACE
if (ssl_trace >= 100) {
SECStatus extractRV = PK11_ExtractKeyValue(pms);
if (extractRV == SECSuccess) {
SECItem *keyData = PK11_GetKeyData(pms);
if (keyData && keyData->data && keyData->len) {
#ifdef TRACE
if (ssl_trace >= 100) {
ssl_PrintBuf(ss, "Pre-Master Secret",
keyData->data, keyData->len);
}
#endif
if (ssl_keylog_iob && enc_pms.len >= 8 && keyData->len == 48) {
/* https://developer.mozilla.org/en/NSS_Key_Log_Format */

/* There could be multiple, concurrent writers to the
* keylog, so we have to do everything in a single call to
* fwrite. */
char buf[4 + 8 * 2 + 1 + 48 * 2 + 1];

strcpy(buf, "RSA ");
hexEncode(buf + 4, enc_pms.data, 8);
buf[20] = ' ';
hexEncode(buf + 21, keyData->data, 48);
buf[sizeof(buf) - 1] = '\n';

fwrite(buf, sizeof(buf), 1, ssl_keylog_iob);
fflush(ssl_keylog_iob);
}
ssl_PrintBuf(ss, "Pre-Master Secret",
keyData->data, keyData->len);
}
}
}
Expand Down

0 comments on commit 7e8450f

Please sign in to comment.