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

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

Issue 657243002: [webcrypto] Add parameter parsing for RSA-PSS. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/bindings/core/v8/SerializedScriptValue.cpp ('k') | 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 a7e1d28b9835d9292dd4106fad2181f8344a19a4..53c8c555bcf44e1180b8de4666248a2dadfab821 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.cpp
+++ b/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -607,6 +607,21 @@ bool parseRsaOaepParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>&
return true;
}
+// Defined by the WebCrypto spec as:
+//
+// dictionary RsaPssParams : Algorithm {
+// [EnforceRange] required unsigned long saltLength;
+// };
+bool parseRsaPssParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error)
+{
+ uint32_t saltLengthBytes;
+ if (!getUint32(raw, "saltLength", saltLengthBytes, context, error))
+ return false;
+
+ params = adoptPtr(new WebCryptoRsaPssParams(saltLengthBytes));
+ return true;
+}
+
bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType type, OwnPtr<WebCryptoAlgorithmParams>& params, ErrorContext& context, AlgorithmError* error)
{
switch (type) {
@@ -640,6 +655,10 @@ bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType ty
context.add("RsaOaepParams");
return parseRsaOaepParams(raw, params, context, error);
break;
+ case WebCryptoAlgorithmParamsTypeRsaPssParams:
+ context.add("RsaPssParams");
+ return parseRsaPssParams(raw, params, context, error);
+ break;
}
ASSERT_NOT_REACHED();
return false;
« no previous file with comments | « Source/bindings/core/v8/SerializedScriptValue.cpp ('k') | Source/platform/exported/WebCryptoAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698