- 06 Jan, 2014 1 commit
-
-
weinig@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=126510 Reviewed by Gavin Barraclough. Source/JavaScriptCore: Add Promise.all() implementation and factor out performing resolves and rejects on deferreds to share a bit of code. Also moves the abruptRejection helper to JSPromiseDeferred so it can be used in JSPromiseFunctions. * runtime/CommonIdentifiers.h: * runtime/JSPromiseConstructor.cpp: (JSC::JSPromiseConstructorFuncCast): (JSC::JSPromiseConstructorFuncResolve): (JSC::JSPromiseConstructorFuncReject): (JSC::JSPromiseConstructorFuncAll): * runtime/JSPromiseDeferred.cpp: (JSC::updateDeferredFromPotentialThenable): (JSC::performDeferredResolve): (JSC::performDeferredReject): (JSC::abruptRejection): * runtime/JSPromiseDeferred.h: * runtime/JSPromiseFunctions.cpp: (JSC::promiseAllCountdownFunction): (JSC::createPromiseAllCountdownFunction): * runtime/JSPromiseFunctions.h: * runtime/JSPromiseReaction.cpp: (JSC::ExecutePromiseReactionMicrotask::run): LayoutTests: Enabled and fix the existing Promise.all() test case. - Promise.all() and Promise.all({}) should reject by my reading of the spec. Also removes the Promise.all() shim used by the crypto tests. * crypto/subtle/resources/common.js: * js/dom/Promise-static-all-expected.txt: * js/dom/Promise-static-all.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 02 Jan, 2014 1 commit
-
-
https://github.com/domenic/promises-unwrappingweinig@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=120954 Reviewed by Filip Pizlo. Source/JavaScriptCore: Update Promises to the revised spec. Notable changes: - JSPromiseResolver is gone. - TaskContext has been renamed Microtask and now has a virtual run() function. - Instead of using custom InternalFunction subclasses, JSFunctions are used with PrivateName properties for internal slots. * CMakeLists.txt: * DerivedSources.make: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/CallFrame.h: (JSC::ExecState::promiseConstructorTable): * runtime/CommonIdentifiers.cpp: (JSC::CommonIdentifiers::CommonIdentifiers): * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset): (JSC::JSGlobalObject::visitChildren): (JSC::JSGlobalObject::queueMicrotask): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseConstructor): (JSC::JSGlobalObject::promisePrototype): (JSC::JSGlobalObject::promiseStructure): * runtime/JSPromise.cpp: (JSC::JSPromise::create): (JSC::JSPromise::JSPromise): (JSC::JSPromise::finishCreation): (JSC::JSPromise::visitChildren): (JSC::JSPromise::reject): (JSC::JSPromise::resolve): (JSC::JSPromise::appendResolveReaction): (JSC::JSPromise::appendRejectReaction): (JSC::triggerPromiseReactions): * runtime/JSPromise.h: (JSC::JSPromise::status): (JSC::JSPromise::result): (JSC::JSPromise::constructor): * runtime/JSPromiseCallback.cpp: Removed. * runtime/JSPromiseCallback.h: Removed. * runtime/JSPromiseConstructor.cpp: (JSC::constructPromise): (JSC::JSPromiseConstructor::getCallData): (JSC::JSPromiseConstructorFuncCast): (JSC::JSPromiseConstructorFuncResolve): (JSC::JSPromiseConstructorFuncReject): * runtime/JSPromiseConstructor.h: * runtime/JSPromiseDeferred.cpp: Added. (JSC::JSPromiseDeferred::create): (JSC::JSPromiseDeferred::JSPromiseDeferred): (JSC::JSPromiseDeferred::finishCreation): (JSC::JSPromiseDeferred::visitChildren): (JSC::createJSPromiseDeferredFromConstructor): (JSC::updateDeferredFromPotentialThenable): * runtime/JSPromiseDeferred.h: Added. (JSC::JSPromiseDeferred::createStructure): (JSC::JSPromiseDeferred::promise): (JSC::JSPromiseDeferred::resolve): (JSC::JSPromiseDeferred::reject): * runtime/JSPromiseFunctions.cpp: Added. (JSC::deferredConstructionFunction): (JSC::createDeferredConstructionFunction): (JSC::identifyFunction): (JSC::createIdentifyFunction): (JSC::promiseAllCountdownFunction): (JSC::createPromiseAllCountdownFunction): (JSC::promiseResolutionHandlerFunction): (JSC::createPromiseResolutionHandlerFunction): (JSC::rejectPromiseFunction): (JSC::createRejectPromiseFunction): (JSC::resolvePromiseFunction): (JSC::createResolvePromiseFunction): (JSC::throwerFunction): (JSC::createThrowerFunction): * runtime/JSPromiseFunctions.h: Added. * runtime/JSPromisePrototype.cpp: (JSC::JSPromisePrototypeFuncThen): (JSC::JSPromisePrototypeFuncCatch): * runtime/JSPromiseReaction.cpp: Added. (JSC::createExecutePromiseReactionMicroTask): (JSC::ExecutePromiseReactionMicroTask::run): (JSC::JSPromiseReaction::create): (JSC::JSPromiseReaction::JSPromiseReaction): (JSC::JSPromiseReaction::finishCreation): (JSC::JSPromiseReaction::visitChildren): * runtime/JSPromiseReaction.h: Added. (JSC::JSPromiseReaction::createStructure): (JSC::JSPromiseReaction::deferred): (JSC::JSPromiseReaction::handler): * runtime/JSPromiseResolver.cpp: Removed. * runtime/JSPromiseResolver.h: Removed. * runtime/JSPromiseResolverConstructor.cpp: Removed. * runtime/JSPromiseResolverConstructor.h: Removed. * runtime/JSPromiseResolverPrototype.cpp: Removed. * runtime/JSPromiseResolverPrototype.h: Removed. * runtime/Microtask.h: Added. * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: Source/WebCore: * ForwardingHeaders/runtime/JSPromiseDeferred.h: Added. * ForwardingHeaders/runtime/JSPromiseResolver.h: Removed. * bindings/js/JSDOMGlobalObjectTask.cpp: (WebCore::JSGlobalObjectTask::JSGlobalObjectTask): * bindings/js/JSDOMGlobalObjectTask.h: * bindings/js/JSDOMPromise.cpp: (WebCore::DeferredWrapper::DeferredWrapper): (WebCore::DeferredWrapper::promise): (WebCore::DeferredWrapper::resolve): (WebCore::DeferredWrapper::reject): * bindings/js/JSDOMPromise.h: (WebCore::DeferredWrapper::resolve): (WebCore::DeferredWrapper::reject): (WebCore::DeferredWrapper::resolve<String>): (WebCore::DeferredWrapper::resolve<bool>): (WebCore::char>>): (WebCore::DeferredWrapper::reject<String>): * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::queueTaskToEventLoop): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::encrypt): (WebCore::JSSubtleCrypto::decrypt): (WebCore::JSSubtleCrypto::sign): (WebCore::JSSubtleCrypto::verify): (WebCore::JSSubtleCrypto::digest): (WebCore::JSSubtleCrypto::generateKey): (WebCore::JSSubtleCrypto::importKey): (WebCore::JSSubtleCrypto::exportKey): (WebCore::JSSubtleCrypto::wrapKey): (WebCore::JSSubtleCrypto::unwrapKey): * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop): * bindings/js/JSWorkerGlobalScopeBase.h: LayoutTests: * crypto/subtle/argument-conversion.html: * crypto/subtle/resources/common.js: * crypto/subtle/sha-1.html: * crypto/subtle/sha-224.html: * crypto/subtle/sha-256.html: * crypto/subtle/sha-384.html: * crypto/subtle/sha-512.html: * js/dom/Promise-already-fulfilled-expected.txt: Removed. * js/dom/Promise-already-fulfilled.html: Removed. * js/dom/Promise-already-rejected.html: * js/dom/Promise-already-resolved.html: * js/dom/Promise-catch-expected.txt: * js/dom/Promise-catch-in-workers-expected.txt: * js/dom/Promise-catch.html: * js/dom/Promise-chain.html: * js/dom/Promise-exception-expected.txt: * js/dom/Promise-exception.html: * js/dom/Promise-expected.txt: * js/dom/Promise-fulfill-expected.txt: Removed. * js/dom/Promise-fulfill-in-workers-expected.txt: Removed. * js/dom/Promise-fulfill-in-workers.html: Removed. * js/dom/Promise-fulfill.html: Removed. * js/dom/Promise-init-callback-receiver-expected.txt: Added. * js/dom/Promise-init-callback-receiver.html: Added. * js/dom/Promise-init-expected.txt: * js/dom/Promise-init-in-workers-expected.txt: * js/dom/Promise-init.html: * js/dom/Promise-onFulfilled-deep-expected.txt: Added. * js/dom/Promise-onFulfilled-deep.html: Added. * js/dom/Promise-onRejected-deep-expected.txt: Added. * js/dom/Promise-onRejected-deep.html: Added. * js/dom/Promise-reject.html: * js/dom/Promise-resolve-chain.html: * js/dom/Promise-resolve-expected.txt: * js/dom/Promise-resolve-in-workers-expected.txt: * js/dom/Promise-resolve-state-expected.txt: Added. * js/dom/Promise-resolve-state-in-workers-expected.txt: Added. * js/dom/Promise-resolve-state-in-workers.html: Added. * js/dom/Promise-resolve-state.html: Added. * js/dom/Promise-resolve-with-itself-expected.txt: Added. * js/dom/Promise-resolve-with-itself.html: Added. * js/dom/Promise-resolve-with-then-exception.html: * js/dom/Promise-resolve-with-then-fulfill-expected.txt: * js/dom/Promise-resolve-with-then-fulfill.html: * js/dom/Promise-resolve-with-then-reject-expected.txt: * js/dom/Promise-resolve-with-then-reject.html: * js/dom/Promise-resolve.html: * js/dom/Promise-simple-expected.txt: * js/dom/Promise-simple-fulfill-expected.txt: Removed. * js/dom/Promise-simple-fulfill-inside-callback-expected.txt: Removed. * js/dom/Promise-simple-fulfill-inside-callback.html: Removed. * js/dom/Promise-simple-fulfill.html: Removed. * js/dom/Promise-simple-in-workers-expected.txt: * js/dom/Promise-simple-resolve-expected.txt: Added. * js/dom/Promise-simple-resolve.html: Added. * js/dom/Promise-simple.html: * js/dom/Promise-static-all-expected.txt: Added. * js/dom/Promise-static-all.html: Added. * js/dom/Promise-static-cast-expected.txt: Added. * js/dom/Promise-static-cast.html: Added. * js/dom/Promise-static-fulfill-expected.txt: Removed. * js/dom/Promise-static-fulfill.html: Removed. * js/dom/Promise-static-race-expected.txt: Added. * js/dom/Promise-static-race.html: Added. * js/dom/Promise-static-resolve.html: * js/dom/Promise-then-callback-receiver-expected.txt: Added. * js/dom/Promise-then-callback-receiver.html: Added. * js/dom/Promise-then-expected.txt: * js/dom/Promise-then-in-workers-expected.txt: * js/dom/Promise-then-without-callbacks.html: * js/dom/Promise-then.html: * js/dom/Promise-types-expected.txt: * js/dom/Promise-types.html: * js/dom/Promise.html: * js/resources/Promise-catch-in-workers.js: * js/resources/Promise-fulfill-in-workers.js: Removed. * js/resources/Promise-init-in-workers.js: * js/resources/Promise-reject-in-workers.js: * js/resources/Promise-resolve-in-workers.js: * js/resources/Promise-resolve-state-in-workers.js: Added. * js/resources/Promise-simple-in-workers.js: * js/resources/Promise-then-in-workers.js: * js/resources/Promise-then-without-callbacks-in-workers.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161241 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 13 Dec, 2013 2 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125696 Reviewed by Darin Adler. Source/WebCore: * crypto/CryptoKey.cpp: (WebCore::CryptoKey::usages): Do it. LayoutTests: * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-192-encrypt-decrypt.html: * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-256-encrypt-decrypt.html: * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html: * crypto/subtle/aes-cbc-encrypt-decrypt.html: * crypto/subtle/aes-cbc-generate-key-expected.txt: * crypto/subtle/aes-cbc-generate-key.html: * crypto/subtle/aes-cbc-invalid-length-expected.txt: * crypto/subtle/aes-cbc-invalid-length.html: * crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt: * crypto/subtle/aes-kw-wrap-unwrap-aes.html: * crypto/subtle/aes-postMessage-expected.txt: * crypto/subtle/aes-postMessage.html: * crypto/subtle/hmac-postMessage-expected.txt: * crypto/subtle/hmac-postMessage.html: * crypto/subtle/jwk-import-use-values-expected.txt: * crypto/subtle/jwk-import-use-values.html: * crypto/subtle/postMessage-worker-expected.txt: * crypto/subtle/postMessage-worker.html: * crypto/subtle/resources/postMessage-worker.js: (onmessage): * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: * crypto/subtle/rsa-oaep-key-manipulation.html: * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: * crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt: * crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125675 Reviewed by Darin Adler. Source/WebCore: Tests: crypto/subtle/unwrapKey-check-usage.html crypto/subtle/wrapKey-check-usage.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::wrapKey): Added accidentally omitted code. Other operations are fine. LayoutTests: * crypto/subtle/unwrapKey-check-usage-expected.txt: Added. * crypto/subtle/unwrapKey-check-usage.html: Added. * crypto/subtle/wrapKey-check-usage-expected.txt: Added. * crypto/subtle/wrapKey-check-usage.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 12 Dec, 2013 3 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125647 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: * crypto/algorithms/CryptoAlgorithmAES_KW.h: Removed meaningless parameters arguments from private functions. The base arguments class is always empty. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: Added. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::create): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::identifier): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::keyAlgorithmMatches): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: Added. * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: Added. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Added support for this algorithm. LayoutTests: * crypto/subtle/rsaes-pkcs1-v1_5-decrypt-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125642 Patch by Sam Weinig <sam@webkit.org> on 2013-12-12 Reviewed by Anders Carlsson. * css/CSSParser.cpp: (WebCore::filterProperties): (WebCore::CSSParser::createStyleProperties): * css/StyleProperties.cpp: (WebCore::StyleProperties::asText): LayoutTests: Public key in a generated KeyPair should always be extractable https://bugs.webkit.org/show_bug.cgi?id=125643 Reviewed by Sam Weinig. * crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-non-extractable-key.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125641 Reviewed by Anders Carlsson. Source/WebCore: Currently, WebCrypto editor's draft stipulates that algorithm name is lowercased as part of normalization. But it makes little sense to register algorithms as mixed (mostly upper) case, yet return the name lowercased. Other implementations don't bother respecting this, and signs are that the spec will change. I'd like to match other implementations here, because sticking to the spec only makes us fail 3rd party test suites for no good reason. Updated many existing tests. * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::getIdentifierForName): (WebCore::CryptoAlgorithmRegistry::registerAlgorithm): * crypto/CryptoAlgorithmRegistry.h: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: * crypto/algorithms/CryptoAlgorithmSHA1.cpp: * crypto/algorithms/CryptoAlgorithmSHA224.cpp: * crypto/algorithms/CryptoAlgorithmSHA256.cpp: * crypto/algorithms/CryptoAlgorithmSHA384.cpp: * crypto/algorithms/CryptoAlgorithmSHA512.cpp: LayoutTests: * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-192-encrypt-decrypt.html: * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-256-encrypt-decrypt.html: * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html: * crypto/subtle/aes-cbc-encrypt-decrypt.html: * crypto/subtle/aes-cbc-generate-key-expected.txt: * crypto/subtle/aes-cbc-generate-key.html: * crypto/subtle/aes-cbc-import-jwk-expected.txt: * crypto/subtle/aes-cbc-import-jwk.html: * crypto/subtle/aes-cbc-invalid-length-expected.txt: * crypto/subtle/aes-cbc-invalid-length.html: * crypto/subtle/aes-cbc-unwrap-failure-expected.txt: * crypto/subtle/aes-cbc-unwrap-failure.html: * crypto/subtle/aes-cbc-unwrap-rsa-expected.txt: * crypto/subtle/aes-cbc-unwrap-rsa.html: * crypto/subtle/aes-cbc-wrap-rsa-expected.txt: * crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt: * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html: * crypto/subtle/aes-cbc-wrap-rsa.html: * crypto/subtle/aes-kw-key-manipulation-expected.txt: * crypto/subtle/aes-kw-key-manipulation.html: * crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt: * crypto/subtle/aes-kw-wrap-unwrap-aes.html: * crypto/subtle/aes-postMessage-expected.txt: * crypto/subtle/aes-postMessage.html: * crypto/subtle/hmac-generate-key-expected.txt: * crypto/subtle/hmac-generate-key.html: * crypto/subtle/hmac-import-jwk-expected.txt: * crypto/subtle/hmac-import-jwk.html: * crypto/subtle/hmac-postMessage-expected.txt: * crypto/subtle/hmac-postMessage.html: * crypto/subtle/hmac-sign-verify-empty-key-expected.txt: * crypto/subtle/hmac-sign-verify-empty-key.html: * crypto/subtle/hmac-sign-verify-expected.txt: * crypto/subtle/hmac-sign-verify.html: * crypto/subtle/postMessage-worker-expected.txt: * crypto/subtle/postMessage-worker.html: * crypto/subtle/resources/postMessage-worker.js: * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: * crypto/subtle/rsa-oaep-key-manipulation.html: * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: * crypto/subtle/rsa-postMessage-expected.txt: * crypto/subtle/rsa-postMessage.html: * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 11 Dec, 2013 1 commit
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125590 Reviewed by Oliver Hunt. Source/WebCore: Tests: crypto/subtle/aes-postMessage.html crypto/subtle/hmac-postMessage.html crypto/subtle/postMessage-worker.html crypto/subtle/rsa-postMessage.html * crypto/CryptoAlgorithmIdentifier.h: (WebCore::CryptoAlgorithmIdentifier): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): AES_KW was added to WebCrypto spec editor's draft yesterday night. Now that we're adding a matching enum for structired clone serialization, it's as good a time as any to update the order of values to match. * bindings/js/SerializedScriptValue.cpp: (WebCore::countUsages): (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::read): (WebCore::CloneDeserializer::readHMACKey): (WebCore::CloneDeserializer::readAESKey): (WebCore::CloneDeserializer::readRSAKey): (WebCore::CloneDeserializer::readCryptoKey): (WebCore::CloneDeserializer::readTerminal): Added serialization/deserialization for CryptoKey. This doesn't update version number, because we don't currently store structured clones in persistent storage - and even if we did, we wouldn't want to invalidate everything users already stored. * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::shared): (WebCore::registryMutex): (WebCore::CryptoAlgorithmRegistry::getIdentifierForName): (WebCore::CryptoAlgorithmRegistry::nameForIdentifier): (WebCore::CryptoAlgorithmRegistry::create): (WebCore::CryptoAlgorithmRegistry::registerAlgorithm): * crypto/CryptoKey.idl: With structured clone, it is now possible to send a Key to a web worker. That's of no practical use because the crypto API is not exposed in workers, but we shouldn't crash anyway. * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::CryptoKeyAES): (WebCore::CryptoKeyAES::isValidAESAlgorithm): * crypto/keys/CryptoKeyAES.h: Exposed isValidAESAlgorithm, so that a caller could know whether the constructor will assert. * CMakeLists.txt: * GNUmakefile.am: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.vcxproj/WebCoreCommon.props: Added crypto/keys to search paths to avoid build breakage. LayoutTests: * crypto/subtle/aes-postMessage-expected.txt: Added. * crypto/subtle/aes-postMessage.html: Added. * crypto/subtle/hmac-postMessage-expected.txt: Added. * crypto/subtle/hmac-postMessage.html: Added. * crypto/subtle/postMessage-worker-expected.txt: Added. * crypto/subtle/postMessage-worker.html: Added. * crypto/subtle/rsa-postMessage-expected.txt: Added. * crypto/subtle/rsa-postMessage.html: Added. * crypto/subtle/resources/postMessage-worker.js: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 03 Dec, 2013 3 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124218 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/jwk-export-use-values.html crypto/subtle/jwk-import-use-values.html 1. "extractable" renamed to "ext" in JWK. 2. New values for "use" mapping, which can now be combined into comma separated lists, and cover all possible WebCrypto usages. * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): (WebCore::JSCryptoKeySerializationJWK::reconcileExtractable): (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): (WebCore::processUseValue): (WebCore::JSCryptoKeySerializationJWK::addJWKUseToJSON): (WebCore::JSCryptoKeySerializationJWK::serialize): LayoutTests: * crypto/subtle/jwk-export-use-values-expected.txt: Added. * crypto/subtle/jwk-export-use-values.html: Added. * crypto/subtle/jwk-import-use-values-expected.txt: Added. * crypto/subtle/jwk-import-use-values.html: Added. New tests for "use" mapping. * crypto/subtle/aes-cbc-import-jwk.html: * crypto/subtle/aes-cbc-unwrap-rsa.html: * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html: * crypto/subtle/aes-cbc-wrap-rsa.html: * crypto/subtle/aes-export-key-expected.txt: * crypto/subtle/aes-export-key.html: * crypto/subtle/hmac-export-key-expected.txt: * crypto/subtle/hmac-export-key.html: * crypto/subtle/hmac-import-jwk.html: * crypto/subtle/import-jwk-expected.txt: * crypto/subtle/import-jwk.html: * crypto/subtle/rsa-export-key-expected.txt: * crypto/subtle/rsa-export-key.html: * crypto/subtle/rsa-export-private-key-expected.txt: * crypto/subtle/rsa-export-private-key.html: * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: * crypto/subtle/rsa-oaep-key-manipulation.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124483 Reviewed by Anders Carlsson. Source/WebCore: Test: crypto/subtle/rsa-export-private-key.html It might be better to have our own bignum implementation in WTF, but we currently don't, and the need for this computation is Common Crypto specific anyway. * crypto/CommonCryptoUtilities.h: * crypto/CommonCryptoUtilities.cpp: (WebCore::CCBigNum::CCBigNum): (WebCore::CCBigNum::~CCBigNum): (WebCore::CCBigNum::operator=): (WebCore::CCBigNum::data): (WebCore::CCBigNum::operator-): (WebCore::CCBigNum::operator%): (WebCore::CCBigNum::inverse): Added a minimal wrapper around CommonCrypto BigNum. * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::getPrivateKeyComponents): Compute missing parts using CCBigNum. (WebCore::CryptoKeyRSA::exportData): Implemented private key case. LayoutTests: * crypto/subtle/rsa-export-private-key-expected.txt: Added. * crypto/subtle/rsa-export-private-key.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160029 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125114 Update layout test result for a last minute change in test content. * crypto/subtle/hmac-check-algorithm-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 02 Dec, 2013 3 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125114 Reviewed by Anders Carlsson. Source/WebCore: Test: crypto/subtle/hmac-check-algorithm.html * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::keyAlgorithmMatches): Check it. LayoutTests: * crypto/subtle/hmac-check-algorithm-expected.txt: Added. * crypto/subtle/hmac-check-algorithm.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125105 Reviewed by Sam Weinig. Source/WebCore: Tests: crypto/subtle/aes-kw-key-manipulation.html crypto/subtle/aes-kw-wrap-unwrap-aes.html * WebCore.xcodeproj/project.pbxproj: Added new files. * crypto/CryptoAlgorithmIdentifier.h: (WebCore::CryptoAlgorithmIdentifier): Added AES-KW. It's not standardized yet, but there appears to be a consensus that it will be specified. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Added AES-KW cases everywhere. * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): Support importing/exporting AES-KW keys in JWK. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::importKey): (WebCore::JSSubtleCrypto::exportKey): (WebCore::JSSubtleCrypto::wrapKey): (WebCore::JSSubtleCrypto::unwrapKey): Added some accidentally forgotten std::moves. * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: Added. * crypto/algorithms/CryptoAlgorithmAES_KW.h: Added. * crypto/mac/CryptoAlgorithmAES_KWMac.cpp: Added. * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::CryptoKeyAES): Allow AES-KW as valid algorithm for AES keys. * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register AES-KW. LayoutTests: * crypto/subtle/aes-kw-key-manipulation-expected.txt: Added. * crypto/subtle/aes-kw-key-manipulation.html: Added. * crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt: Added. * crypto/subtle/aes-kw-wrap-unwrap-aes.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=125084 Reviewed by Sam Weinig. Source/WebCore: Tests: crypto/subtle/rsa-oaep-key-manipulation.html crypto/subtle/rsa-oaep-plaintext-length.html crypto/subtle/rsa-oaep-wrap-unwrap-aes.html * WebCore.xcodeproj/project.pbxproj: Added new files. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createRsaOaepParams): (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added RSA-OAEP parameters. * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): Support RSA-OAEP in JWK. It is more limited than general WebCrypto, as JWK only allows SHA-1 as hash. * crypto/CommonCryptoUtilities.cpp: Added. (WebCore::getCommonCryptoDigestAlgorithm): * crypto/CommonCryptoUtilities.h: Added. Extracted some shared code and forward declarations for CommonCrypto. * crypto/CryptoAlgorithmParameters.h: (WebCore::CryptoAlgorithmParameters::Class): * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added. Added RsaOaepParams. * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: Added. * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Added. * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: Added. * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::getCommonCryptoHMACAlgorithm): (WebCore::CryptoAlgorithmHMAC::platformSign): (WebCore::CryptoAlgorithmHMAC::platformVerify): * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: * crypto/mac/CryptoKeyMac.cpp: * crypto/mac/CryptoKeyRSAMac.cpp: Use CommonCryptoUtilities. * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSA-OAEP. LayoutTests: * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: Added. * crypto/subtle/rsa-oaep-key-manipulation.html: Added. * crypto/subtle/rsa-oaep-plaintext-length-expected.txt: Added. * crypto/subtle/rsa-oaep-plaintext-length.html: Added. * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Added. * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 21 Nov, 2013 2 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124738 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html crypto/subtle/aes-cbc-wrap-rsa.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::exportKey): Factored out the actual operation that can be chained with encryption for wrapKey. (WebCore::JSSubtleCrypto::exportKey): (WebCore::JSSubtleCrypto::wrapKey): (WebCore::JSSubtleCrypto::unwrapKey): Fixed a memory leak in failure code path. * crypto/SubtleCrypto.idl: Added wrapKey. LayoutTests: * crypto/subtle/aes-cbc-wrap-rsa-expected.txt: Added. * crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt: Added. * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html: Added. * crypto/subtle/aes-cbc-wrap-rsa.html: Added. * crypto/subtle/aes-export-key-expected.txt: * crypto/subtle/hmac-export-key-expected.txt: There is no longer a console message, the error is in an exception. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124725 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/aes-cbc-unwrap-failure.html crypto/subtle/aes-cbc-unwrap-rsa.html * bindings/js/JSCryptoAlgorithmDictionary.cpp: * bindings/js/JSCryptoAlgorithmDictionary.h: Removed calls for wrap/unwrap parameter parsing, these are just the same as encrypt/decrypt. * bindings/js/JSCryptoOperationData.cpp: (WebCore::cryptoOperationDataFromJSValue): * bindings/js/JSCryptoOperationData.h: * crypto/CryptoKeySerialization.h: More Vector<char> elimination. * bindings/js/JSDOMPromise.cpp: * bindings/js/JSDOMPromise.h: Removed unneccessary copy constructor and assignment operator, they are no diffdrent than compiler generated ones. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::cryptoKeyUsagesFromJSValue): Minor style fixes. (WebCore::JSSubtleCrypto::encrypt): Ditto. (WebCore::JSSubtleCrypto::decrypt): Ditto. (WebCore::JSSubtleCrypto::sign): Ditto. (WebCore::JSSubtleCrypto::verify): Ditto. (WebCore::JSSubtleCrypto::generateKey): Ditto. (WebCore::importKey): Separated actual import operation and the parts that read arguments from ExecState, and call the promise. Logically, this should be outside of bindings code even, but JWK makes that quite challenging. (WebCore::JSSubtleCrypto::importKey): This only does the more mundane arguments and return parts now. (WebCore::JSSubtleCrypto::exportKey): Minor style fixes. (WebCore::JSSubtleCrypto::unwrapKey): Chain decrypt and import. * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::encryptForWrapKey): (WebCore::CryptoAlgorithm::decryptForUnwrapKey): * crypto/CryptoAlgorithm.h: There are algorithms that expose wrap/unwrap, but not encrypt/decrypt. These will override these new functions, and leave encrypt/decrypt to raise NOT_SUPPORTED_ERR. * crypto/SubtleCrypto.idl: Added unwrapKey. LayoutTests: * crypto/subtle/aes-cbc-unwrap-failure-expected.txt: Added. * crypto/subtle/aes-cbc-unwrap-failure.html: Added. * crypto/subtle/aes-cbc-unwrap-rsa-expected.txt: Added. * crypto/subtle/aes-cbc-unwrap-rsa.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 18 Nov, 2013 1 commit
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124475 Reviewed by Sam Weinig. Source/WebCore: Test: crypto/subtle/rsa-export-key.html * bindings/js/JSCryptoKeySerializationJWK.h: * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::buildJSONForRSAComponents): (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): (WebCore::JSCryptoKeySerializationJWK::serialize): Added said support (this part works with private keys too). * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::getPublicKeyComponents): Moved the logic for getting a public key from private one here for reuse in keySizeInBits(). (WebCore::CryptoKeyRSA::isRestrictedToHash): (WebCore::CryptoKeyRSA::keySizeInBits): (WebCore::CryptoKeyRSA::exportData): Exposed information necessary for JWK serialization. LayoutTests: * crypto/subtle/rsa-export-key-expected.txt: Added. * crypto/subtle/rsa-export-key.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 17 Nov, 2013 2 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124472 Reviewed by Sam Weinig. Source/WebCore: Test: crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): Added the checks. (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Check key size when importing. (WebCore::JSCryptoKeySerializationJWK::serialize): Updated a comment. * crypto/keys/CryptoKeySerializationRaw.cpp: (WebCore::CryptoKeySerializationRaw::serialize): Updated a comment. LayoutTests: * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124473 Reviewed by Sam Weinig. Source/WebCore: * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::exportKey): Fix it. LayoutTests: * crypto/subtle/aes-export-key.html: * crypto/subtle/hmac-export-key.html: * crypto/subtle/resources/common.js: (bytesToASCIIString): Added a function that converts an ArrayBuffer to a string, assuming it's all ASCII. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 16 Nov, 2013 2 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124451 Reviewed by Sam Weinig. Source/WebCore: Covered by existing tests. Changed all operations to take single CryptoOperationData objects. * bindings/js/JSCryptoOperationData.cpp: * bindings/js/JSCryptoOperationData.h: * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::encrypt): (WebCore::JSSubtleCrypto::decrypt): (WebCore::JSSubtleCrypto::sign): (WebCore::JSSubtleCrypto::verify): (WebCore::JSSubtleCrypto::digest): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::encrypt): (WebCore::CryptoAlgorithm::decrypt): (WebCore::CryptoAlgorithm::sign): (WebCore::CryptoAlgorithm::verify): (WebCore::CryptoAlgorithm::digest): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::digest): * crypto/algorithms/CryptoAlgorithmSHA1.h: * crypto/algorithms/CryptoAlgorithmSHA224.cpp: (WebCore::CryptoAlgorithmSHA224::digest): * crypto/algorithms/CryptoAlgorithmSHA224.h: * crypto/algorithms/CryptoAlgorithmSHA256.cpp: (WebCore::CryptoAlgorithmSHA256::digest): * crypto/algorithms/CryptoAlgorithmSHA256.h: * crypto/algorithms/CryptoAlgorithmSHA384.cpp: (WebCore::CryptoAlgorithmSHA384::digest): * crypto/algorithms/CryptoAlgorithmSHA384.h: * crypto/algorithms/CryptoAlgorithmSHA512.cpp: (WebCore::CryptoAlgorithmSHA512::digest): * crypto/algorithms/CryptoAlgorithmSHA512.h: * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::transformAES_CBC): (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::calculateSignature): (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: LayoutTests: Updated tests accordingly. * crypto/subtle/aes-cbc-192-encrypt-decrypt.html: * crypto/subtle/aes-cbc-256-encrypt-decrypt.html: * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html: * crypto/subtle/aes-cbc-encrypt-decrypt.html: * crypto/subtle/aes-cbc-import-jwk.html: * crypto/subtle/aes-cbc-wrong-key-class-expected.txt: * crypto/subtle/aes-cbc-wrong-key-class.html: * crypto/subtle/argument-conversion-expected.txt: * crypto/subtle/argument-conversion.html: * crypto/subtle/hmac-import-jwk.html: * crypto/subtle/hmac-sign-verify-empty-key.html: * crypto/subtle/hmac-sign-verify.html: * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html: * crypto/subtle/sha-1-expected.txt: * crypto/subtle/sha-1.html: * crypto/subtle/sha-224-expected.txt: * crypto/subtle/sha-224.html: * crypto/subtle/sha-256-expected.txt: * crypto/subtle/sha-256.html: * crypto/subtle/sha-384-expected.txt: * crypto/subtle/sha-384.html: * crypto/subtle/sha-512-expected.txt: * crypto/subtle/sha-512.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124442 Reviewed by Sam Weinig. Source/JavaScriptCore: * runtime/JSONObject.h: Export JSONStringify. Source/WebCore: Error handling is not consistent yet - some errors cause exceptions, and others result in rejected promises. This part of spec is incomplete, so I basically did what was most straightforward in each case. * bindings/js/JSCryptoKeySerializationJWK.h: * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): Updated a comment with a better link. (WebCore::JSCryptoKeySerializationJWK::buildJSONForOctetSequence): A helper to building JWK. (WebCore::JSCryptoKeySerializationJWK::addToJSON): Ditto. (WebCore::JSCryptoKeySerializationJWK::addBoolToJSON): Ditto. (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): Ditto. The code for mapping is my best guess, this all needs to be specified. (WebCore::JSCryptoKeySerializationJWK::addJWKUseToJSON): A helper to building JWK. (WebCore::JSCryptoKeySerializationJWK::serialize): Build a JSON string for the key. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::importKey): Updated a comment. (WebCore::JSSubtleCrypto::exportKey): Use CryptoKeySerialization (also for raw keys, for consistency). * crypto/CryptoKey.h: (WebCore::CryptoKey::algorithmIdentifier): (WebCore::CryptoKey::usagesBitmap): Exposed data needed for building JWK (it used to be only exposed in a form suitable for DOM accessors). * crypto/keys/CryptoKeyHMAC.h: Ditto, added an accessor for JWK. * crypto/keys/CryptoKeySerializationRaw.cpp: (WebCore::CryptoKeySerializationRaw::serialize): * crypto/keys/CryptoKeySerializationRaw.h: Moved from JSSubtleCryptoCustom.cpp for consistency. Source/WTF: Base64URL encoding doesn't use '=' padding, and doesn't need any other options. Added this mode for encode, and removed policy arguments from exposed functions. * wtf/text/Base64.cpp: (WTF::base64EncodeInternal): (WTF::base64URLEncode): (WTF::base64URLDecode): * wtf/text/Base64.h: (WTF::base64URLEncode): LayoutTests: * crypto/subtle/aes-export-key-expected.txt: * crypto/subtle/aes-export-key.html: * crypto/subtle/hmac-export-key-expected.txt: * crypto/subtle/hmac-export-key.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 14 Nov, 2013 4 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124388 Reviewed by Anders Carlsson. Updated tests for newer common.js. Changed some tests from just dumping results to comparing them to known expected ones. Fixed a syntax error in aes-cbc-invalid-length.html, so it now actually runs. * crypto/subtle/resources/common.js: Update to a new version from Blink, because it's much nicer than the old one, and it's good to be compatible at test level. Moved crypto.subtle definition from webkitSubtle here to avoid repeating it in all tests. Added a quick and dirty Promise.all implementation. * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-192-encrypt-decrypt.html: * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-256-encrypt-decrypt.html: * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt: * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html: * crypto/subtle/aes-cbc-encrypt-decrypt.html: * crypto/subtle/aes-cbc-generate-key.html: * crypto/subtle/aes-cbc-import-jwk-expected.txt: * crypto/subtle/aes-cbc-import-jwk.html: * crypto/subtle/aes-cbc-invalid-length-expected.txt: * crypto/subtle/aes-cbc-invalid-length.html: * crypto/subtle/aes-cbc-wrong-key-class.html: * crypto/subtle/aes-export-key-expected.txt: * crypto/subtle/aes-export-key.html: * crypto/subtle/argument-conversion-expected.txt: * crypto/subtle/argument-conversion.html: * crypto/subtle/hmac-export-key-expected.txt: * crypto/subtle/hmac-export-key.html: * crypto/subtle/hmac-generate-key.html: * crypto/subtle/hmac-import-jwk-expected.txt: * crypto/subtle/hmac-import-jwk.html: * crypto/subtle/hmac-sign-verify-empty-key-expected.txt: * crypto/subtle/hmac-sign-verify-empty-key.html: * crypto/subtle/hmac-sign-verify-expected.txt: * crypto/subtle/hmac-sign-verify.html: * crypto/subtle/import-jwk-expected.txt: * crypto/subtle/import-jwk.html: * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt: * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html: * crypto/subtle/sha-1-expected.txt: * crypto/subtle/sha-1.html: * crypto/subtle/sha-224-expected.txt: * crypto/subtle/sha-224.html: * crypto/subtle/sha-256-expected.txt: * crypto/subtle/sha-256.html: * crypto/subtle/sha-384-expected.txt: * crypto/subtle/sha-384.html: * crypto/subtle/sha-512-expected.txt: * crypto/subtle/sha-512.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124376 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/aes-export-key.html crypto/subtle/hmac-export-key.html A CryptoKey just exports its native CryptoKeyData, which will also work nicely for JWK format soon. For spki and pkcs8, we'll need to figure out the best way to utilize platform library support for ASN.1, but we are not there yet. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::exportKey): * crypto/CryptoKey.h: * crypto/SubtleCrypto.idl: * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::exportData): * crypto/keys/CryptoKeyAES.h: * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::exportData): * crypto/keys/CryptoKeyHMAC.h: * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::exportData): Added a dummy implementation for RSA. LayoutTests: * crypto/subtle/aes-export-key-expected.txt: Added. * crypto/subtle/aes-export-key.html: Added. * crypto/subtle/hmac-export-key-expected.txt: Added. * crypto/subtle/hmac-export-key.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124372 Reviewed by Sam Weinig. Source/WebCore: Test: crypto/subtle/hmac-sign-verify-empty-key.html * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::calculateSignature): Give it a non-null pointer then. LayoutTests: * crypto/subtle/hmac-sign-verify-empty-key-expected.txt: Added. * crypto/subtle/hmac-sign-verify-empty-key.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124335 Reviewed by Sam Weinig. Source/WebCore: Test: crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html * WebCore.xcodeproj/project.pbxproj: Added new files, removed Mac SHA algorithm files. * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::getCommonCryptoDigestAlgorithm): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Implemented. These take two steps, first a digest is computed, and then it's signed. * crypto/CryptoDigest.h: Added. * crypto/mac/CryptoDigestMac.cpp: Added. (WebCore::CryptoDigest::CryptoDigest): (WebCore::CryptoDigest::~CryptoDigest): (WebCore::CryptoDigest::create): (WebCore::CryptoDigest::addBytes): (WebCore::CryptoDigest::computeHash): Added a cross-platform interface and Mac implementation to compute a digest. It should be possible to use it outside WebCrypto if we need to (perhaps even merge with WTF SHA-1 class). The Mac implementation is kind of ugly, but at least it encapsulates the ugliness. * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::digest): * crypto/algorithms/CryptoAlgorithmSHA224.cpp: (WebCore::CryptoAlgorithmSHA224::digest): * crypto/algorithms/CryptoAlgorithmSHA256.cpp: (WebCore::CryptoAlgorithmSHA256::digest): * crypto/algorithms/CryptoAlgorithmSHA384.cpp: (WebCore::CryptoAlgorithmSHA384::digest): * crypto/algorithms/CryptoAlgorithmSHA512.cpp: (WebCore::CryptoAlgorithmSHA512::digest): * crypto/mac/CryptoAlgorithmSHA1Mac.cpp: Removed. * crypto/mac/CryptoAlgorithmSHA224Mac.cpp: Removed. * crypto/mac/CryptoAlgorithmSHA256Mac.cpp: Removed. * crypto/mac/CryptoAlgorithmSHA384Mac.cpp: Removed. * crypto/mac/CryptoAlgorithmSHA512Mac.cpp: Removed. These are all cross-platform now. LayoutTests: * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159292 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 13 Nov, 2013 2 commits
-
-
commit-queue@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=124175 Patch by Victor Costan <costan@gmail.com> on 2013-11-13 Reviewed by Christophe Dumez. Added test cases to fast/files/script-tests/blob-constructor.js. * bindings/js/JSBlobCustom.cpp: Make the constructor work with sequences. (WebCore::JSBlobConstructor::constructJSBlob): * bindings/js/JSDOMBinding.h: (WebCore::toJSSequence): Slightly better error message when conversion fails. (WebCore::toJS): Whitespace. (WebCore::jsArray): Whitespace. LayoutTests: Blob constructor accepts a sequence (array-like object) as first arg. https://bugs.webkit.org/show_bug.cgi?id=124175 Patch by Victor Costan <costan@gmail.com> on 2013-11-13 Reviewed by Christophe Dumez. * crypto/subtle/argument-conversion-expected.txt: Updated sequence error expectations. * fast/dom/Window/window-postmessage-args-expected.txt: Updated sequence error expectations. * fast/events/constructors/message-event-constructor-expected.txt: Updated sequence error expectations. * fast/events/message-port-multi-expected.txt: Updated sequence error expectations. * fast/files/blob-constructor-expected.txt: Updated error text and added expectations. * fast/files/script-tests/blob-constructor.js: Added sequence test cases. * fast/workers/worker-context-multi-port-expected.txt: Updated sequence error expectations. * fast/workers/worker-multi-port-expected.txt: Updated sequence error expectations. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124236 Reviewed by Sam Weinig. Source/WebCore: Tests: crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html * WebCore.xcodeproj/project.pbxproj: Added new files. * bindings/js/JSCryptoAlgorithmBuilder.cpp: (WebCore::JSCryptoAlgorithmBuilder::add): * bindings/js/JSCryptoAlgorithmBuilder.h: * crypto/CryptoAlgorithmDescriptionBuilder.h: Added a way to add an Uint8Array, as needed for RSA key.algorithm.publicExponent. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesCbcParams): Removed unneeded JSC prefixes. (WebCore::createAesKeyGenParams): Ditto. (WebCore::createHmacParams): Ditto. (WebCore::createHmacKeyParams): Ditto. (WebCore::createRsaKeyGenParams): Added. (WebCore::createRsaSsaKeyParams): Added. WebCrypto currently doesn't specify any parameters for importKey, so the structure remains blank (unlike with JWK). (WebCore::createRsaSsaParams): Added (currently unused, will be sued for sign/verify soon). (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Removed unneeded JSC prefixes. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Added support for RSAES_PKCS1_v1_5. (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Removed unneeded JSC prefixes. (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added support for RSAES_PKCS1_v1_5. (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Removed unneeded JSC prefixes. (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): Ditto. * bindings/js/JSCryptoKeySerializationJWK.h: * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::getJSArrayFromJSON): Added. (WebCore::getBigIntegerVectorFromJSON): Added. (WebCore::createRSASSAKeyParameters): Create parameters for key import. The key will remember which algorithm it's allowed to be used with. (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): Added support for RS256...RS512 (tha is, RSAES_PKCS1_v1_5 with SHA-256...SHA-512). (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): Split out of keyData(). (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Added code to read RSA key components from JWK. (WebCore::JSCryptoKeySerializationJWK::keyData): Call one of the above functions. * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Added. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Placeholders. * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): Added RSA key class for poor man's RTTI. * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::FormatRSAComponents): Added RSAComponents for poor man's RTTI. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/keys/CryptoKeyAES.h: (WebCore::isCryptoKeyAES): (WebCore::toCryptoKeyAES): * crypto/keys/CryptoKeyDataOctetSequence.h: (WebCore::toCryptoKeyDataOctetSequence): * crypto/keys/CryptoKeyHMAC.h: (WebCore::isCryptoKeyHMAC): (WebCore::toCryptoKeyHMAC): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): Switched from "as" functions to "is" and "to" ones, as that's more idiomatic. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Added. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Added. Glue code for importKey/generateKey for now. * crypto/keys/CryptoKeyDataRSAComponents.cpp: Added. (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): * crypto/keys/CryptoKeyDataRSAComponents.h: Added. (WebCore::toCryptoKeyDataRSAComponents): Added a structure to hold RSA key components, extracted from JWK or another format. * crypto/keys/CryptoKeyRSA.h: Added. * crypto/mac/CryptoKeyRSAMac.cpp: Added. * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSASSA_PKCS1_v1_5. * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added a constructor to make sure that hasLength is never left uninitialized, even when reading formats that don't contain a length. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Added. Added parameter structures that are needed for RSASSA_PKCS1_v1_5. LayoutTests: * crypto/subtle/resources/common.js: (hexToArrayBuffer): Fixed a typo (Base64URL.stringify): (Base64URL.parse): Added helpers to deal with Base64URL, as needed for JWK. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 12 Nov, 2013 3 commits
-
-
commit-queue@webkit.org authored
http://trac.webkit.org/changeset/159160 http://trac.webkit.org/changeset/159161 http://trac.webkit.org/changeset/159164 https://bugs.webkit.org/show_bug.cgi?id=124253 Too many errors (make fewer) (Requested by ap on #webkit). Source/WebCore: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCryptoAlgorithmBuilder.cpp: * bindings/js/JSCryptoAlgorithmBuilder.h: * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesCbcParams): (WebCore::createAesKeyGenParams): (WebCore::createHmacParams): (WebCore::createHmacKeyParams): (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): (WebCore::JSCryptoKeySerializationJWK::keyData): * bindings/js/JSCryptoKeySerializationJWK.h: * crypto/CryptoAlgorithmDescriptionBuilder.h: * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Removed. * crypto/CryptoKey.h: (WebCore::ENUM_CLASS): * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::ENUM_CLASS): * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Removed. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Removed. * crypto/keys/CryptoKeyAES.h: (WebCore::asCryptoKeyAES): * crypto/keys/CryptoKeyDataOctetSequence.h: (WebCore::asCryptoKeyDataOctetSequence): * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed. * crypto/keys/CryptoKeyDataRSAComponents.h: Removed. * crypto/keys/CryptoKeyHMAC.h: (WebCore::asCryptoKeyHMAC): * crypto/keys/CryptoKeyRSA.h: Removed. * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): * crypto/mac/CryptoKeyRSAMac.cpp: Removed. * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Removed. * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Removed. * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Removed. LayoutTests: * crypto/subtle/resources/common.js: (hexToArrayBuffer): * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Removed. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Removed. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Removed. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Removed. * platform/mac/TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124236 Source/WebCore: Build fix. * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::buildAlgorithmDescription): ifdef out some code on Mountain Lion. Bug 124249 track fixing this. LayoutTests: * platform/mac/TestExpectations: Update expectations for Mountain Lion. I'll investigate this later. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Quickly fail is promise is rejected. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124236 Reviewed by Sam Weinig. Source/WebCore: Tests: crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html * WebCore.xcodeproj/project.pbxproj: Added new files. * bindings/js/JSCryptoAlgorithmBuilder.cpp: (WebCore::JSCryptoAlgorithmBuilder::add): * bindings/js/JSCryptoAlgorithmBuilder.h: * crypto/CryptoAlgorithmDescriptionBuilder.h: Added a way to add an Uint8Array, as needed for RSA key.algorithm.publicExponent. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesCbcParams): Removed unneeded JSC prefixes. (WebCore::createAesKeyGenParams): Ditto. (WebCore::createHmacParams): Ditto. (WebCore::createHmacKeyParams): Ditto. (WebCore::createRsaKeyGenParams): Added. (WebCore::createRsaSsaKeyParams): Added. WebCrypto currently doesn't specify any parameters for importKey, so the structure remains blank (unlike with JWK). (WebCore::createRsaSsaParams): Added (currently unused, will be sued for sign/verify soon). (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Removed unneeded JSC prefixes. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Added support for RSAES_PKCS1_v1_5. (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Removed unneeded JSC prefixes. (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added support for RSAES_PKCS1_v1_5. (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Removed unneeded JSC prefixes. (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): Ditto. * bindings/js/JSCryptoKeySerializationJWK.h: * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::getJSArrayFromJSON): Added. (WebCore::getBigIntegerVectorFromJSON): Added. (WebCore::createRSASSAKeyParameters): Create parameters for key import. The key will remember which algorithm it's allowed to be used with. (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): Added support for RS256...RS512 (tha is, RSAES_PKCS1_v1_5 with SHA-256...SHA-512). (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): Split out of keyData(). (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Added code to read RSA key components from JWK. (WebCore::JSCryptoKeySerializationJWK::keyData): Call one of the above functions. * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Added. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Placeholders. * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): Added RSA key class for poor man's RTTI. * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::FormatRSAComponents): Added RSAComponents for poor man's RTTI. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/keys/CryptoKeyAES.h: (WebCore::isCryptoKeyAES): (WebCore::toCryptoKeyAES): * crypto/keys/CryptoKeyDataOctetSequence.h: (WebCore::toCryptoKeyDataOctetSequence): * crypto/keys/CryptoKeyHMAC.h: (WebCore::isCryptoKeyHMAC): (WebCore::toCryptoKeyHMAC): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): Switched from "as" functions to "is" and "to" ones, as that's more idiomatic. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Added. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Added. Glue code for importKey/generateKey for now. * crypto/keys/CryptoKeyDataRSAComponents.cpp: Added. (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): * crypto/keys/CryptoKeyDataRSAComponents.h: Added. (WebCore::toCryptoKeyDataRSAComponents): Added a structure to hold RSA key components, extracted from JWK or another format. * crypto/keys/CryptoKeyRSA.h: Added. * crypto/mac/CryptoKeyRSAMac.cpp: Added. * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSASSA_PKCS1_v1_5. * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added a constructor to make sure that hasLength is never left uninitialized, even when reading formats that don't contain a length. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Added. Added parameter structures that are needed for RSASSA_PKCS1_v1_5. LayoutTests: * crypto/subtle/resources/common.js: (hexToArrayBuffer): Fixed a typo (Base64URL.stringify): (Base64URL.parse): Added helpers to deal with Base64URL, as needed for JWK. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 08 Nov, 2013 1 commit
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=124059 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/aes-cbc-import-jwk.html crypto/subtle/hmac-import-jwk.html crypto/subtle/import-jwk.html WebCrypto supports multiple key formats - raw, pkcs8, spki, jwk. The design is that we'll transform these into parsed KeyData subclasses before passing to algorithms. CryptoKeySerialization is a base class for handling all these formats. * WebCore.xcodeproj/project.pbxproj: Added new files. Removed CryptoKeyFormat.h. * bindings/js/JSCryptoKeySerializationJWK.h: Added. * bindings/js/JSCryptoKeySerializationJWK.cpp: Added. (WebCore::getStringFromJSON): A helper. Note that we can rely on the object being a nice freshly parsed JSON, no getters or anything. (WebCore::getBooleanFromJSON): Ditto. (WebCore::JSCryptoKeySerializationJWK::JSCryptoKeySerializationJWK): (WebCore::JSCryptoKeySerializationJWK::~JSCryptoKeySerializationJWK): (WebCore::createHMACParameters): A simple helper. (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): WebCrypto API is weird, you can have algorithm parameters both inside a JWK key and passed as importKey() arguments. They need to agree, whatever that means for specific serialization's algorithm options (not all necessarily have a 1-1 matching to WebCrypto). (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): Take an intersection of usages. (WebCore::JSCryptoKeySerializationJWK::reconcileExtractable): Only extractable if both JWK and the caller agree. (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): Verify validity of JWK key. (WebCore::JSCryptoKeySerializationJWK::keyData): Return an appropriate KeyData subclass. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::ENUM_CLASS): Moved CryptoKeyFormat here. (WebCore::cryptoKeyFormatFromJSValue): Added a human readable string to an exception. (WebCore::JSSubtleCrypto::importKey): Support multiple key formats, not just raw. * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::importKey): * crypto/CryptoAlgorithm.h: Updated signature for importKey to one that makes more sense. Decoding formats all the way from a binary blob is not something that CryptoAlgorithm subclasses should do, we now pass a KeyData subclass instead. Removed exportKey/wrapKey/unwrapKey altogether, because I don't yet know what the signatures will be. * crypto/CryptoKeyData.h: Added. (WebCore::CryptoKeyData::ENUM_CLASS): (WebCore::CryptoKeyData::CryptoKeyData): (WebCore::CryptoKeyData::~CryptoKeyData): (WebCore::CryptoKeyData::format): A base class for passing key material to algorithms. Currently, only one type is supported, that being OctetSequence for secret keys. Keys for RSA and EC are more complicated, and secret/public ones are different too. * crypto/CryptoKeyFormat.h: Removed. There are too many key format classes confusingly floating around, and this was only needed in one file for parsing. * crypto/CryptoKeySerialization.h: Added. Base class for handling raw/pkcs8/spki/jwk keys. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: Updated to use CryptoKeyData. * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: Updated to use CryptoKeyData. * crypto/keys/CryptoKeyDataOctetSequence.cpp: Added. (WebCore::CryptoKeyDataOctetSequence::CryptoKeyDataOctetSequence): (WebCore::CryptoKeyDataOctetSequence::~CryptoKeyDataOctetSequence): * crypto/keys/CryptoKeyDataOctetSequence.h: Added. (WebCore::asCryptoKeyDataOctetSequence): * crypto/keys/CryptoKeySerializationRaw.cpp: Added. (WebCore::CryptoKeySerializationRaw::CryptoKeySerializationRaw): (WebCore::CryptoKeySerializationRaw::~CryptoKeySerializationRaw): (WebCore::CryptoKeySerializationRaw::reconcileAlgorithm): (WebCore::CryptoKeySerializationRaw::reconcileUsages): (WebCore::CryptoKeySerializationRaw::reconcileExtractable): (WebCore::CryptoKeySerializationRaw::keyData): * crypto/keys/CryptoKeySerializationRaw.h: Added. Much code to pass around a Vector<char>. LayoutTests: * crypto/subtle/aes-cbc-import-jwk-expected.txt: Added. * crypto/subtle/aes-cbc-import-jwk.html: Added. * crypto/subtle/hmac-import-jwk-expected.txt: Added. * crypto/subtle/hmac-import-jwk.html: Added. * crypto/subtle/import-jwk-expected.txt: Added. * crypto/subtle/import-jwk.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 04 Nov, 2013 2 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=123669 Reviewed by Dan Bernstein. Source/WebCore: Tests: crypto/subtle/aes-cbc-generate-key.html crypto/subtle/hmac-generate-key.html * WebCore.xcodeproj/project.pbxproj: Added new files. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesKeyGenParams): Added bindings for AesKeyGenParams. (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Handle algorithms that generate AES and HMAC keys. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::generateKey): Added. * crypto/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/CryptoKey.cpp: (WebCore::CryptoKey::randomData): * crypto/CryptoKey.h: * crypto/CryptoKeyMac.cpp: Added Expose a function that produces random data for symmetric crypto keys. Cross-platform implementation uses ARC4 code from WTF, while Mac uses a system function that provides a FIPS validated random number generator. * crypto/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/CryptoKeyAES.h: Added a function that creates AES keys. * crypto/SubtleCrypto.idl: Added generateKey. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): Added. * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): Added. * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyHMAC.h: Added a function that creates HMAC keys. * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: Removed generateKey stub, the implementation ended up in cross-platform file. * crypto/mac/CryptoAlgorithmHMACMac.cpp: Ditto. LayoutTests: * crypto/subtle/aes-cbc-generate-key-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key.html: Added. * crypto/subtle/hmac-generate-key-expected.txt: Added. * crypto/subtle/hmac-generate-key.html: Added. * crypto/subtle/sha-1-expected.txt: Now that crypto.webkitSubtle.generateKey exists, a different exception is raised. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
commit-queue@webkit.org authored
http://trac.webkit.org/changeset/158526 https://bugs.webkit.org/show_bug.cgi?id=123744 it broke the build (Requested by jessieberlin on #webkit). Source/WebCore: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesCbcParams): (WebCore::createHmacParams): (WebCore::createHmacKeyParams): (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): * bindings/js/JSSubtleCryptoCustom.cpp: * crypto/CryptoAlgorithmAesKeyGenParams.h: Removed. * crypto/CryptoKey.cpp: * crypto/CryptoKey.h: * crypto/CryptoKeyAES.cpp: * crypto/CryptoKeyAES.h: * crypto/CryptoKeyMac.cpp: Removed. * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: * crypto/keys/CryptoKeyHMAC.cpp: * crypto/keys/CryptoKeyHMAC.h: * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): LayoutTests: * crypto/subtle/aes-cbc-generate-key-expected.txt: Removed. * crypto/subtle/aes-cbc-generate-key.html: Removed. * crypto/subtle/hmac-generate-key-expected.txt: Removed. * crypto/subtle/hmac-generate-key.html: Removed. * crypto/subtle/sha-1-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 03 Nov, 2013 1 commit
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=123669 Reviewed by Dan Bernstein. Source/WebCore: Tests: crypto/subtle/aes-cbc-generate-key.html crypto/subtle/hmac-generate-key.html * WebCore.xcodeproj/project.pbxproj: Added new files. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesKeyGenParams): Added bindings for AesKeyGenParams. (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Handle algorithms that generate AES and HMAC keys. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::generateKey): Added. * crypto/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/CryptoKey.cpp: (WebCore::CryptoKey::randomData): * crypto/CryptoKey.h: * crypto/CryptoKeyMac.cpp: Added Expose a function that produces random data for symmetric crypto keys. Cross-platform implementation uses ARC4 code from WTF, while Mac uses a system function that provides a FIPS validated random number generator. * crypto/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/CryptoKeyAES.h: Added a function that creates AES keys. * crypto/SubtleCrypto.idl: Added generateKey. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): Added. * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): Added. * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyHMAC.h: Added a function that creates HMAC keys. * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: Removed generateKey stub, the implementation ended up in cross-platform file. * crypto/mac/CryptoAlgorithmHMACMac.cpp: Ditto. LayoutTests: * crypto/subtle/aes-cbc-generate-key-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key.html: Added. * crypto/subtle/hmac-generate-key-expected.txt: Added. * crypto/subtle/hmac-generate-key.html: Added. * crypto/subtle/sha-1-expected.txt: Now that crypto.webkitSubtle.generateKey exists, a different exception is raised. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 02 Nov, 2013 2 commits
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=123659 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/sha-224.html crypto/subtle/sha-256.html crypto/subtle/sha-384.html crypto/subtle/sha-512.html * WebCore.xcodeproj/project.pbxproj: * crypto/algorithms/CryptoAlgorithmSHA224.cpp: Added. (WebCore::CryptoAlgorithmSHA224::CryptoAlgorithmSHA224): (WebCore::CryptoAlgorithmSHA224::~CryptoAlgorithmSHA224): (WebCore::CryptoAlgorithmSHA224::create): (WebCore::CryptoAlgorithmSHA224::identifier): * crypto/algorithms/CryptoAlgorithmSHA224.h: Added. * crypto/algorithms/CryptoAlgorithmSHA256.cpp: Added. (WebCore::CryptoAlgorithmSHA256::CryptoAlgorithmSHA256): (WebCore::CryptoAlgorithmSHA256::~CryptoAlgorithmSHA256): (WebCore::CryptoAlgorithmSHA256::create): (WebCore::CryptoAlgorithmSHA256::identifier): * crypto/algorithms/CryptoAlgorithmSHA256.h: Added. * crypto/algorithms/CryptoAlgorithmSHA384.cpp: Added. (WebCore::CryptoAlgorithmSHA384::CryptoAlgorithmSHA384): (WebCore::CryptoAlgorithmSHA384::~CryptoAlgorithmSHA384): (WebCore::CryptoAlgorithmSHA384::create): (WebCore::CryptoAlgorithmSHA384::identifier): * crypto/algorithms/CryptoAlgorithmSHA384.h: Added. * crypto/algorithms/CryptoAlgorithmSHA512.cpp: Added. (WebCore::CryptoAlgorithmSHA512::CryptoAlgorithmSHA512): (WebCore::CryptoAlgorithmSHA512::~CryptoAlgorithmSHA512): (WebCore::CryptoAlgorithmSHA512::create): (WebCore::CryptoAlgorithmSHA512::identifier): * crypto/algorithms/CryptoAlgorithmSHA512.h: Added. * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): * crypto/mac/CryptoAlgorithmSHA224Mac.cpp: Added. (WebCore::CryptoAlgorithmSHA224::digest): * crypto/mac/CryptoAlgorithmSHA256Mac.cpp: Added. (WebCore::CryptoAlgorithmSHA256::digest): * crypto/mac/CryptoAlgorithmSHA384Mac.cpp: Added. (WebCore::CryptoAlgorithmSHA384::digest): * crypto/mac/CryptoAlgorithmSHA512Mac.cpp: Added. (WebCore::CryptoAlgorithmSHA512::digest): LayoutTests: * crypto/subtle/sha-224-expected.txt: Added. * crypto/subtle/sha-224.html: Added. * crypto/subtle/sha-256-expected.txt: Added. * crypto/subtle/sha-256.html: Added. * crypto/subtle/sha-384-expected.txt: Added. * crypto/subtle/sha-384.html: Added. * crypto/subtle/sha-512-expected.txt: Added. * crypto/subtle/sha-512.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=123647 Reviewed by Anders Carlsson. Source/WebCore: Tests: crypto/subtle/aes-cbc-192-encrypt-decrypt.html crypto/subtle/aes-cbc-256-encrypt-decrypt.html crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html crypto/subtle/aes-cbc-encrypt-decrypt.html crypto/subtle/aes-cbc-invalid-length.html crypto/subtle/aes-cbc-wrong-key-class.html * WebCore.xcodeproj/project.pbxproj: Added new files. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::getProperty): Factored out a function to get a property as JSValue. (WebCore::getHashAlgorithm): Use it. (WebCore::createAesCbcParams): Added converter for AesCbcParams. (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Support AES_CBC. (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto. (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Support all algorithms, all the new ones just have trivial dictionaries. (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Ditto. * bindings/js/JSCryptoOperationData.cpp: Added. (WebCore::sequenceOfCryptoOperationDataFromJSValue): (WebCore::cryptoOperationDataFromJSValue): * bindings/js/JSCryptoOperationData.h: Added. Moved CryptoOperationData bindings out of JSSubtleCryptoCustom.cpp, so that we could use them in JSCryptoAlgorithmDictionary.cpp. * bindings/js/JSDOMPromise.h: (WebCore::PromiseWrapper::reject): Added a specialization to reject with null result. The spec doesn't actually say how algorithms fail. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::encrypt): Added. (WebCore::JSSubtleCrypto::decrypt): Ditto. (WebCore::JSSubtleCrypto::sign): Style fix. * crypto/CryptoAlgorithmAesCbcParams.h: Added. * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): * crypto/keys/CryptoKeyHMAC.h: (WebCore::asCryptoKeyHMAC): Added poor man's RTTI, so that we can safely upcast Keys passed fro JavaScript code. * crypto/CryptoKeyAES.cpp: Added. (WebCore::CryptoKeyAES::CryptoKeyAES): (WebCore::CryptoKeyAES::~CryptoKeyAES): (WebCore::CryptoKeyAES::buildAlgorithmDescription): * crypto/CryptoKeyAES.h: Added. (WebCore::asCryptoKeyAES): AES keys are the same for all algorithms, but they still need to remember the algorithm. * crypto/SubtleCrypto.idl: Added encrypt/decrypt. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: Added. (WebCore::CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC): (WebCore::CryptoAlgorithmAES_CBC::~CryptoAlgorithmAES_CBC): (WebCore::CryptoAlgorithmAES_CBC::create): (WebCore::CryptoAlgorithmAES_CBC::identifier): (WebCore::CryptoAlgorithmAES_CBC::importKey): (WebCore::CryptoAlgorithmAES_CBC::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: Added. * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: Added. (WebCore::transformAES_CBC): (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): (WebCore::CryptoAlgorithmAES_CBC::generateKey): Added. * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): Check key class before casting it to CryptoKeyHMAC. * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register AES-CBC on Mac, so that it can be used. Source/WTF: * wtf/FixedArray.h: (WTF::FixedArray::data): Added a const version of the function. * wtf/Vector.h: Added a comment to Vector constructor about how it is different from std::vector. LayoutTests: Part of aes-cbc-encrypt-decrypt.html test was taken from Blink. * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-192-encrypt-decrypt.html: Added. * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-256-encrypt-decrypt.html: Added. * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt: Added. * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html: Added. * crypto/subtle/aes-cbc-encrypt-decrypt.html: Added. * crypto/subtle/aes-cbc-invalid-length-expected.txt: Added. * crypto/subtle/aes-cbc-invalid-length.html: Added. * crypto/subtle/aes-cbc-wrong-key-class-expected.txt: Added. * crypto/subtle/aes-cbc-wrong-key-class.html: Added. * crypto/subtle/hmac-sign-verify-expected.txt: * crypto/subtle/hmac-sign-verify.html: Corrected a description. * crypto/subtle/resources/common.js: (hexToArrayBuffer): Added a helper. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 01 Nov, 2013 1 commit
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=123598 Reviewed by Anders Carlsson. Source/WebCore: Test: crypto/subtle/hmac-sign-verify.html * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: Added property svn:eol-style. (WebCore::createAlgorithmFromJSValue): (WebCore::cryptoOperationDataFromJSValue): (WebCore::cryptoKeyFormatFromJSValue): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::JSSubtleCrypto::sign): (WebCore::JSSubtleCrypto::verify): (WebCore::JSSubtleCrypto::digest): (WebCore::JSSubtleCrypto::importKey): * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: Added. (WebCore::CryptoAlgorithmHMAC::CryptoAlgorithmHMAC): (WebCore::CryptoAlgorithmHMAC::~CryptoAlgorithmHMAC): (WebCore::CryptoAlgorithmHMAC::create): (WebCore::CryptoAlgorithmHMAC::identifier): (WebCore::CryptoAlgorithmHMAC::importKey): (WebCore::CryptoAlgorithmHMAC::exportKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: Added. * crypto/keys: Added. * crypto/keys/CryptoKeyHMAC.cpp: Added. (WebCore::CryptoKeyHMAC::CryptoKeyHMAC): (WebCore::CryptoKeyHMAC::~CryptoKeyHMAC): (WebCore::CryptoKeyHMAC::buildAlgorithmDescription): * crypto/keys/CryptoKeyHMAC.h: Added. * crypto/mac/CryptoAlgorithmHMACMac.cpp: Added. (WebCore::getCommonCryptoAlgorithm): (WebCore::calculateSignature): (WebCore::CryptoAlgorithmHMAC::sign): (WebCore::CryptoAlgorithmHMAC::verify): (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): LayoutTests: * crypto/subtle/hmac-sign-verify-expected.txt: Added. * crypto/subtle/hmac-sign-verify.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 31 Oct, 2013 1 commit
-
-
ap@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=123587 Reviewed by Anders Carlsson. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Do it. Source/WebCore: * Configurations/FeatureDefines.xcconfig: Enable it. * bindings/js/JSCryptoAlgorithmDictionary.cpp: Build fix. * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::getIdentifierForName): Special case empty keys to avoid upsetting HashMap. * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::create): Build fix. Can't use make_unique, because constructor is private. Source/WebKit/mac: * Configurations/FeatureDefines.xcconfig: Do it. Source/WebKit2: * Configurations/FeatureDefines.xcconfig: Do it. LayoutTests: * TestExpectations: * platform/efl/TestExpectations: * platform/gtk/TestExpectations: * platform/win/TestExpectations: * platform/wincairo/TestExpectations: Only skipping on specific platforms now. * crypto: Added. * crypto/crypto-gc-expected.txt: Copied from LayoutTests/security/crypto-gc-expected.txt. * crypto/crypto-gc.html: Copied from LayoutTests/security/crypto-gc.html. * crypto/crypto-random-values-expected.txt: Copied from LayoutTests/security/crypto-random-values-expected.txt. * crypto/crypto-random-values-limits-expected.txt: Copied from LayoutTests/security/crypto-random-values-limits-expected.txt. * crypto/crypto-random-values-limits.html: Copied from LayoutTests/security/crypto-random-values-limits.html. * crypto/crypto-random-values-types-expected.txt: Copied from LayoutTests/security/crypto-random-values-types-expected.txt. * crypto/crypto-random-values-types.html: Copied from LayoutTests/security/crypto-random-values-types.html. * crypto/crypto-random-values.html: Copied from LayoutTests/security/crypto-random-values.html. * crypto/subtle: Added. * crypto/subtle/argument-conversion-expected.txt: Copied from LayoutTests/security/crypto-subtle-arguments-expected.txt. * crypto/subtle/argument-conversion.html: Copied from LayoutTests/security/crypto-subtle-arguments.html. * crypto/subtle/gc-2-expected.txt: Copied from LayoutTests/security/crypto-subtle-gc-2-expected.txt. * crypto/subtle/gc-2.html: Copied from LayoutTests/security/crypto-subtle-gc-2.html. * crypto/subtle/gc-3-expected.txt: Copied from LayoutTests/security/crypto-subtle-gc-3-expected.txt. * crypto/subtle/gc-3.html: Copied from LayoutTests/security/crypto-subtle-gc-3.html. * crypto/subtle/gc-expected.txt: Copied from LayoutTests/security/crypto-subtle-gc-expected.txt. * crypto/subtle/gc.html: Copied from LayoutTests/security/crypto-subtle-gc.html. * crypto/subtle/resources: Added. * crypto/subtle/resources/common.js: Copied from LayoutTests/security/resources/common.js. * crypto/subtle/sha-1-expected.txt: Copied from LayoutTests/security/crypto-subtle-sha1-expected.txt. * crypto/subtle/sha-1.html: Copied from LayoutTests/security/crypto-subtle-sha1.html. * security/crypto-gc-expected.txt: Removed. * security/crypto-gc.html: Removed. * security/crypto-random-values-expected.txt: Removed. * security/crypto-random-values-limits-expected.txt: Removed. * security/crypto-random-values-limits.html: Removed. * security/crypto-random-values-types-expected.txt: Removed. * security/crypto-random-values-types.html: Removed. * security/crypto-random-values.html: Removed. * security/crypto-subtle-arguments-expected.txt: Removed. * security/crypto-subtle-arguments.html: Removed. * security/crypto-subtle-gc-2-expected.txt: Removed. * security/crypto-subtle-gc-2.html: Removed. * security/crypto-subtle-gc-3-expected.txt: Removed. * security/crypto-subtle-gc-3.html: Removed. * security/crypto-subtle-gc-expected.txt: Removed. * security/crypto-subtle-gc.html: Removed. * security/crypto-subtle-sha1-expected.txt: Removed. * security/crypto-subtle-sha1.html: Removed. * security/resources/common.js: Removed. Moved tests from security/ to crypto/. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-