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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // BoringSSL does not support 192-bit AES. | 215 // BoringSSL does not support 192-bit AES. |
216 if (keylen_bytes == 24) | 216 if (keylen_bytes == 24) |
217 return Status::ErrorAes192BitUnsupported(); | 217 return Status::ErrorAes192BitUnsupported(); |
218 | 218 |
219 return Status::ErrorImportAesKeyLength(); | 219 return Status::ErrorImportAesKeyLength(); |
220 } | 220 } |
221 | 221 |
222 Status CheckKeyCreationUsages(blink::WebCryptoKeyUsageMask all_possible_usages, | 222 Status CheckKeyCreationUsages(blink::WebCryptoKeyUsageMask all_possible_usages, |
223 blink::WebCryptoKeyUsageMask actual_usages) { | 223 blink::WebCryptoKeyUsageMask actual_usages) { |
224 if (!ContainsKeyUsages(all_possible_usages, actual_usages)) | 224 if (!ContainsKeyUsages(all_possible_usages, actual_usages)) |
225 return Status::ErrorCreateKeyBadUsages(); | 225 return Status::SyntaxError("usages"); |
226 return Status::Success(); | 226 return Status::Success(); |
227 } | 227 } |
228 | 228 |
229 Status GetRsaKeyGenParameters( | 229 Status GetRsaKeyGenParameters( |
230 const blink::WebCryptoRsaHashedKeyGenParams* params, | 230 const blink::WebCryptoRsaHashedKeyGenParams* params, |
231 unsigned int* public_exponent, | 231 unsigned int* public_exponent, |
232 unsigned int* modulus_length_bits) { | 232 unsigned int* modulus_length_bits) { |
233 *modulus_length_bits = params->modulusLengthBits(); | 233 *modulus_length_bits = params->modulusLengthBits(); |
234 | 234 |
235 // Limit key sizes to those supported by NSS: | 235 // Limit key sizes to those supported by NSS: |
(...skipping 14 matching lines...) Expand all Loading... |
250 // avoid feeding OpenSSL data that will hang use a whitelist. | 250 // avoid feeding OpenSSL data that will hang use a whitelist. |
251 if (*public_exponent != 3 && *public_exponent != 65537) | 251 if (*public_exponent != 3 && *public_exponent != 65537) |
252 return Status::ErrorGenerateKeyPublicExponent(); | 252 return Status::ErrorGenerateKeyPublicExponent(); |
253 | 253 |
254 return Status::Success(); | 254 return Status::Success(); |
255 } | 255 } |
256 | 256 |
257 } // namespace webcrypto | 257 } // namespace webcrypto |
258 | 258 |
259 } // namespace content | 259 } // namespace content |
OLD | NEW |