Skip to content
  • ap@apple.com's avatar
    Check WebCrypto parameter types when casting · 2882324e
    ap@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=124297
    
    Reviewed by Sam Weinig.
    
    Also changed existing toCryptoXXX functions to use TYPE_CASTS_BASE mechanism.
    
    * bindings/js/JSCryptoAlgorithmDictionary.cpp:
    (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
    And sure enough, there was a bug caught by the added checks.
    
    * bindings/js/JSCryptoKeySerializationJWK.cpp:
    (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
    * crypto/CryptoAlgorithmParameters.h:
    (WebCore::CryptoAlgorithmParameters::ENUM_CLASS):
    (WebCore::CryptoAlgorithmParameters::parametersClass):
    * crypto/CryptoKey.h:
    * crypto/CryptoKeyData.h:
    * crypto/CryptoKeySerialization.h:
    * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
    (WebCore::CryptoAlgorithmAES_CBC::generateKey):
    * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
    (WebCore::CryptoAlgorithmHMAC::generateKey):
    (WebCore::CryptoAlgorithmHMAC::importKey):
    * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
    (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
    (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
    * crypto/keys/CryptoKeyAES.h:
    * crypto/keys/CryptoKeyDataOctetSequence.h:
    (WebCore::isCryptoKeyDataOctetSequence):
    * crypto/keys/CryptoKeyDataRSAComponents.h:
    (WebCore::isCryptoKeyDataRSAComponents):
    * crypto/keys/CryptoKeyHMAC.h:
    * crypto/keys/CryptoKeyRSA.h:
    * crypto/keys/CryptoKeySerializationRaw.h:
    * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
    (WebCore::CryptoAlgorithmAES_CBC::encrypt):
    (WebCore::CryptoAlgorithmAES_CBC::decrypt):
    * crypto/mac/CryptoAlgorithmHMACMac.cpp:
    (WebCore::CryptoAlgorithmHMAC::sign):
    (WebCore::CryptoAlgorithmHMAC::verify):
    * crypto/parameters/CryptoAlgorithmAesCbcParams.h:
    * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h:
    * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
    * crypto/parameters/CryptoAlgorithmHmacParams.h:
    * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
    * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h:
    * crypto/parameters/CryptoAlgorithmRsaSsaParams.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2882324e