[GCrypt] Implement AES_CBC support
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 07:37:36 +0000 (07:37 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 07:37:36 +0000 (07:37 +0000)
commitdf82b26f05ca3a12cb22c98c5ab81889c8bda9da
tree73c354099845cb2599ac5151da4e810e7a5dab0b
parenta876748756c354ace5a893ba5356dc05dab1debf
[GCrypt] Implement AES_CBC support
https://bugs.webkit.org/show_bug.cgi?id=170550

Reviewed by Michael Catanzaro.

Implement the CryptoAlgorithmAES_CBC::platform{Encrypt,Decrypt}
functionality for configurations that use libgcrypt. This is done
by leveraging the gcry_cipher_* APIs for the AES algorithm that's
deduced appropriately from the key size and the CBC cipher mode.
Additionally, the PKCS#7 padding is implemented for each operation,
as demanded by the Web Crypto specification.

No new tests -- current ones cover this sufficiently, but are not yet
enabled due to missing platform-specific SUBTLE_CRYPTO implementations.

* crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
(WebCore::gcryptEncrypt):
(WebCore::gcryptDecrypt):
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp