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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 10332300: Map the client certificate related SSL alerts to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync with the ToT, exclude OBC-related changes Created 8 years, 6 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') | net/socket/ssl_server_socket_nss.cc » ('j') | 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 140812)
+++ net/socket/ssl_client_socket_nss.cc (working copy)
@@ -554,6 +554,36 @@
int ssl_connection_status;
};
+// Client-side error mapping functions.
+
+// Map NSS error code to network error code.
+int MapNSSClientError(PRErrorCode err) {
+ switch (err) {
+ case SSL_ERROR_BAD_CERT_ALERT:
+ case SSL_ERROR_UNSUPPORTED_CERT_ALERT:
+ case SSL_ERROR_REVOKED_CERT_ALERT:
+ case SSL_ERROR_EXPIRED_CERT_ALERT:
+ case SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT:
+ case SSL_ERROR_UNKNOWN_CA_ALERT:
+ case SSL_ERROR_ACCESS_DENIED_ALERT:
+ return ERR_BAD_SSL_CLIENT_AUTH_CERT;
+ default:
+ return MapNSSError(err);
+ }
+}
+
+// Map NSS error code from the first SSL handshake to network error code.
+int MapNSSClientHandshakeError(PRErrorCode err) {
+ switch (err) {
+ // If the server closed on us, it is a protocol error.
+ // Some TLS-intolerant servers do this when we request TLS.
+ case PR_END_OF_FILE_ERROR:
+ return ERR_SSL_PROTOCOL_ERROR;
+ default:
+ return MapNSSClientError(err);
+ }
+}
+
} // namespace
// SSLClientSocketNSS::Core provides a thread-safe, ref-counted core that is
@@ -1830,8 +1860,8 @@
bool handshake_error) {
DCHECK(OnNSSTaskRunner());
- int net_error = handshake_error ? MapNSSHandshakeError(nss_error) :
- MapNSSError(nss_error);
+ int net_error = handshake_error ? MapNSSClientHandshakeError(nss_error) :
+ MapNSSClientError(nss_error);
#if defined(OS_WIN)
// On Windows, a handle to the HCRYPTPROV is cached in the X509Certificate
@@ -2452,9 +2482,10 @@
false,
key,
&public_key)) {
+ int error = MapNSSError(PORT_GetError());
CERT_DestroyCertificate(*cert);
*cert = NULL;
- return MapNSSError(PORT_GetError());
+ return error;
}
SECKEY_DestroyPublicKey(public_key);
break;
« no previous file with comments | « net/socket/nss_ssl_util.cc ('k') | net/socket/ssl_server_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698