OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/socket/nss_ssl_util.h" | 5 #include "net/socket/nss_ssl_util.h" |
6 | 6 |
7 #include <nss.h> | 7 #include <nss.h> |
8 #include <secerr.h> | 8 #include <secerr.h> |
9 #include <ssl.h> | 9 #include <ssl.h> |
10 #include <sslerr.h> | 10 #include <sslerr.h> |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 case SEC_ERROR_EXTRA_INPUT: | 350 case SEC_ERROR_EXTRA_INPUT: |
351 return ERR_SSL_BAD_PEER_PUBLIC_KEY; | 351 return ERR_SSL_BAD_PEER_PUBLIC_KEY; |
352 // During renegotiation, the server presented a different certificate than | 352 // During renegotiation, the server presented a different certificate than |
353 // was used earlier. | 353 // was used earlier. |
354 case SSL_ERROR_WRONG_CERTIFICATE: | 354 case SSL_ERROR_WRONG_CERTIFICATE: |
355 return ERR_SSL_SERVER_CERT_CHANGED; | 355 return ERR_SSL_SERVER_CERT_CHANGED; |
356 case SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT: | 356 case SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT: |
357 return ERR_SSL_INAPPROPRIATE_FALLBACK; | 357 return ERR_SSL_INAPPROPRIATE_FALLBACK; |
358 | 358 |
359 default: { | 359 default: { |
360 const char* pr_error = PR_ErrorToName(err); | 360 const char* err_name = PR_ErrorToName(err); |
361 if (pr_error == NULL) | 361 if (err_name == NULL) |
362 pr_error = ""; | 362 err_name = ""; |
363 if (IS_SSL_ERROR(err)) { | 363 if (IS_SSL_ERROR(err)) { |
364 LOG(WARNING) << "Unknown SSL error " << err << " (" << pr_error << ")" | 364 LOG(WARNING) << "Unknown SSL error " << err << " (" << err_name << ")" |
365 << " mapped to net::ERR_SSL_PROTOCOL_ERROR"; | 365 << " mapped to net::ERR_SSL_PROTOCOL_ERROR"; |
366 return ERR_SSL_PROTOCOL_ERROR; | 366 return ERR_SSL_PROTOCOL_ERROR; |
367 } | 367 } |
368 LOG(WARNING) << "Unknown error " << err << " (" << pr_error << ")" | 368 LOG(WARNING) << "Unknown error " << err << " (" << err_name << ")" |
369 << " mapped to net::ERR_FAILED"; | 369 << " mapped to net::ERR_FAILED"; |
370 return ERR_FAILED; | 370 return ERR_FAILED; |
371 } | 371 } |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 // Returns parameters to attach to the NetLog when we receive an error in | 375 // Returns parameters to attach to the NetLog when we receive an error in |
376 // response to a call to an NSS function. Used instead of | 376 // response to a call to an NSS function. Used instead of |
377 // NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR. | 377 // NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR. |
378 base::Value* NetLogSSLFailedNSSFunctionCallback( | 378 base::Value* NetLogSSLFailedNSSFunctionCallback( |
(...skipping 14 matching lines...) Expand all Loading... |
393 const char* param) { | 393 const char* param) { |
394 DCHECK(function); | 394 DCHECK(function); |
395 DCHECK(param); | 395 DCHECK(param); |
396 net_log.AddEvent( | 396 net_log.AddEvent( |
397 NetLog::TYPE_SSL_NSS_ERROR, | 397 NetLog::TYPE_SSL_NSS_ERROR, |
398 base::Bind(&NetLogSSLFailedNSSFunctionCallback, | 398 base::Bind(&NetLogSSLFailedNSSFunctionCallback, |
399 function, param, PR_GetError())); | 399 function, param, PR_GetError())); |
400 } | 400 } |
401 | 401 |
402 } // namespace net | 402 } // namespace net |
OLD | NEW |