[WIP][SPARK-NNNNN] Updating AES-CBC support to not use OpenSSL's KDF#40903
Closed
sweisdb wants to merge 2 commits intoapache:masterfrom
Closed
[WIP][SPARK-NNNNN] Updating AES-CBC support to not use OpenSSL's KDF#40903sweisdb wants to merge 2 commits intoapache:masterfrom
sweisdb wants to merge 2 commits intoapache:masterfrom
Conversation
Contributor
Author
|
Closing this and will replace with SPARK-43286 and SPARK-43290. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
The current implementation of AES-CBC mode called via
aes_encryptandaes_decryptuses a key derivation function (KDF) based on OpenSSL's EVP_BytesToKey. This is intended for generating keys based on passwords and OpenSSL's documents discourage its use: "Newer applications should use a more modern algorithm".aes_encryptandaes_decryptshould use the key directly in CBC mode, as it does for both GCM and ECB mode. The output should then be the initialization vector (IV) prepended to the ciphertext – as is done with GCM mode:[16-byte randomly generated IV | AES-CBC encrypted ciphertext]Why are the changes needed?
We want to have the ciphertext output similar across different modes. OpenSSL's EVP_BytesToKey is effectively deprecated and their own documentation says not to use it. Instead, CBC mode will generate a random vector.
Does this PR introduce any user-facing change?
AES-CBC output generated by the previous format will be incompatible with this change. That change was recently landed and we want to land this before CBC mode is used in practice.
How was this patch tested?
A new unit test in
DataFrameFunctionsSuitewas added to test both GCM and CBC modes. Also, a new standalone unit test suite was added inExpressionImplUtilsSuiteto test all the modes and various key lengths.CBC values can be verified with
openssl encusing the following command: