1. 16 Nov, 2013 1 commit
    • ap@apple.com's avatar
      WebCrypto no longer uses sequences of ArrayBuffers · b651c9a6
      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
      b651c9a6
  2. 15 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Update WebCrypto tests · df32d58c
      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
      df32d58c
  3. 02 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Implement remaining SHA variations for WebCrypto · cbb7161e
      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
      cbb7161e