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

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

Issue 361193003: Eliminate ScopedOpenSSL in favour of scoped_ptr<> specializations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/cert/cert_verify_proc_openssl.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ct_log_verifier.h" 5 #include "net/cert/ct_log_verifier.h"
6 6
7 #include <openssl/evp.h> 7 #include <openssl/evp.h>
8 #include <openssl/x509.h> 8 #include <openssl/x509.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "crypto/openssl_util.h" 11 #include "crypto/openssl_util.h"
12 #include "crypto/scoped_openssl_types.h"
12 #include "crypto/sha2.h" 13 #include "crypto/sha2.h"
13 #include "net/cert/signed_tree_head.h" 14 #include "net/cert/signed_tree_head.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 namespace { 18 namespace {
18 19
19 const EVP_MD* GetEvpAlg(ct::DigitallySigned::HashAlgorithm alg) { 20 const EVP_MD* GetEvpAlg(ct::DigitallySigned::HashAlgorithm alg) {
20 switch (alg) { 21 switch (alg) {
21 case ct::DigitallySigned::HASH_ALGO_MD5: 22 case ct::DigitallySigned::HASH_ALGO_MD5:
(...skipping 26 matching lines...) Expand all
48 49
49 CTLogVerifier::CTLogVerifier() 50 CTLogVerifier::CTLogVerifier()
50 : hash_algorithm_(ct::DigitallySigned::HASH_ALGO_NONE), 51 : hash_algorithm_(ct::DigitallySigned::HASH_ALGO_NONE),
51 signature_algorithm_(ct::DigitallySigned::SIG_ALGO_ANONYMOUS), 52 signature_algorithm_(ct::DigitallySigned::SIG_ALGO_ANONYMOUS),
52 public_key_(NULL) {} 53 public_key_(NULL) {}
53 54
54 bool CTLogVerifier::Init(const base::StringPiece& public_key, 55 bool CTLogVerifier::Init(const base::StringPiece& public_key,
55 const base::StringPiece& description) { 56 const base::StringPiece& description) {
56 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); 57 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
57 58
58 crypto::ScopedOpenSSL<BIO, BIO_free_all> bio( 59 crypto::ScopedBIO bio(
59 BIO_new_mem_buf(const_cast<char*>(public_key.data()), public_key.size())); 60 BIO_new_mem_buf(const_cast<char*>(public_key.data()), public_key.size()));
60 if (!bio.get()) 61 if (!bio.get())
61 return false; 62 return false;
62 63
63 public_key_ = d2i_PUBKEY_bio(bio.get(), NULL); 64 public_key_ = d2i_PUBKEY_bio(bio.get(), NULL);
64 if (!public_key_) 65 if (!public_key_)
65 return false; 66 return false;
66 67
67 key_id_ = crypto::SHA256HashString(public_key); 68 key_id_ = crypto::SHA256HashString(public_key);
68 description_ = description.as_string(); 69 description_ = description.as_string();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 1 == EVP_DigestVerifyFinal( 113 1 == EVP_DigestVerifyFinal(
113 &ctx, 114 &ctx,
114 reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data())), 115 reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data())),
115 signature.size())); 116 signature.size()));
116 117
117 EVP_MD_CTX_cleanup(&ctx); 118 EVP_MD_CTX_cleanup(&ctx);
118 return ok; 119 return ok;
119 } 120 }
120 121
121 } // namespace net 122 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc_openssl.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698