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 "components/webcrypto/status.h" | 5 #include "components/webcrypto/status.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 | 9 |
10 namespace webcrypto { | 10 namespace webcrypto { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 "Length specified for ECDH key derivation is too large. " | 324 "Length specified for ECDH key derivation is too large. " |
325 "Maximum allowed is %u bits", | 325 "Maximum allowed is %u bits", |
326 max_length_bits)); | 326 max_length_bits)); |
327 } | 327 } |
328 | 328 |
329 Status Status::ErrorHkdfLengthTooLong() { | 329 Status Status::ErrorHkdfLengthTooLong() { |
330 return Status(blink::kWebCryptoErrorTypeOperation, | 330 return Status(blink::kWebCryptoErrorTypeOperation, |
331 "The length provided for HKDF is too large."); | 331 "The length provided for HKDF is too large."); |
332 } | 332 } |
333 | 333 |
| 334 Status Status::ErrorHkdfLengthNotWholeByte() { |
| 335 return Status(blink::kWebCryptoErrorTypeOperation, |
| 336 "The length provided for HKDF is not a multiple of 8 bits."); |
| 337 } |
| 338 |
334 Status Status::ErrorHkdfDeriveBitsLengthNotSpecified() { | 339 Status Status::ErrorHkdfDeriveBitsLengthNotSpecified() { |
335 // TODO(nharper): The spec might change so that an OperationError should be | 340 // TODO(nharper): The spec might change so that an OperationError should be |
336 // thrown here instead of a TypeError. | 341 // thrown here instead of a TypeError. |
337 // (https://www.w3.org/Bugs/Public/show_bug.cgi?id=27771) | 342 // (https://www.w3.org/Bugs/Public/show_bug.cgi?id=27771) |
338 return Status(blink::kWebCryptoErrorTypeType, | 343 return Status(blink::kWebCryptoErrorTypeType, |
339 "No length was specified for the HKDF Derive Bits operation."); | 344 "No length was specified for the HKDF Derive Bits operation."); |
340 } | 345 } |
341 | 346 |
342 Status Status::ErrorPbkdf2InvalidLength() { | 347 Status Status::ErrorPbkdf2InvalidLength() { |
343 return Status( | 348 return Status( |
(...skipping 27 matching lines...) Expand all Loading... |
371 const std::string& error_details_utf8) | 376 const std::string& error_details_utf8) |
372 : type_(TYPE_ERROR), | 377 : type_(TYPE_ERROR), |
373 error_type_(error_type), | 378 error_type_(error_type), |
374 error_details_(error_details_utf8) { | 379 error_details_(error_details_utf8) { |
375 } | 380 } |
376 | 381 |
377 Status::Status(Type type) : type_(type) { | 382 Status::Status(Type type) : type_(type) { |
378 } | 383 } |
379 | 384 |
380 } // namespace webcrypto | 385 } // namespace webcrypto |
OLD | NEW |