Chromium Code Reviews| 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/status.h" | 5 #include "content/child/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 content { | 10 namespace content { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 } | 321 } |
| 322 | 322 |
| 323 Status Status::ErrorEcdhLengthTooBig(unsigned int max_length_bits) { | 323 Status Status::ErrorEcdhLengthTooBig(unsigned int max_length_bits) { |
| 324 return Status(blink::WebCryptoErrorTypeOperation, | 324 return Status(blink::WebCryptoErrorTypeOperation, |
| 325 base::StringPrintf( | 325 base::StringPrintf( |
| 326 "Length specified for ECDH key derivation is too large. " | 326 "Length specified for ECDH key derivation is too large. " |
| 327 "Maximum allowed is %u bits", | 327 "Maximum allowed is %u bits", |
| 328 max_length_bits)); | 328 max_length_bits)); |
| 329 } | 329 } |
| 330 | 330 |
| 331 Status Status::ErrorHkdfLengthTooLong() { | |
| 332 return Status(blink::WebCryptoErrorTypeOperation, | |
| 333 "The length provided for HKDF is too large."); | |
| 334 } | |
| 335 | |
| 336 Status Status::ErrorHkdfDeriveBitsLengthNotSpecified() { | |
| 337 // TODO(nharper): The spec might change so that an OperationError should be | |
| 338 // thrown here instead of a TypeError. | |
| 339 // (https://www.w3.org/Bugs/Public/show_bug.cgi?id=27771) If the spec is | |
|
eroman
2015/01/08 02:39:43
nit: The last sentence seems obvious, suggest remo
nharper
2015/01/09 18:35:55
Done.
| |
| 340 // updated, this should be changed from TypeError to OperationError. | |
| 341 return Status(blink::WebCryptoErrorTypeType, | |
| 342 "Length must be specified for deriveBits."); | |
|
eroman
2015/01/08 02:39:43
Can you suggest something better for this wording?
nharper
2015/01/09 18:35:55
How about "No length was specified for the HKDF De
eroman
2015/01/09 19:31:53
Can't you reproduce by calling deriveKey() on HKDF
| |
| 343 } | |
| 344 | |
| 331 Status::Status(blink::WebCryptoErrorType error_type, | 345 Status::Status(blink::WebCryptoErrorType error_type, |
| 332 const std::string& error_details_utf8) | 346 const std::string& error_details_utf8) |
| 333 : type_(TYPE_ERROR), | 347 : type_(TYPE_ERROR), |
| 334 error_type_(error_type), | 348 error_type_(error_type), |
| 335 error_details_(error_details_utf8) { | 349 error_details_(error_details_utf8) { |
| 336 } | 350 } |
| 337 | 351 |
| 338 Status::Status(Type type) : type_(type) { | 352 Status::Status(Type type) : type_(type) { |
| 339 } | 353 } |
| 340 | 354 |
| 341 } // namespace webcrypto | 355 } // namespace webcrypto |
| 342 | 356 |
| 343 } // namespace content | 357 } // namespace content |
| OLD | NEW |