OLD | NEW |
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" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 CTLogVerifier::~CTLogVerifier() { | 41 CTLogVerifier::~CTLogVerifier() { |
42 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 42 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
43 | 43 |
44 if (public_key_) | 44 if (public_key_) |
45 EVP_PKEY_free(public_key_); | 45 EVP_PKEY_free(public_key_); |
46 } | 46 } |
47 | 47 |
48 CTLogVerifier::CTLogVerifier() : | 48 CTLogVerifier::CTLogVerifier() |
49 hash_algorithm_(ct::DigitallySigned::HASH_ALGO_NONE), | 49 : hash_algorithm_(ct::DigitallySigned::HASH_ALGO_NONE), |
50 signature_algorithm_(ct::DigitallySigned::SIG_ALGO_ANONYMOUS), | 50 signature_algorithm_(ct::DigitallySigned::SIG_ALGO_ANONYMOUS), |
51 public_key_(NULL) {} | 51 public_key_(NULL) {} |
52 | 52 |
53 bool CTLogVerifier::Init(const base::StringPiece& public_key, | 53 bool CTLogVerifier::Init(const base::StringPiece& public_key, |
54 const base::StringPiece& description) { | 54 const base::StringPiece& description) { |
55 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 55 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
56 | 56 |
57 crypto::ScopedOpenSSL<BIO, BIO_free_all> bio( | 57 crypto::ScopedOpenSSL<BIO, BIO_free_all> bio( |
58 BIO_new_mem_buf(const_cast<char*>(public_key.data()), public_key.size())); | 58 BIO_new_mem_buf(const_cast<char*>(public_key.data()), public_key.size())); |
59 if (!bio.get()) | 59 if (!bio.get()) |
60 return false; | 60 return false; |
61 | 61 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 1 == EVP_DigestVerifyFinal( | 111 1 == EVP_DigestVerifyFinal( |
112 &ctx, | 112 &ctx, |
113 reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data())), | 113 reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data())), |
114 signature.size())); | 114 signature.size())); |
115 | 115 |
116 EVP_MD_CTX_cleanup(&ctx); | 116 EVP_MD_CTX_cleanup(&ctx); |
117 return ok; | 117 return ok; |
118 } | 118 } |
119 | 119 |
120 } // namespace net | 120 } // namespace net |
OLD | NEW |