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

Unified Diff: Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 779723002: WebCrypto: Add parsing for the algorithm parameter AesDerivedKey. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add override Created 6 years 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
« no previous file with comments | « no previous file | Source/platform/exported/WebCryptoAlgorithm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/NormalizeAlgorithm.cpp
diff --git a/Source/modules/crypto/NormalizeAlgorithm.cpp b/Source/modules/crypto/NormalizeAlgorithm.cpp
index 625130c5dd830ae34a788c86823cc2e29e38b01d..1f1d99b957f9986935c1f78e7975616b7946f420 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.cpp
+++ b/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -760,6 +760,21 @@ bool parseEcdhKeyDeriveParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmPa
return true;
}
+// Defined by the WebCrypto spec as:
+//
+// dictionary AesDerivedKeyParams : Algorithm {
+// [EnforceRange] required unsigned short length;
+// };
+bool parseAesDerivedKeyParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error)
+{
+ uint16_t length;
+ if (!getUint16(raw, "length", length, context, error))
+ return false;
+
+ params = adoptPtr(new WebCryptoAesDerivedKeyParams(length));
+ return true;
+}
+
bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType type, OwnPtr<WebCryptoAlgorithmParams>& params, ErrorContext& context, AlgorithmError* error)
{
switch (type) {
@@ -807,6 +822,9 @@ bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType ty
case WebCryptoAlgorithmParamsTypeEcdhKeyDeriveParams:
context.add("EcdhKeyDeriveParams");
return parseEcdhKeyDeriveParams(raw, params, context, error);
+ case WebCryptoAlgorithmParamsTypeAesDerivedKeyParams:
+ context.add("AesDerivedKeyParams");
+ return parseAesDerivedKeyParams(raw, params, context, error);
}
ASSERT_NOT_REACHED();
return false;
« no previous file with comments | « no previous file | Source/platform/exported/WebCryptoAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698