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

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

Issue 751883002: Revert of Check that usage isn't empty when generateKey() is called (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
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 "content/child/webcrypto/openssl/rsa_key_openssl.h" 5 #include "content/child/webcrypto/openssl/rsa_key_openssl.h"
6 6
7 #include <openssl/evp.h> 7 #include <openssl/evp.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Status status = CheckKeyCreationUsages( 160 Status status = CheckKeyCreationUsages(
161 all_public_key_usages_ | all_private_key_usages_, combined_usages); 161 all_public_key_usages_ | all_private_key_usages_, combined_usages);
162 if (status.IsError()) 162 if (status.IsError())
163 return status; 163 return status;
164 164
165 const blink::WebCryptoKeyUsageMask public_usages = 165 const blink::WebCryptoKeyUsageMask public_usages =
166 combined_usages & all_public_key_usages_; 166 combined_usages & all_public_key_usages_;
167 const blink::WebCryptoKeyUsageMask private_usages = 167 const blink::WebCryptoKeyUsageMask private_usages =
168 combined_usages & all_private_key_usages_; 168 combined_usages & all_private_key_usages_;
169 169
170 if (private_usages == 0)
171 return Status::ErrorCreateKeyEmptyUsages();
172
173 const blink::WebCryptoRsaHashedKeyGenParams* params = 170 const blink::WebCryptoRsaHashedKeyGenParams* params =
174 algorithm.rsaHashedKeyGenParams(); 171 algorithm.rsaHashedKeyGenParams();
175 172
176 unsigned int public_exponent = 0; 173 unsigned int public_exponent = 0;
177 unsigned int modulus_length_bits = 0; 174 unsigned int modulus_length_bits = 0;
178 status = 175 status =
179 GetRsaKeyGenParameters(params, &public_exponent, &modulus_length_bits); 176 GetRsaKeyGenParameters(params, &public_exponent, &modulus_length_bits);
180 if (status.IsError()) 177 if (status.IsError())
181 return status; 178 return status;
182 179
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 key->algorithm().rsaHashedParams()->publicExponent().size())) { 441 key->algorithm().rsaHashedParams()->publicExponent().size())) {
445 return Status::ErrorUnexpected(); 442 return Status::ErrorUnexpected();
446 } 443 }
447 444
448 return Status::Success(); 445 return Status::Success();
449 } 446 }
450 447
451 } // namespace webcrypto 448 } // namespace webcrypto
452 449
453 } // namespace content 450 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/openssl/ec_key_openssl.cc ('k') | content/child/webcrypto/openssl/sym_key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698