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

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

Issue 757873003: Check that usage isn't empty when generateKey() is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix bad merges Created 6 years 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
170 const blink::WebCryptoRsaHashedKeyGenParams* params = 173 const blink::WebCryptoRsaHashedKeyGenParams* params =
171 algorithm.rsaHashedKeyGenParams(); 174 algorithm.rsaHashedKeyGenParams();
172 175
173 unsigned int public_exponent = 0; 176 unsigned int public_exponent = 0;
174 unsigned int modulus_length_bits = 0; 177 unsigned int modulus_length_bits = 0;
175 status = 178 status =
176 GetRsaKeyGenParameters(params, &public_exponent, &modulus_length_bits); 179 GetRsaKeyGenParameters(params, &public_exponent, &modulus_length_bits);
177 if (status.IsError()) 180 if (status.IsError())
178 return status; 181 return status;
179 182
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 key->algorithm().rsaHashedParams()->publicExponent().size())) { 444 key->algorithm().rsaHashedParams()->publicExponent().size())) {
442 return Status::ErrorUnexpected(); 445 return Status::ErrorUnexpected();
443 } 446 }
444 447
445 return Status::Success(); 448 return Status::Success();
446 } 449 }
447 450
448 } // namespace webcrypto 451 } // namespace webcrypto
449 452
450 } // namespace content 453 } // 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