| 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 #ifndef COMPONENTS_WEBCRYPTO_STATUS_H_ | 5 #ifndef COMPONENTS_WEBCRYPTO_STATUS_H_ |
| 6 #define COMPONENTS_WEBCRYPTO_STATUS_H_ | 6 #define COMPONENTS_WEBCRYPTO_STATUS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 // No length parameter was provided for HKDF's Derive Bits operation. | 261 // No length parameter was provided for HKDF's Derive Bits operation. |
| 262 static Status ErrorHkdfDeriveBitsLengthNotSpecified(); | 262 static Status ErrorHkdfDeriveBitsLengthNotSpecified(); |
| 263 | 263 |
| 264 // The requested bit length for PBKDF2 key derivation was invalid. | 264 // The requested bit length for PBKDF2 key derivation was invalid. |
| 265 static Status ErrorPbkdf2InvalidLength(); | 265 static Status ErrorPbkdf2InvalidLength(); |
| 266 | 266 |
| 267 // No length parameter was provided for PBKDF2's Derive Bits operation. | 267 // No length parameter was provided for PBKDF2's Derive Bits operation. |
| 268 static Status ErrorPbkdf2DeriveBitsLengthNotSpecified(); | 268 static Status ErrorPbkdf2DeriveBitsLengthNotSpecified(); |
| 269 | 269 |
| 270 // PBKDF2's deriveBits() was called with an unsupported length of 0. |
| 271 static Status ErrorPbkdf2DeriveBitsLengthZero(); |
| 272 |
| 270 // PBKDF2 was called with iterations == 0. | 273 // PBKDF2 was called with iterations == 0. |
| 271 static Status ErrorPbkdf2Iterations0(); | 274 static Status ErrorPbkdf2Iterations0(); |
| 272 | 275 |
| 273 private: | 276 private: |
| 274 enum Type { TYPE_ERROR, TYPE_SUCCESS }; | 277 enum Type { TYPE_ERROR, TYPE_SUCCESS }; |
| 275 | 278 |
| 276 // Constructs an error with the specified error type and message. | 279 // Constructs an error with the specified error type and message. |
| 277 Status(blink::WebCryptoErrorType error_type, | 280 Status(blink::WebCryptoErrorType error_type, |
| 278 const std::string& error_details_utf8); | 281 const std::string& error_details_utf8); |
| 279 | 282 |
| 280 // Constructs a success or error without any details. | 283 // Constructs a success or error without any details. |
| 281 explicit Status(Type type); | 284 explicit Status(Type type); |
| 282 | 285 |
| 283 Type type_; | 286 Type type_; |
| 284 blink::WebCryptoErrorType error_type_; | 287 blink::WebCryptoErrorType error_type_; |
| 285 std::string error_details_; | 288 std::string error_details_; |
| 286 }; | 289 }; |
| 287 | 290 |
| 288 } // namespace webcrypto | 291 } // namespace webcrypto |
| 289 | 292 |
| 290 #endif // COMPONENTS_WEBCRYPTO_STATUS_H_ | 293 #endif // COMPONENTS_WEBCRYPTO_STATUS_H_ |
| OLD | NEW |