Implement PBKDF2 in WebCrypto
https://bugs.webkit.org/show_bug.cgi?id=143458
<rdar://problem/
27311703>
Reviewed by Brent Fulgham.
LayoutTests/imported/w3c:
* web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/derive_bits_keys/test_pbkdf2-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/symmetric_importKey.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/test_symmetric_importKey-expected.txt:
Source/WebCore:
This patch implements PBKDF2 according to the spec:
https://www.w3.org/TR/WebCryptoAPI/#pbkdf2. Supported
operations include deriveKey, deriveBits, importKey and
getKeyLength.
Tests: crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html
crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html
crypto/subtle/pbkdf2-import-key-derive-bits.html
crypto/subtle/pbkdf2-import-key-derive-hmac-key.html
crypto/subtle/pbkdf2-import-key-malformed-parameters.html
crypto/subtle/pbkdf2-import-key.html
crypto/workers/subtle/pbkdf2-import-key-derive-bits.html
crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html
crypto/workers/subtle/pbkdf2-import-key.html
* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoKeyCustom.cpp:
(WebCore::JSCryptoKey::algorithm):
Added RawKeyAlgorithm.
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
A bit of reordering.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
Faked implementation.
* crypto/CryptoAlgorithmParameters.h:
* crypto/CryptoKey.h:
* crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: Added.
(WebCore::CryptoAlgorithmPBKDF2::create):
(WebCore::CryptoAlgorithmPBKDF2::identifier):
(WebCore::CryptoAlgorithmPBKDF2::deriveBits):
(WebCore::CryptoAlgorithmPBKDF2::importKey):
(WebCore::CryptoAlgorithmPBKDF2::getKeyLength):
* crypto/algorithms/CryptoAlgorithmPBKDF2.h: Added.
* crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp: Added.
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/keys/CryptoKeyRaw.cpp: Added.
(WebCore::CryptoKeyRaw::CryptoKeyRaw):
(WebCore::CryptoKeyRaw::buildAlgorithm):
(WebCore::CryptoKeyRaw::exportData):
* crypto/keys/CryptoKeyRaw.h: Added.
(WebCore::RawKeyAlgorithm::RawKeyAlgorithm):
The CryptoKey class for PBKDF2 and later on HKDF.
* crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: Added.
(WebCore::commonCryptoHMACAlgorithm):
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* crypto/parameters/CryptoAlgorithmPbkdf2Params.h: Added.
* crypto/parameters/Pbkdf2Params.idl: Added.
LayoutTests:
* TestExpectations:
Mark slow tests as slow.
* crypto/subtle/derive-key-malformed-parameters.html:
* crypto/subtle/ecdh-import-key-derive-pbkdf2-key-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html: Added.
* crypto/subtle/pbkdf2-derive-bits-malformed-parametrs-expected.txt: Added.
* crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html: Added.
* crypto/subtle/pbkdf2-import-key-derive-bits-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-derive-bits.html: Added.
* crypto/subtle/pbkdf2-import-key-derive-hmac-key-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-derive-hmac-key.html: Added.
* crypto/subtle/pbkdf2-import-key-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-malformed-parameters.html: Added.
* crypto/subtle/pbkdf2-import-key.html: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-bits-expected.txt: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-bits.html: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key-expected.txt: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html: Added.
* crypto/workers/subtle/pbkdf2-import-key-expected.txt: Added.
* crypto/workers/subtle/pbkdf2-import-key.html: Added.
* crypto/workers/subtle/resources/pbkdf2-import-key-derive-bits.js: Added.
* crypto/workers/subtle/resources/pbkdf2-import-key-derive-hmac-key.js: Added.
* crypto/workers/subtle/resources/pbkdf2-import-key.js: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213671
268f45cc-cd09-0410-ab3c-
d52691b4dbfc