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

Side by Side Diff: crypto/signature_verifier_openssl.cc

Issue 707973007: Cleanup: Don't check for negative values from EVP_DigestVerifyFinal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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) 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 data_part, data_part_len); 115 data_part, data_part_len);
116 DCHECK_EQ(rv, 1); 116 DCHECK_EQ(rv, 1);
117 } 117 }
118 118
119 bool SignatureVerifier::VerifyFinal() { 119 bool SignatureVerifier::VerifyFinal() {
120 DCHECK(verify_context_); 120 DCHECK(verify_context_);
121 OpenSSLErrStackTracer err_tracer(FROM_HERE); 121 OpenSSLErrStackTracer err_tracer(FROM_HERE);
122 int rv = EVP_DigestVerifyFinal(verify_context_->ctx.get(), 122 int rv = EVP_DigestVerifyFinal(verify_context_->ctx.get(),
123 vector_as_array(&signature_), 123 vector_as_array(&signature_),
124 signature_.size()); 124 signature_.size());
125 // rv is -1 if a DER-encoded ECDSA signature cannot be decoded correctly. 125 DCHECK_GE(rv, 0);
davidben 2014/11/11 18:09:43 Does DCHECK_EQ(!!rv, rv) work, or does it get grum
eroman 2014/11/11 18:54:58 Done. Works locally, will see if the commit queue
126 DCHECK_GE(rv, -1);
127 Reset(); 126 Reset();
128 return rv == 1; 127 return rv == 1;
129 } 128 }
130 129
131 bool SignatureVerifier::CommonInit(const EVP_MD* digest, 130 bool SignatureVerifier::CommonInit(const EVP_MD* digest,
132 const uint8* signature, 131 const uint8* signature,
133 int signature_len, 132 int signature_len,
134 const uint8* public_key_info, 133 const uint8* public_key_info,
135 int public_key_info_len, 134 int public_key_info_len,
136 EVP_PKEY_CTX** pkey_ctx) { 135 EVP_PKEY_CTX** pkey_ctx) {
(...skipping 15 matching lines...) Expand all
152 return rv == 1; 151 return rv == 1;
153 } 152 }
154 153
155 void SignatureVerifier::Reset() { 154 void SignatureVerifier::Reset() {
156 delete verify_context_; 155 delete verify_context_;
157 verify_context_ = NULL; 156 verify_context_ = NULL;
158 signature_.clear(); 157 signature_.clear();
159 } 158 }
160 159
161 } // namespace crypto 160 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698