| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include <openssl/asn1.h> | 7 #include <openssl/asn1.h> |
| 8 #include <openssl/crypto.h> | 8 #include <openssl/crypto.h> |
| 9 #include <openssl/obj_mac.h> | 9 #include <openssl/obj_mac.h> |
| 10 #include <openssl/pem.h> | 10 #include <openssl/pem.h> |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 << " : " << cert_status; | 445 << " : " << cert_status; |
| 446 verify_result->cert_status |= cert_status; | 446 verify_result->cert_status |= cert_status; |
| 447 } | 447 } |
| 448 | 448 |
| 449 if (IsCertStatusError(verify_result->cert_status)) | 449 if (IsCertStatusError(verify_result->cert_status)) |
| 450 return MapCertStatusToNetError(verify_result->cert_status); | 450 return MapCertStatusToNetError(verify_result->cert_status); |
| 451 | 451 |
| 452 return OK; | 452 return OK; |
| 453 } | 453 } |
| 454 | 454 |
| 455 bool X509Certificate::GetDEREncoded(std::string* encoded) { |
| 456 // TODO(port): Implement. |
| 457 return false; |
| 458 } |
| 459 |
| 455 // static | 460 // static |
| 456 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 461 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
| 457 X509Certificate::OSCertHandle b) { | 462 X509Certificate::OSCertHandle b) { |
| 458 DCHECK(a && b); | 463 DCHECK(a && b); |
| 459 if (a == b) | 464 if (a == b) |
| 460 return true; | 465 return true; |
| 461 | 466 |
| 462 // X509_cmp only checks the fingerprint, but we want to compare the whole | 467 // X509_cmp only checks the fingerprint, but we want to compare the whole |
| 463 // DER data. Encoding it from OSCertHandle is an expensive operation, so we | 468 // DER data. Encoding it from OSCertHandle is an expensive operation, so we |
| 464 // cache the DER (if not already cached via X509_set_ex_data). | 469 // cache the DER (if not already cached via X509_set_ex_data). |
| 465 DERCache der_cache_a, der_cache_b; | 470 DERCache der_cache_a, der_cache_b; |
| 466 | 471 |
| 467 return GetDERAndCacheIfNeeded(a, &der_cache_a) && | 472 return GetDERAndCacheIfNeeded(a, &der_cache_a) && |
| 468 GetDERAndCacheIfNeeded(b, &der_cache_b) && | 473 GetDERAndCacheIfNeeded(b, &der_cache_b) && |
| 469 der_cache_a.data_length == der_cache_b.data_length && | 474 der_cache_a.data_length == der_cache_b.data_length && |
| 470 memcmp(der_cache_a.data, der_cache_b.data, der_cache_a.data_length) == 0; | 475 memcmp(der_cache_a.data, der_cache_b.data, der_cache_a.data_length) == 0; |
| 471 } | 476 } |
| 472 | 477 |
| 473 } // namespace net | 478 } // namespace net |
| OLD | NEW |