| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 blink::WebCryptoErrorTypeOperation, | 344 blink::WebCryptoErrorTypeOperation, |
| 345 "Length for PBKDF2 key derivation must be a multiple of 8 bits."); | 345 "Length for PBKDF2 key derivation must be a multiple of 8 bits."); |
| 346 } | 346 } |
| 347 | 347 |
| 348 Status Status::ErrorPbkdf2DeriveBitsLengthNotSpecified() { | 348 Status Status::ErrorPbkdf2DeriveBitsLengthNotSpecified() { |
| 349 return Status( | 349 return Status( |
| 350 blink::WebCryptoErrorTypeOperation, | 350 blink::WebCryptoErrorTypeOperation, |
| 351 "No length was specified for the PBKDF2 Derive Bits operation."); | 351 "No length was specified for the PBKDF2 Derive Bits operation."); |
| 352 } | 352 } |
| 353 | 353 |
| 354 Status Status::ErrorPbkdf2DeriveBitsLengthZero() { |
| 355 return Status( |
| 356 blink::WebCryptoErrorTypeOperation, |
| 357 "A length of 0 was specified for PBKDF2's Derive Bits operation."); |
| 358 } |
| 359 |
| 354 Status Status::ErrorPbkdf2Iterations0() { | 360 Status Status::ErrorPbkdf2Iterations0() { |
| 355 return Status(blink::WebCryptoErrorTypeOperation, | 361 return Status(blink::WebCryptoErrorTypeOperation, |
| 356 "PBKDF2 requires iterations > 0"); | 362 "PBKDF2 requires iterations > 0"); |
| 357 } | 363 } |
| 358 | 364 |
| 359 Status::Status(blink::WebCryptoErrorType error_type, | 365 Status::Status(blink::WebCryptoErrorType error_type, |
| 360 const std::string& error_details_utf8) | 366 const std::string& error_details_utf8) |
| 361 : type_(TYPE_ERROR), | 367 : type_(TYPE_ERROR), |
| 362 error_type_(error_type), | 368 error_type_(error_type), |
| 363 error_details_(error_details_utf8) { | 369 error_details_(error_details_utf8) { |
| 364 } | 370 } |
| 365 | 371 |
| 366 Status::Status(Type type) : type_(type) { | 372 Status::Status(Type type) : type_(type) { |
| 367 } | 373 } |
| 368 | 374 |
| 369 } // namespace webcrypto | 375 } // namespace webcrypto |
| OLD | NEW |