1. 04 Nov, 2013 2 commits
    • ap@apple.com's avatar
      Implement generateKey for HMAC and AES-CBC · 7537b6dc
      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
      7537b6dc
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r158526. · 18e275da
      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
      18e275da
  2. 03 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Implement generateKey for HMAC and AES-CBC · c07a2c0d
      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
      c07a2c0d