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

Unified Diff: Source/platform/exported/WebCryptoAlgorithm.cpp

Issue 820523003: [webcrypto] Implement PBKDF2 (blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added Layout tests Created 5 years, 11 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: Source/platform/exported/WebCryptoAlgorithm.cpp
diff --git a/Source/platform/exported/WebCryptoAlgorithm.cpp b/Source/platform/exported/WebCryptoAlgorithm.cpp
index 35b1e0ac28a58c6093b3ce662be919c17a547d50..84c3612ceb464637b23e255f17fbcdc1cfc4562f 100644
--- a/Source/platform/exported/WebCryptoAlgorithm.cpp
+++ b/Source/platform/exported/WebCryptoAlgorithm.cpp
@@ -239,6 +239,20 @@ const WebCryptoAlgorithmInfo algorithmIdToInfo[] = {
WebCryptoAlgorithmParamsTypeNone, // WrapKey
WebCryptoAlgorithmParamsTypeNone // UnwrapKey
}
+ }, { // Index 14
+ "PBKDF2", {
+ WebCryptoAlgorithmInfo::Undefined, // Encrypt
+ WebCryptoAlgorithmInfo::Undefined, // Decrypt
+ WebCryptoAlgorithmInfo::Undefined, // Sign
+ WebCryptoAlgorithmInfo::Undefined, // Verify
+ WebCryptoAlgorithmInfo::Undefined, // Digest
+ WebCryptoAlgorithmParamsTypeNone, // GenerateKey
+ WebCryptoAlgorithmParamsTypeNone, // ImportKey
+ WebCryptoAlgorithmInfo::Undefined, // GetKeyLength
+ WebCryptoAlgorithmParamsTypePbkdf2Params, // DeriveBits
+ WebCryptoAlgorithmInfo::Undefined, // WrapKey
+ WebCryptoAlgorithmInfo::Undefined // UnwrapKey
+ }
},
};
@@ -259,7 +273,8 @@ static_assert(WebCryptoAlgorithmIdAesKw == 10, "AESKW id must match");
static_assert(WebCryptoAlgorithmIdRsaPss == 11, "RSA-PSS id must match");
static_assert(WebCryptoAlgorithmIdEcdsa == 12, "ECDSA id must match");
static_assert(WebCryptoAlgorithmIdEcdh == 13, "ECDH id must match");
-static_assert(WebCryptoAlgorithmIdLast == 13, "last id must match");
+static_assert(WebCryptoAlgorithmIdPbkdf2 == 14, "Pbkdf2 id must match");
+static_assert(WebCryptoAlgorithmIdLast == 14, "last id must match");
static_assert(10 == WebCryptoOperationLast, "the parameter mapping needs to be updated");
} // namespace
@@ -437,6 +452,14 @@ const WebCryptoAesDerivedKeyParams* WebCryptoAlgorithm::aesDerivedKeyParams() co
return 0;
}
+const WebCryptoPbkdf2Params* WebCryptoAlgorithm::pbkdf2Params() const
+{
+ ASSERT(!isNull());
+ if (paramsType() == WebCryptoAlgorithmParamsTypePbkdf2Params)
+ return static_cast<WebCryptoPbkdf2Params*>(m_private->params.get());
+ return 0;
+}
+
bool WebCryptoAlgorithm::isHash(WebCryptoAlgorithmId id)
{
switch (id) {
@@ -455,6 +478,7 @@ bool WebCryptoAlgorithm::isHash(WebCryptoAlgorithmId id)
case WebCryptoAlgorithmIdRsaPss:
case WebCryptoAlgorithmIdEcdsa:
case WebCryptoAlgorithmIdEcdh:
+ case WebCryptoAlgorithmIdPbkdf2:
break;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698