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

Side by Side Diff: net/cert/x509_util_openssl.cc

Issue 2349093002: Change the interface for parsing SignatureAlgorithm to take a (Closed)
Patch Set: rebase Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « net/cert/internal/verify_signed_data_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/cert/internal/verify_signed_data_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698