-
-
Notifications
You must be signed in to change notification settings - Fork 7
fix(hadoop): Backport HADOOP-18583 & fix OpenSSL native library #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
115 changes: 115 additions & 0 deletions
115
...p/stackable/patches/3.3.6/0012-HADOOP-18583.-Fix-loading-of-OpenSSL-3.x-symbols-525.patch
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
From baa7ec826f3f6d044f5307efe4b5d3bdd111bf4e Mon Sep 17 00:00:00 2001 | ||
From: Sebastian Klemke <[email protected]> | ||
Date: Thu, 7 Nov 2024 19:14:13 +0100 | ||
Subject: HADOOP-18583. Fix loading of OpenSSL 3.x symbols (#5256) (#7149) | ||
|
||
Contributed by Sebastian Klemke | ||
--- | ||
.../org/apache/hadoop/crypto/OpensslCipher.c | 68 +++++++++++++++++-- | ||
1 file changed, 64 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c | ||
index abff7ea5f1..f17169dec2 100644 | ||
--- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c | ||
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c | ||
@@ -24,6 +24,57 @@ | ||
|
||
#include "org_apache_hadoop_crypto_OpensslCipher.h" | ||
|
||
+/* | ||
+ # OpenSSL ABI Symbols | ||
+ | ||
+ Available on all OpenSSL versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | EVP_CIPHER_CTX_new | YES | YES | YES | | ||
+ | EVP_CIPHER_CTX_free | YES | YES | YES | | ||
+ | EVP_CIPHER_CTX_set_padding | YES | YES | YES | | ||
+ | EVP_CIPHER_CTX_test_flags | YES | YES | YES | | ||
+ | EVP_CipherInit_ex | YES | YES | YES | | ||
+ | EVP_CipherUpdate | YES | YES | YES | | ||
+ | EVP_CipherFinal_ex | YES | YES | YES | | ||
+ | ENGINE_by_id | YES | YES | YES | | ||
+ | ENGINE_free | YES | YES | YES | | ||
+ | EVP_aes_256_ctr | YES | YES | YES | | ||
+ | EVP_aes_128_ctr | YES | YES | YES | | ||
+ | ||
+ Available on old versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | EVP_CIPHER_CTX_cleanup | YES | --- | --- | | ||
+ | EVP_CIPHER_CTX_init | YES | --- | --- | | ||
+ | EVP_CIPHER_CTX_block_size | YES | YES | --- | | ||
+ | EVP_CIPHER_CTX_encrypting | --- | YES | --- | | ||
+ | ||
+ Available on new versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | OPENSSL_init_crypto | --- | YES | YES | | ||
+ | EVP_CIPHER_CTX_reset | --- | YES | YES | | ||
+ | EVP_CIPHER_CTX_get_block_size | --- | --- | YES | | ||
+ | EVP_CIPHER_CTX_is_encrypting | --- | --- | YES | | ||
+ | ||
+ Optionally available on new versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | EVP_sm4_ctr | --- | opt | opt | | ||
+ | ||
+ Name changes: | ||
+ | ||
+ | < 3.0 name | >= 3.0 name | | ||
+ |----------------------------|--------------------------------| | ||
+ | EVP_CIPHER_CTX_block_size | EVP_CIPHER_CTX_get_block_size | | ||
+ | EVP_CIPHER_CTX_encrypting | EVP_CIPHER_CTX_is_encrypting | | ||
+ */ | ||
+ | ||
#ifdef UNIX | ||
static EVP_CIPHER_CTX * (*dlsym_EVP_CIPHER_CTX_new)(void); | ||
static void (*dlsym_EVP_CIPHER_CTX_free)(EVP_CIPHER_CTX *); | ||
@@ -87,6 +138,15 @@ static __dlsym_EVP_aes_128_ctr dlsym_EVP_aes_128_ctr; | ||
static HMODULE openssl; | ||
#endif | ||
|
||
+// names changed in OpenSSL 3 ABI - see History section in EVP_EncryptInit(3) | ||
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L | ||
+#define CIPHER_CTX_BLOCK_SIZE "EVP_CIPHER_CTX_get_block_size" | ||
+#define CIPHER_CTX_ENCRYPTING "EVP_CIPHER_CTX_is_encrypting" | ||
+#else | ||
+#define CIPHER_CTX_BLOCK_SIZE "EVP_CIPHER_CTX_block_size" | ||
+#define CIPHER_CTX_ENCRYPTING "EVP_CIPHER_CTX_encrypting" | ||
+#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */ | ||
+ | ||
static void loadAesCtr(JNIEnv *env) | ||
{ | ||
#ifdef UNIX | ||
@@ -142,10 +202,10 @@ JNIEXPORT void JNICALL Java_org_apache_hadoop_crypto_OpensslCipher_initIDs | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CIPHER_CTX_test_flags, env, openssl, \ | ||
"EVP_CIPHER_CTX_test_flags"); | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CIPHER_CTX_block_size, env, openssl, \ | ||
- "EVP_CIPHER_CTX_block_size"); | ||
+ CIPHER_CTX_BLOCK_SIZE); | ||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CIPHER_CTX_encrypting, env, openssl, \ | ||
- "EVP_CIPHER_CTX_encrypting"); | ||
+ CIPHER_CTX_ENCRYPTING); | ||
#endif | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CipherInit_ex, env, openssl, \ | ||
"EVP_CipherInit_ex"); | ||
@@ -173,11 +233,11 @@ JNIEXPORT void JNICALL Java_org_apache_hadoop_crypto_OpensslCipher_initIDs | ||
openssl, "EVP_CIPHER_CTX_test_flags"); | ||
LOAD_DYNAMIC_SYMBOL(__dlsym_EVP_CIPHER_CTX_block_size, \ | ||
dlsym_EVP_CIPHER_CTX_block_size, env, \ | ||
- openssl, "EVP_CIPHER_CTX_block_size"); | ||
+ openssl, CIPHER_CTX_BLOCK_SIZE); | ||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L | ||
LOAD_DYNAMIC_SYMBOL(__dlsym_EVP_CIPHER_CTX_encrypting, \ | ||
dlsym_EVP_CIPHER_CTX_encrypting, env, \ | ||
- openssl, "EVP_CIPHER_CTX_encrypting"); | ||
+ openssl, CIPHER_CTX_ENCRYPTING); | ||
#endif | ||
LOAD_DYNAMIC_SYMBOL(__dlsym_EVP_CipherInit_ex, dlsym_EVP_CipherInit_ex, \ | ||
env, openssl, "EVP_CipherInit_ex"); |
115 changes: 115 additions & 0 deletions
115
...p/stackable/patches/3.4.1/0011-HADOOP-18583.-Fix-loading-of-OpenSSL-3.x-symbols-525.patch
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
From cd1c23ea5bddd2796caf2590fef467e488c3bcbf Mon Sep 17 00:00:00 2001 | ||
From: Sebastian Klemke <[email protected]> | ||
Date: Thu, 7 Nov 2024 19:14:13 +0100 | ||
Subject: HADOOP-18583. Fix loading of OpenSSL 3.x symbols (#5256) (#7149) | ||
|
||
Contributed by Sebastian Klemke | ||
--- | ||
.../org/apache/hadoop/crypto/OpensslCipher.c | 68 +++++++++++++++++-- | ||
1 file changed, 64 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c | ||
index 976bf135ce..33be4a394f 100644 | ||
--- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c | ||
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c | ||
@@ -24,6 +24,57 @@ | ||
|
||
#include "org_apache_hadoop_crypto_OpensslCipher.h" | ||
|
||
+/* | ||
+ # OpenSSL ABI Symbols | ||
+ | ||
+ Available on all OpenSSL versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | EVP_CIPHER_CTX_new | YES | YES | YES | | ||
+ | EVP_CIPHER_CTX_free | YES | YES | YES | | ||
+ | EVP_CIPHER_CTX_set_padding | YES | YES | YES | | ||
+ | EVP_CIPHER_CTX_test_flags | YES | YES | YES | | ||
+ | EVP_CipherInit_ex | YES | YES | YES | | ||
+ | EVP_CipherUpdate | YES | YES | YES | | ||
+ | EVP_CipherFinal_ex | YES | YES | YES | | ||
+ | ENGINE_by_id | YES | YES | YES | | ||
+ | ENGINE_free | YES | YES | YES | | ||
+ | EVP_aes_256_ctr | YES | YES | YES | | ||
+ | EVP_aes_128_ctr | YES | YES | YES | | ||
+ | ||
+ Available on old versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | EVP_CIPHER_CTX_cleanup | YES | --- | --- | | ||
+ | EVP_CIPHER_CTX_init | YES | --- | --- | | ||
+ | EVP_CIPHER_CTX_block_size | YES | YES | --- | | ||
+ | EVP_CIPHER_CTX_encrypting | --- | YES | --- | | ||
+ | ||
+ Available on new versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | OPENSSL_init_crypto | --- | YES | YES | | ||
+ | EVP_CIPHER_CTX_reset | --- | YES | YES | | ||
+ | EVP_CIPHER_CTX_get_block_size | --- | --- | YES | | ||
+ | EVP_CIPHER_CTX_is_encrypting | --- | --- | YES | | ||
+ | ||
+ Optionally available on new versions: | ||
+ | ||
+ | Function | 1.0 | 1.1 | 3.0 | | ||
+ |--------------------------------|-----|-----|-----| | ||
+ | EVP_sm4_ctr | --- | opt | opt | | ||
+ | ||
+ Name changes: | ||
+ | ||
+ | < 3.0 name | >= 3.0 name | | ||
+ |----------------------------|--------------------------------| | ||
+ | EVP_CIPHER_CTX_block_size | EVP_CIPHER_CTX_get_block_size | | ||
+ | EVP_CIPHER_CTX_encrypting | EVP_CIPHER_CTX_is_encrypting | | ||
+ */ | ||
+ | ||
#ifdef UNIX | ||
static EVP_CIPHER_CTX * (*dlsym_EVP_CIPHER_CTX_new)(void); | ||
static void (*dlsym_EVP_CIPHER_CTX_free)(EVP_CIPHER_CTX *); | ||
@@ -106,6 +157,15 @@ static __dlsym_ENGINE_free dlsym_ENGINE_free; | ||
static HMODULE openssl; | ||
#endif | ||
|
||
+// names changed in OpenSSL 3 ABI - see History section in EVP_EncryptInit(3) | ||
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L | ||
+#define CIPHER_CTX_BLOCK_SIZE "EVP_CIPHER_CTX_get_block_size" | ||
+#define CIPHER_CTX_ENCRYPTING "EVP_CIPHER_CTX_is_encrypting" | ||
+#else | ||
+#define CIPHER_CTX_BLOCK_SIZE "EVP_CIPHER_CTX_block_size" | ||
+#define CIPHER_CTX_ENCRYPTING "EVP_CIPHER_CTX_encrypting" | ||
+#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */ | ||
+ | ||
static void loadAesCtr(JNIEnv *env) | ||
{ | ||
#ifdef UNIX | ||
@@ -170,10 +230,10 @@ JNIEXPORT void JNICALL Java_org_apache_hadoop_crypto_OpensslCipher_initIDs | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CIPHER_CTX_test_flags, env, openssl, \ | ||
"EVP_CIPHER_CTX_test_flags"); | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CIPHER_CTX_block_size, env, openssl, \ | ||
- "EVP_CIPHER_CTX_block_size"); | ||
+ CIPHER_CTX_BLOCK_SIZE); | ||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CIPHER_CTX_encrypting, env, openssl, \ | ||
- "EVP_CIPHER_CTX_encrypting"); | ||
+ CIPHER_CTX_ENCRYPTING); | ||
#endif | ||
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_CipherInit_ex, env, openssl, \ | ||
"EVP_CipherInit_ex"); | ||
@@ -209,11 +269,11 @@ JNIEXPORT void JNICALL Java_org_apache_hadoop_crypto_OpensslCipher_initIDs | ||
openssl, "EVP_CIPHER_CTX_test_flags"); | ||
LOAD_DYNAMIC_SYMBOL(__dlsym_EVP_CIPHER_CTX_block_size, \ | ||
dlsym_EVP_CIPHER_CTX_block_size, env, \ | ||
- openssl, "EVP_CIPHER_CTX_block_size"); | ||
+ openssl, CIPHER_CTX_BLOCK_SIZE); | ||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L | ||
LOAD_DYNAMIC_SYMBOL(__dlsym_EVP_CIPHER_CTX_encrypting, \ | ||
dlsym_EVP_CIPHER_CTX_encrypting, env, \ | ||
- openssl, "EVP_CIPHER_CTX_encrypting"); | ||
+ openssl, CIPHER_CTX_ENCRYPTING); | ||
#endif | ||
LOAD_DYNAMIC_SYMBOL(__dlsym_EVP_CipherInit_ex, dlsym_EVP_CipherInit_ex, \ | ||
env, openssl, "EVP_CipherInit_ex"); |
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.
Uh oh!
There was an error while loading. Please reload this page.