• eroman@chromium.org's avatar
    Refactor WebCrypto code. · d008566b
    eroman@chromium.org authored
    Split up the monstrously large platform_crypto_nss.cc, platform_crypto_openssl.cc into multiple files.
    
    -----------
    Overview:
    -----------
    
    * algorithm_implementation.h:
    
    This defines a base class AlgorithmImplementation, which has virtual methods for synchronous encrypt/decrypt/generatekey. All of the information about an algorithm is now encapsulated by an AlgorithmImplementation. So for instance the JWK specific knowledge, key usages for each key type are pulled into this interface.
    
    * algorithm_registry.cc:
    
    Contains a mapping from WebCryptoAlgorithmID --> AlgorithmImplementation, stored by a singleton.
    
    * algorithm_dispatch.cc:
    
    Given parameters from Blink, looks up the appropriate AlgorithmImplementation in the registry and dispatches the operation. Also implements wrap/unwrap in terms of encrypt/decrypt.
    
    * structured_clone.cc:
    
    Contains the code related to structured cloning (which still needs some cleanup, and is implemented in terms of import/export).
    
    * nss/*, openssl/*:
    
    Contains the AlgorithmImplementation concrete classes for each algorithm. 
    
    This reorganization also unintentionally fixes a few bugs.
    
      * ExportKey() for spki/pkcs8/raw uses the already serialized key data rather than re-exporting
      * Some exception codes were fixed.
    
    BUG=389325,389342,389327,374912
    
    Review URL: https://codereview.chromium.org/379383002
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284192 0039d316-1c4b-4281-b951-d872f2087c98
    d008566b
key_nss.cc 2.34 KB