| Index: Source/modules/crypto/NormalizeAlgorithm.cpp
|
| diff --git a/Source/modules/crypto/NormalizeAlgorithm.cpp b/Source/modules/crypto/NormalizeAlgorithm.cpp
|
| index 823989554d1830bcbaa42b07280068057277d59b..f518be887e6ddf4ef0bdc23b1e5b5ac30424e827 100644
|
| --- a/Source/modules/crypto/NormalizeAlgorithm.cpp
|
| +++ b/Source/modules/crypto/NormalizeAlgorithm.cpp
|
| @@ -70,6 +70,7 @@ const AlgorithmNameMapping algorithmNameMappings[] = {
|
| {"ECDH", 4, WebCryptoAlgorithmIdEcdh},
|
| {"SHA-1", 5, WebCryptoAlgorithmIdSha1},
|
| {"ECDSA", 5, WebCryptoAlgorithmIdEcdsa},
|
| + {"PBKDF2", 6, WebCryptoAlgorithmIdPbkdf2},
|
| {"AES-KW", 6, WebCryptoAlgorithmIdAesKw},
|
| {"SHA-512", 7, WebCryptoAlgorithmIdSha512},
|
| {"SHA-384", 7, WebCryptoAlgorithmIdSha384},
|
| @@ -757,6 +758,29 @@ bool parseEcdhKeyDeriveParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmPa
|
| params = adoptPtr(new WebCryptoEcdhKeyDeriveParams(cryptoKey->key()));
|
| return true;
|
| }
|
| +// dictionary Pbkdf2Params : Algorithm {
|
| +// required BufferSource salt;
|
| +// [EnforceRange] required unsigned long iterations;
|
| +// required HashAlgorithmIdentifier hash;
|
| +// };
|
| +bool parsePbkdf2Params(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error)
|
| +{
|
| + BufferSource saltBufferSource;
|
| + if (!getBufferSource(raw, "salt", saltBufferSource, context, error))
|
| + return false;
|
| +
|
| + DOMArrayPiece salt(saltBufferSource);
|
| +
|
| + uint32_t iterations;
|
| + if (!getUint32(raw, "iterations", iterations, context, error))
|
| + return false;
|
| +
|
| + WebCryptoAlgorithm hash;
|
| + if (!parseHash(raw, hash, context, error))
|
| + return false;
|
| + params = adoptPtr(new WebCryptoPbkdf2Params(hash, salt.bytes(), salt.byteLength(), iterations));
|
| + return true;
|
| +}
|
|
|
| // Defined by the WebCrypto spec as:
|
| //
|
| @@ -823,6 +847,9 @@ bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType ty
|
| case WebCryptoAlgorithmParamsTypeAesDerivedKeyParams:
|
| context.add("AesDerivedKeyParams");
|
| return parseAesDerivedKeyParams(raw, params, context, error);
|
| + case WebCryptoAlgorithmParamsTypePbkdf2Params:
|
| + context.add("Pbkdf2Params");
|
| + return parsePbkdf2Params(raw, params, context, error);
|
| }
|
| ASSERT_NOT_REACHED();
|
| return false;
|
|
|