haikuwebkit/Source/WebCore/crypto/CryptoAlgorithmParameters.idl

31 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

Update SubtleCrypto::generateKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=163718 <rdar://problem/28864380> Reviewed by Chris Dumez. LayoutTests/imported/w3c: * WebCryptoAPI/generateKey/test_aes-cbc-expected.txt: * WebCryptoAPI/generateKey/test_aes-cbc.html: * WebCryptoAPI/generateKey/test_aes-ctr-expected.txt: * WebCryptoAPI/generateKey/test_aes-ctr.html: * WebCryptoAPI/generateKey/test_failures-expected.txt: * WebCryptoAPI/generateKey/test_failures.html: * WebCryptoAPI/generateKey/test_failures_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CBC.html: * WebCryptoAPI/generateKey/test_failures_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CTR.html: * WebCryptoAPI/generateKey/test_failures_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-GCM.html: * WebCryptoAPI/generateKey/test_failures_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-KW.html: * WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDH.html: * WebCryptoAPI/generateKey/test_failures_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDSA.html: * WebCryptoAPI/generateKey/test_failures_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_failures_HMAC.html: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_failures_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-PSS.html: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/generateKey/test_successes-expected.txt: * WebCryptoAPI/generateKey/test_successes.html: * WebCryptoAPI/generateKey/test_successes_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CBC.html: * WebCryptoAPI/generateKey/test_successes_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CTR.html: * WebCryptoAPI/generateKey/test_successes_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-GCM.html: * WebCryptoAPI/generateKey/test_successes_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-KW.html: * WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDH.html: * WebCryptoAPI/generateKey/test_successes_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDSA.html: * WebCryptoAPI/generateKey/test_successes_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_successes_HMAC.html: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_successes_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-PSS.html: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::generateKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey. 2. It implements generateKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It replaces SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS with SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS_DEPRECATED for deprecated params. 4. It fixes https://bugs.webkit.org/show_bug.cgi?id=129750 as well. Tests: crypto/subtle/aes-cbc-generate-key-length-128.html crypto/subtle/aes-cbc-generate-key-length-192.html crypto/subtle/aes-cbc-generate-key-length-256.html crypto/subtle/aes-generate-key-malformed-parameters.html crypto/subtle/aes-kw-generate-key.html crypto/subtle/generate-key-malformed-paramters.html crypto/subtle/hmac-generate-key-customized-length.html crypto/subtle/hmac-generate-key-hash-object.html crypto/subtle/hmac-generate-key-malformed-parameters.html crypto/subtle/hmac-generate-key-sha1.html crypto/subtle/hmac-generate-key-sha224.html crypto/subtle/hmac-generate-key-sha256.html crypto/subtle/hmac-generate-key-sha384.html crypto/subtle/hmac-generate-key-sha512.html crypto/subtle/rsa-generate-key-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/webkitSubtle/hmac-generate-key.html: crypto/workers/subtle/aes-generate-key.html crypto/workers/subtle/hmac-generate-key.html crypto/workers/subtle/rsa-generate-key.html * CMakeLists.txt: * DerivedSources.make: * Modules/encryptedmedia/CDMSessionClearKey.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: Added. (WebCore::toHashIdentifier): (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::createAlgorithm): (WebCore::rejectWithException): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::JSSubtleCrypto::generateKey): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::generateKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::generateKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: Added. (WebCore::CryptoAlgorithmParameters::CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::~CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::parametersClass): * crypto/CryptoAlgorithmParameters.idl: Added. * crypto/CryptoAlgorithmParametersDeprecated.h: * crypto/CryptoKey.cpp: (WebCore::CryptoKey::setUsagesBitmap): * crypto/CryptoKey.h: * crypto/CryptoKeyPair.idl: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/parameters/AesKeyGenParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. (WebCore::CryptoAlgorithmRsaKeyGenParams::arrayToVector): * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: * crypto/parameters/HmacKeyGenParams.idl: Added. * crypto/parameters/RsaHashedKeyGenParams.idl: Added. * crypto/parameters/RsaKeyGenParams.idl: Added. LayoutTests: Besides adding tests for SubtleCrypto::generateKey related stuff and fixing HMAC. This patch also add shouldReject(_a, _rejectCallback, _resolveCallback, _message) in js-test-pre.js. * TestExpectations: * crypto/subtle/aes-cbc-generate-key-length-128-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-128.html: Added. * crypto/subtle/aes-cbc-generate-key-length-192-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-192.html: Added. * crypto/subtle/aes-cbc-generate-key-length-256-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-256.html: Added. * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-generate-key-malformed-parameters.html: Added. * crypto/subtle/aes-kw-generate-key-expected.txt: Added. * crypto/subtle/aes-kw-generate-key.html: Added. * crypto/subtle/generate-key-malformed-paramters-expected.txt: Added. * crypto/subtle/generate-key-malformed-paramters.html: Added. * crypto/subtle/hmac-generate-key-customized-length-expected.txt: Added. * crypto/subtle/hmac-generate-key-customized-length.html: Added. * crypto/subtle/hmac-generate-key-hash-object-expected.txt: Added. * crypto/subtle/hmac-generate-key-hash-object.html: Added. * crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/hmac-generate-key-malformed-parameters.html: Added. * crypto/subtle/hmac-generate-key-sha1-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha1.html: Added. * crypto/subtle/hmac-generate-key-sha224-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha224.html: Added. * crypto/subtle/hmac-generate-key-sha256-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha256.html: Added. * crypto/subtle/hmac-generate-key-sha384-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha384.html: Added. * crypto/subtle/hmac-generate-key-sha512-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha512.html: Added. * crypto/subtle/rsa-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/rsa-generate-key-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-generate-key-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added. * crypto/webkitSubtle/hmac-generate-key-expected.txt: * crypto/webkitSubtle/hmac-generate-key.html: * crypto/workers/subtle/aes-generate-key-expected.txt: Added. * crypto/workers/subtle/aes-generate-key.html: Added. * crypto/workers/subtle/hmac-generate-key-expected.txt: Added. * crypto/workers/subtle/hmac-generate-key.html: Added. * crypto/workers/subtle/resources/aes-generate-key.js: Added. * crypto/workers/subtle/resources/hmac-generate-key.js: Added. * crypto/workers/subtle/resources/rsa-generate-key.js: Added. * crypto/workers/subtle/rsa-generate-key-expected.txt: Added. * crypto/workers/subtle/rsa-generate-key.html: Added. * resources/js-test-pre.js: Canonical link: https://commits.webkit.org/181666@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-25 06:07:04 +00:00
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
[
Rename ENABLE_SUBTLE_CRYPTO to ENABLE_WEB_CRYPTO https://bugs.webkit.org/show_bug.cgi?id=192197 Reviewed by Jiewen Tan. .: * Source/cmake/OptionsGTK.cmake: * Source/cmake/OptionsWPE.cmake: * Source/cmake/OptionsWin.cmake: * Source/cmake/WebKitFeatures.cmake: Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: No new tests. No change in behavior. * Configurations/FeatureDefines.xcconfig: * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneDeserializer::readTerminal): * crypto/CommonCryptoUtilities.cpp: * crypto/CommonCryptoUtilities.h: * crypto/CryptoAlgorithm.cpp: * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmIdentifier.h: * crypto/CryptoAlgorithmParameters.h: * crypto/CryptoAlgorithmParameters.idl: * crypto/CryptoAlgorithmRegistry.cpp: * crypto/CryptoAlgorithmRegistry.h: * crypto/CryptoKey.cpp: * crypto/CryptoKey.h: * crypto/CryptoKey.idl: * crypto/CryptoKeyFormat.h: * crypto/CryptoKeyPair.h: * crypto/CryptoKeyPair.idl: * crypto/CryptoKeyType.h: * crypto/CryptoKeyUsage.h: * crypto/CryptoKeyUsage.idl: * crypto/JsonWebKey.h: * crypto/JsonWebKey.idl: * crypto/RsaOtherPrimesInfo.h: * crypto/RsaOtherPrimesInfo.idl: * crypto/SerializedCryptoKeyWrap.h: * crypto/SubtleCrypto.cpp: * crypto/SubtleCrypto.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: * crypto/algorithms/CryptoAlgorithmAES_CFB.h: * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: * crypto/algorithms/CryptoAlgorithmAES_CTR.h: * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: * crypto/algorithms/CryptoAlgorithmAES_GCM.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmECDH.cpp: * crypto/algorithms/CryptoAlgorithmECDH.h: * crypto/algorithms/CryptoAlgorithmECDSA.cpp: * crypto/algorithms/CryptoAlgorithmECDSA.h: * crypto/algorithms/CryptoAlgorithmHKDF.cpp: * crypto/algorithms/CryptoAlgorithmHKDF.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: * crypto/algorithms/CryptoAlgorithmPBKDF2.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: * crypto/algorithms/CryptoAlgorithmRSA_PSS.h: * crypto/algorithms/CryptoAlgorithmSHA1.cpp: * crypto/algorithms/CryptoAlgorithmSHA1.h: * crypto/algorithms/CryptoAlgorithmSHA224.cpp: * crypto/algorithms/CryptoAlgorithmSHA224.h: * crypto/algorithms/CryptoAlgorithmSHA256.cpp: * crypto/algorithms/CryptoAlgorithmSHA256.h: * crypto/algorithms/CryptoAlgorithmSHA384.cpp: * crypto/algorithms/CryptoAlgorithmSHA384.h: * crypto/algorithms/CryptoAlgorithmSHA512.cpp: * crypto/algorithms/CryptoAlgorithmSHA512.h: * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp: * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp: * crypto/gcrypt/CryptoKeyECGCrypt.cpp: * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: * crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp: * crypto/keys/CryptoAesKeyAlgorithm.idl: * crypto/keys/CryptoEcKeyAlgorithm.idl: * crypto/keys/CryptoHmacKeyAlgorithm.idl: * crypto/keys/CryptoKeyAES.cpp: * crypto/keys/CryptoKeyAES.h: * crypto/keys/CryptoKeyAlgorithm.idl: * crypto/keys/CryptoKeyEC.cpp: * crypto/keys/CryptoKeyEC.h: * crypto/keys/CryptoKeyHMAC.cpp: * crypto/keys/CryptoKeyHMAC.h: * crypto/keys/CryptoKeyRSA.cpp: * crypto/keys/CryptoKeyRSA.h: * crypto/keys/CryptoKeyRSAComponents.cpp: * crypto/keys/CryptoKeyRSAComponents.h: * crypto/keys/CryptoKeyRaw.cpp: * crypto/keys/CryptoKeyRaw.h: * crypto/keys/CryptoRsaHashedKeyAlgorithm.idl: * crypto/keys/CryptoRsaKeyAlgorithm.idl: * crypto/mac/CommonCryptoDERUtilities.cpp: * crypto/mac/CommonCryptoDERUtilities.h: * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp: * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: * crypto/mac/CryptoAlgorithmAES_KWMac.cpp: * crypto/mac/CryptoAlgorithmECDHMac.cpp: * crypto/mac/CryptoAlgorithmECDSAMac.cpp: * crypto/mac/CryptoAlgorithmHKDFMac.cpp: * crypto/mac/CryptoAlgorithmHMACMac.cpp: * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp: * crypto/mac/CryptoAlgorithmRegistryMac.cpp: * crypto/mac/CryptoDigestAlgorithm.h: * crypto/mac/CryptoKeyECMac.cpp: * crypto/mac/CryptoKeyMac.cpp: * crypto/mac/CryptoKeyRSAMac.cpp: * crypto/mac/SerializedCryptoKeyWrapMac.mm: * crypto/parameters/AesCbcCfbParams.idl: * crypto/parameters/AesCtrParams.idl: * crypto/parameters/AesGcmParams.idl: * crypto/parameters/AesKeyParams.idl: * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: * crypto/parameters/CryptoAlgorithmAesCtrParams.h: * crypto/parameters/CryptoAlgorithmAesGcmParams.h: * crypto/parameters/CryptoAlgorithmAesKeyParams.h: * crypto/parameters/CryptoAlgorithmEcKeyParams.h: * crypto/parameters/CryptoAlgorithmEcdhKeyDeriveParams.h: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: * crypto/parameters/CryptoAlgorithmRsaPssParams.h: * crypto/parameters/EcKeyParams.idl: * crypto/parameters/EcdhKeyDeriveParams.idl: * crypto/parameters/EcdsaParams.idl: * crypto/parameters/HkdfParams.idl: * crypto/parameters/HmacKeyParams.idl: * crypto/parameters/Pbkdf2Params.idl: * crypto/parameters/RsaHashedImportParams.idl: * crypto/parameters/RsaHashedKeyGenParams.idl: * crypto/parameters/RsaKeyGenParams.idl: * crypto/parameters/RsaOaepParams.idl: * crypto/parameters/RsaPssParams.idl: * dom/Document.cpp: * dom/Document.h: * dom/ScriptExecutionContext.h: * page/ChromeClient.h: * page/Crypto.cpp: (WebCore::Crypto::Crypto): * page/Crypto.h: * page/Crypto.idl: * platform/GCrypt.cmake: * platform/LocalizedStrings.cpp: * platform/LocalizedStrings.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerGlobalScope.h: * worklets/WorkletGlobalScope.h: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: * pal/PlatformGTK.cmake: * pal/PlatformWPE.cmake: Source/WebKit: * Configurations/FeatureDefines.xcconfig: * UIProcess/API/C/WKPage.cpp: (WKPageSetPageNavigationClient): * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: Tools: * Scripts/webkitperl/FeatureList.pm: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Canonical link: https://commits.webkit.org/206898@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238754 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-30 22:23:17 +00:00
Conditional=WEB_CRYPTO,
Update SubtleCrypto::generateKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=163718 <rdar://problem/28864380> Reviewed by Chris Dumez. LayoutTests/imported/w3c: * WebCryptoAPI/generateKey/test_aes-cbc-expected.txt: * WebCryptoAPI/generateKey/test_aes-cbc.html: * WebCryptoAPI/generateKey/test_aes-ctr-expected.txt: * WebCryptoAPI/generateKey/test_aes-ctr.html: * WebCryptoAPI/generateKey/test_failures-expected.txt: * WebCryptoAPI/generateKey/test_failures.html: * WebCryptoAPI/generateKey/test_failures_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CBC.html: * WebCryptoAPI/generateKey/test_failures_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CTR.html: * WebCryptoAPI/generateKey/test_failures_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-GCM.html: * WebCryptoAPI/generateKey/test_failures_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-KW.html: * WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDH.html: * WebCryptoAPI/generateKey/test_failures_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDSA.html: * WebCryptoAPI/generateKey/test_failures_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_failures_HMAC.html: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_failures_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-PSS.html: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/generateKey/test_successes-expected.txt: * WebCryptoAPI/generateKey/test_successes.html: * WebCryptoAPI/generateKey/test_successes_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CBC.html: * WebCryptoAPI/generateKey/test_successes_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CTR.html: * WebCryptoAPI/generateKey/test_successes_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-GCM.html: * WebCryptoAPI/generateKey/test_successes_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-KW.html: * WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDH.html: * WebCryptoAPI/generateKey/test_successes_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDSA.html: * WebCryptoAPI/generateKey/test_successes_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_successes_HMAC.html: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_successes_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-PSS.html: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::generateKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey. 2. It implements generateKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It replaces SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS with SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS_DEPRECATED for deprecated params. 4. It fixes https://bugs.webkit.org/show_bug.cgi?id=129750 as well. Tests: crypto/subtle/aes-cbc-generate-key-length-128.html crypto/subtle/aes-cbc-generate-key-length-192.html crypto/subtle/aes-cbc-generate-key-length-256.html crypto/subtle/aes-generate-key-malformed-parameters.html crypto/subtle/aes-kw-generate-key.html crypto/subtle/generate-key-malformed-paramters.html crypto/subtle/hmac-generate-key-customized-length.html crypto/subtle/hmac-generate-key-hash-object.html crypto/subtle/hmac-generate-key-malformed-parameters.html crypto/subtle/hmac-generate-key-sha1.html crypto/subtle/hmac-generate-key-sha224.html crypto/subtle/hmac-generate-key-sha256.html crypto/subtle/hmac-generate-key-sha384.html crypto/subtle/hmac-generate-key-sha512.html crypto/subtle/rsa-generate-key-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/webkitSubtle/hmac-generate-key.html: crypto/workers/subtle/aes-generate-key.html crypto/workers/subtle/hmac-generate-key.html crypto/workers/subtle/rsa-generate-key.html * CMakeLists.txt: * DerivedSources.make: * Modules/encryptedmedia/CDMSessionClearKey.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: Added. (WebCore::toHashIdentifier): (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::createAlgorithm): (WebCore::rejectWithException): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::JSSubtleCrypto::generateKey): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::generateKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::generateKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: Added. (WebCore::CryptoAlgorithmParameters::CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::~CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::parametersClass): * crypto/CryptoAlgorithmParameters.idl: Added. * crypto/CryptoAlgorithmParametersDeprecated.h: * crypto/CryptoKey.cpp: (WebCore::CryptoKey::setUsagesBitmap): * crypto/CryptoKey.h: * crypto/CryptoKeyPair.idl: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/parameters/AesKeyGenParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. (WebCore::CryptoAlgorithmRsaKeyGenParams::arrayToVector): * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: * crypto/parameters/HmacKeyGenParams.idl: Added. * crypto/parameters/RsaHashedKeyGenParams.idl: Added. * crypto/parameters/RsaKeyGenParams.idl: Added. LayoutTests: Besides adding tests for SubtleCrypto::generateKey related stuff and fixing HMAC. This patch also add shouldReject(_a, _rejectCallback, _resolveCallback, _message) in js-test-pre.js. * TestExpectations: * crypto/subtle/aes-cbc-generate-key-length-128-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-128.html: Added. * crypto/subtle/aes-cbc-generate-key-length-192-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-192.html: Added. * crypto/subtle/aes-cbc-generate-key-length-256-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-256.html: Added. * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-generate-key-malformed-parameters.html: Added. * crypto/subtle/aes-kw-generate-key-expected.txt: Added. * crypto/subtle/aes-kw-generate-key.html: Added. * crypto/subtle/generate-key-malformed-paramters-expected.txt: Added. * crypto/subtle/generate-key-malformed-paramters.html: Added. * crypto/subtle/hmac-generate-key-customized-length-expected.txt: Added. * crypto/subtle/hmac-generate-key-customized-length.html: Added. * crypto/subtle/hmac-generate-key-hash-object-expected.txt: Added. * crypto/subtle/hmac-generate-key-hash-object.html: Added. * crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/hmac-generate-key-malformed-parameters.html: Added. * crypto/subtle/hmac-generate-key-sha1-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha1.html: Added. * crypto/subtle/hmac-generate-key-sha224-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha224.html: Added. * crypto/subtle/hmac-generate-key-sha256-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha256.html: Added. * crypto/subtle/hmac-generate-key-sha384-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha384.html: Added. * crypto/subtle/hmac-generate-key-sha512-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha512.html: Added. * crypto/subtle/rsa-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/rsa-generate-key-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-generate-key-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added. * crypto/webkitSubtle/hmac-generate-key-expected.txt: * crypto/webkitSubtle/hmac-generate-key.html: * crypto/workers/subtle/aes-generate-key-expected.txt: Added. * crypto/workers/subtle/aes-generate-key.html: Added. * crypto/workers/subtle/hmac-generate-key-expected.txt: Added. * crypto/workers/subtle/hmac-generate-key.html: Added. * crypto/workers/subtle/resources/aes-generate-key.js: Added. * crypto/workers/subtle/resources/hmac-generate-key.js: Added. * crypto/workers/subtle/resources/rsa-generate-key.js: Added. * crypto/workers/subtle/rsa-generate-key-expected.txt: Added. * crypto/workers/subtle/rsa-generate-key.html: Added. * resources/js-test-pre.js: Canonical link: https://commits.webkit.org/181666@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-25 06:07:04 +00:00
] dictionary CryptoAlgorithmParameters {
required DOMString name;
};