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

Side by Side Diff: crypto/signature_verifier_openssl.cc

Issue 948543002: Convert crypto::ScopedOpenSSL to type aliases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « crypto/scoped_openssl_types.h ('k') | extensions/common/cast/cast_cert_validator_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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "crypto/signature_verifier.h" 5 #include "crypto/signature_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 <vector> 10 #include <vector>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Reset(); 43 Reset();
44 } 44 }
45 45
46 bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm, 46 bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm,
47 int signature_algorithm_len, 47 int signature_algorithm_len,
48 const uint8* signature, 48 const uint8* signature,
49 int signature_len, 49 int signature_len,
50 const uint8* public_key_info, 50 const uint8* public_key_info,
51 int public_key_info_len) { 51 int public_key_info_len) {
52 OpenSSLErrStackTracer err_tracer(FROM_HERE); 52 OpenSSLErrStackTracer err_tracer(FROM_HERE);
53 ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free>::Type algorithm( 53 ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free> algorithm(
54 d2i_X509_ALGOR(NULL, &signature_algorithm, signature_algorithm_len)); 54 d2i_X509_ALGOR(NULL, &signature_algorithm, signature_algorithm_len));
55 if (!algorithm.get()) 55 if (!algorithm.get())
56 return false; 56 return false;
57 int nid = OBJ_obj2nid(algorithm.get()->algorithm); 57 int nid = OBJ_obj2nid(algorithm.get()->algorithm);
58 const EVP_MD* digest; 58 const EVP_MD* digest;
59 if (nid == NID_ecdsa_with_SHA1) { 59 if (nid == NID_ecdsa_with_SHA1) {
60 digest = EVP_sha1(); 60 digest = EVP_sha1();
61 } else if (nid == NID_ecdsa_with_SHA256) { 61 } else if (nid == NID_ecdsa_with_SHA256) {
62 digest = EVP_sha256(); 62 digest = EVP_sha256();
63 } else { 63 } else {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return rv == 1; 151 return rv == 1;
152 } 152 }
153 153
154 void SignatureVerifier::Reset() { 154 void SignatureVerifier::Reset() {
155 delete verify_context_; 155 delete verify_context_;
156 verify_context_ = NULL; 156 verify_context_ = NULL;
157 signature_.clear(); 157 signature_.clear();
158 } 158 }
159 159
160 } // namespace crypto 160 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/scoped_openssl_types.h ('k') | extensions/common/cast/cast_cert_validator_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698