OLD | NEW |
---|---|
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/webcrypto_util.h" | 5 #include "content/child/webcrypto/webcrypto_util.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 return Status::Success(); | 222 return Status::Success(); |
223 | 223 |
224 // BoringSSL does not support 192-bit AES. | 224 // BoringSSL does not support 192-bit AES. |
225 if (keylen_bytes == 24) | 225 if (keylen_bytes == 24) |
226 return Status::ErrorAes192BitUnsupported(); | 226 return Status::ErrorAes192BitUnsupported(); |
227 | 227 |
228 return Status::ErrorImportAesKeyLength(); | 228 return Status::ErrorImportAesKeyLength(); |
229 } | 229 } |
230 | 230 |
231 Status CheckKeyCreationUsages(blink::WebCryptoKeyUsageMask all_possible_usages, | 231 Status CheckKeyCreationUsages(blink::WebCryptoKeyUsageMask all_possible_usages, |
232 blink::WebCryptoKeyUsageMask actual_usages) { | 232 blink::WebCryptoKeyUsageMask actual_usages, |
233 bool checkImportEmptyUsage) { | |
Habib Virji
2014/12/09 10:21:53
Have initialized this variable to false by default
| |
234 // In case import key calls this function, it checks for empty usage | |
235 if (checkImportEmptyUsage && actual_usages == 0) | |
236 return Status::ErrorImportKeyEmptyUsages(); | |
237 | |
233 if (!ContainsKeyUsages(all_possible_usages, actual_usages)) | 238 if (!ContainsKeyUsages(all_possible_usages, actual_usages)) |
234 return Status::ErrorCreateKeyBadUsages(); | 239 return Status::ErrorCreateKeyBadUsages(); |
235 return Status::Success(); | 240 return Status::Success(); |
236 } | 241 } |
237 | 242 |
238 Status GetRsaKeyGenParameters( | 243 Status GetRsaKeyGenParameters( |
239 const blink::WebCryptoRsaHashedKeyGenParams* params, | 244 const blink::WebCryptoRsaHashedKeyGenParams* params, |
240 unsigned int* public_exponent, | 245 unsigned int* public_exponent, |
241 unsigned int* modulus_length_bits) { | 246 unsigned int* modulus_length_bits) { |
242 *modulus_length_bits = params->modulusLengthBits(); | 247 *modulus_length_bits = params->modulusLengthBits(); |
(...skipping 15 matching lines...) Expand all Loading... | |
258 // avoid feeding OpenSSL data that will hang use a whitelist. | 263 // avoid feeding OpenSSL data that will hang use a whitelist. |
259 if (*public_exponent != 3 && *public_exponent != 65537) | 264 if (*public_exponent != 3 && *public_exponent != 65537) |
260 return Status::ErrorGenerateKeyPublicExponent(); | 265 return Status::ErrorGenerateKeyPublicExponent(); |
261 | 266 |
262 return Status::Success(); | 267 return Status::Success(); |
263 } | 268 } |
264 | 269 |
265 } // namespace webcrypto | 270 } // namespace webcrypto |
266 | 271 |
267 } // namespace content | 272 } // namespace content |
OLD | NEW |