Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: content/child/webcrypto/shared_crypto.cc

Issue 243433006: [webcrypto] Set the error type for failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and try to fix android build... Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/child/webcrypto/shared_crypto.cc
diff --git a/content/child/webcrypto/shared_crypto.cc b/content/child/webcrypto/shared_crypto.cc
index 0b211492159b4d8e86892fd04386b8013e7cdb61..ee9789547dd5dade06d383621d0cf0a8243b581f 100644
--- a/content/child/webcrypto/shared_crypto.cc
+++ b/content/child/webcrypto/shared_crypto.cc
@@ -127,7 +127,7 @@ Status EncryptRsaEsPkcs1v1_5(const blink::WebCryptoAlgorithm& algorithm,
// RSAES encryption does not support empty input
if (!data.byte_length())
- return Status::Error();
+ return Status::ErrorDataTooSmall();
return platform::EncryptRsaEsPkcs1v1_5(public_key, data, buffer);
}
@@ -143,7 +143,7 @@ Status DecryptRsaEsPkcs1v1_5(const blink::WebCryptoAlgorithm& algorithm,
// RSAES decryption does not support empty input
if (!data.byte_length())
- return Status::Error();
+ return Status::ErrorDataTooSmall();
return platform::DecryptRsaEsPkcs1v1_5(private_key, data, buffer);
}
@@ -222,7 +222,7 @@ Status ImportKeyRaw(const CryptoData& key_data,
case blink::WebCryptoAlgorithmIdAesGcm:
case blink::WebCryptoAlgorithmIdAesKw:
if (!IsValidAesKeyLengthBytes(key_data.byte_length()))
- return Status::Error();
+ return Status::ErrorImportAesKeyLength();
// Fallthrough intentional!
case blink::WebCryptoAlgorithmIdHmac:
return platform::ImportKeyRaw(
@@ -466,8 +466,8 @@ Status UnwrapKeyDecryptAndImport(
format, CryptoData(buffer), algorithm, extractable, usage_mask, key);
// NOTE! Returning the details of any ImportKey() failure here would leak
// information about the plaintext internals of the encrypted key. Instead,
- // collapse any error into the generic Status::Error().
- return status.IsError() ? Status::Error() : Status::Success();
+ // collapse any error into the generic Status::OperationError().
+ return status.IsError() ? Status::OperationError() : Status::Success();
}
Status WrapKeyExportAndEncrypt(
« no previous file with comments | « content/child/webcrypto/platform_crypto_openssl.cc ('k') | content/child/webcrypto/shared_crypto_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698