| 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/cert/x509_util_openssl.h" | 5 #include "net/cert/x509_util_openssl.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <openssl/asn1.h> | 8 #include <openssl/asn1.h> |
| 9 #include <openssl/digest.h> | 9 #include <openssl/digest.h> |
| 10 #include <openssl/mem.h> | 10 #include <openssl/mem.h> |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 std::string der_encoded_certificate; | 315 std::string der_encoded_certificate; |
| 316 if (!X509Certificate::GetDEREncoded(certificate.os_cert_handle(), | 316 if (!X509Certificate::GetDEREncoded(certificate.os_cert_handle(), |
| 317 &der_encoded_certificate)) | 317 &der_encoded_certificate)) |
| 318 return false; | 318 return false; |
| 319 | 319 |
| 320 der::Input tbs_certificate_tlv; | 320 der::Input tbs_certificate_tlv; |
| 321 der::Input signature_algorithm_tlv; | 321 der::Input signature_algorithm_tlv; |
| 322 der::BitString signature_value; | 322 der::BitString signature_value; |
| 323 if (!ParseCertificate(der::Input(&der_encoded_certificate), | 323 if (!ParseCertificate(der::Input(&der_encoded_certificate), |
| 324 &tbs_certificate_tlv, &signature_algorithm_tlv, | 324 &tbs_certificate_tlv, &signature_algorithm_tlv, |
| 325 &signature_value)) | 325 &signature_value, nullptr)) |
| 326 return false; | 326 return false; |
| 327 | 327 |
| 328 std::unique_ptr<SignatureAlgorithm> signature_algorithm = | 328 std::unique_ptr<SignatureAlgorithm> signature_algorithm = |
| 329 SignatureAlgorithm::CreateFromDer(signature_algorithm_tlv); | 329 SignatureAlgorithm::CreateFromDer(signature_algorithm_tlv); |
| 330 if (!signature_algorithm) | 330 if (!signature_algorithm) |
| 331 return false; | 331 return false; |
| 332 | 332 |
| 333 const EVP_MD* digest_evp_md = nullptr; | 333 const EVP_MD* digest_evp_md = nullptr; |
| 334 switch (signature_algorithm->digest()) { | 334 switch (signature_algorithm->digest()) { |
| 335 case net::DigestAlgorithm::Sha1: | 335 case net::DigestAlgorithm::Sha1: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 357 | 357 |
| 358 digest.resize(out_size); | 358 digest.resize(out_size); |
| 359 token->assign(kChannelBindingPrefix); | 359 token->assign(kChannelBindingPrefix); |
| 360 token->append(digest.begin(), digest.end()); | 360 token->append(digest.begin(), digest.end()); |
| 361 return true; | 361 return true; |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace x509_util | 364 } // namespace x509_util |
| 365 | 365 |
| 366 } // namespace net | 366 } // namespace net |
| OLD | NEW |