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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, nullptr)) | 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::Create(signature_algorithm_tlv, nullptr); |
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: |
336 case net::DigestAlgorithm::Sha256: | 336 case net::DigestAlgorithm::Sha256: |
337 digest_evp_md = EVP_sha256(); | 337 digest_evp_md = EVP_sha256(); |
338 break; | 338 break; |
339 | 339 |
(...skipping 17 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 |