1. 12 Dec, 2013 1 commit
    • ap@apple.com's avatar
      Make algorithm.name return registered name, not normalized one · 8199d8e9
      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
      8199d8e9
  2. 02 Dec, 2013 1 commit
    • ap@apple.com's avatar
      Support WebCrypto AES-KW · 24ef25bb
      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
      24ef25bb