aws/aws-encryption-sdk-c

Investigate potential re-use of EVP_CIPHER_CTX

Opened this issue · 1 comments

The encrypt and decrypt path each appear to initialize an EVP_CIPHER_CTX twice using the same content key, which may represent a redundant AES key schedule. Re-using this context could avoid a redundant key schedule. This would likely require some refactoring of the aws_cryptosdk_session and the encrypt/decrypt paths, as well as the corresponding proofs.

To clarify: It looks like we initialized an EVP_CIPHER_CTX structure n+1 times where n is the number of frames. (Once to encrypt/decrypt each frame and once for the header.)