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

Side by Side Diff: content/child/webcrypto/openssl/rsa_sign_openssl.cc

Issue 688983004: WebCrypto: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/numerics/safe_math.h" 5 #include "base/numerics/safe_math.h"
6 #include "content/child/webcrypto/crypto_data.h" 6 #include "content/child/webcrypto/crypto_data.h"
7 #include "content/child/webcrypto/openssl/key_openssl.h" 7 #include "content/child/webcrypto/openssl/key_openssl.h"
8 #include "content/child/webcrypto/openssl/rsa_key_openssl.h" 8 #include "content/child/webcrypto/openssl/rsa_key_openssl.h"
9 #include "content/child/webcrypto/openssl/rsa_sign_openssl.h" 9 #include "content/child/webcrypto/openssl/rsa_sign_openssl.h"
10 #include "content/child/webcrypto/openssl/util_openssl.h" 10 #include "content/child/webcrypto/openssl/util_openssl.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return Status::OperationError(); 133 return Status::OperationError();
134 134
135 // Set PSS-specific options (if applicable). 135 // Set PSS-specific options (if applicable).
136 status = ApplyRsaPssOptions(key, digest, pss_salt_length_bytes, pctx); 136 status = ApplyRsaPssOptions(key, digest, pss_salt_length_bytes, pctx);
137 if (status.IsError()) 137 if (status.IsError())
138 return status; 138 return status;
139 139
140 if (!EVP_DigestVerifyUpdate(ctx.get(), data.bytes(), data.byte_length())) 140 if (!EVP_DigestVerifyUpdate(ctx.get(), data.bytes(), data.byte_length()))
141 return Status::OperationError(); 141 return Status::OperationError();
142 142
143 // Note that the return value can be: 143 *signature_match = 1 == EVP_DigestVerifyFinal(ctx.get(), signature.bytes(),
144 // 1 --> Success 144 signature.byte_length());
145 // 0 --> Verification failed 145 return Status::Success();
146 // <0 --> Operation error
147 int rv = EVP_DigestVerifyFinal(
148 ctx.get(), signature.bytes(), signature.byte_length());
149 *signature_match = rv == 1;
150 return rv >= 0 ? Status::Success() : Status::OperationError();
151 } 146 }
152 147
153 } // namespace webcrypto 148 } // namespace webcrypto
154 149
155 } // namespace content 150 } // namespace content
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