Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1717)

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 27266002: Do not allow the server certificate to change in a renegotiation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Borrow SSL_ERROR_WRONG_CERTIFICATE (not used by NSS), add comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/nss_ssl_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
===================================================================
--- net/socket/ssl_client_socket_nss.cc (revision 228029)
+++ net/socket/ssl_client_socket_nss.cc (working copy)
@@ -1287,6 +1287,19 @@
// Start with it.
SSL_OptionSet(socket, SSL_ENABLE_FALSE_START, PR_FALSE);
}
+ } else {
+ // Disallow the server certificate to change in a renegotiation.
+ CERTCertificate* old_cert = core->nss_handshake_state_.server_cert_chain[0];
+ CERTCertificate* new_cert = SSL_PeerCertificate(socket);
+ if (new_cert->derCert.len != old_cert->derCert.len ||
+ memcmp(new_cert->derCert.data, old_cert->derCert.data,
+ new_cert->derCert.len) != 0) {
+ // NSS doesn't have an error code that indicates the server certificate
+ // changed. Borrow SSL_ERROR_WRONG_CERTIFICATE (which NSS isn't using)
+ // for this purpose.
+ PORT_SetError(SSL_ERROR_WRONG_CERTIFICATE);
+ return SECFailure;
+ }
}
// Tell NSS to not verify the certificate.
« no previous file with comments | « net/socket/nss_ssl_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698