This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 4a2b481641 Cleanup 4a2b481641 is described below commit 4a2b481641444c06bee3a794a5172db50561ae74 Author: remm <r...@apache.org> AuthorDate: Mon Nov 6 15:50:43 2023 +0100 Cleanup The callback will not be used with OpenSSL 3. Also use the free macro. --- java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java index f5855b4f2d..aeda3b0232 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java @@ -756,8 +756,7 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { // DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength) public static MemorySegment openSSLCallbackTmpDH(MemorySegment ssl, int isExport, int keylength) { var pkey = SSL_get_privatekey(ssl); - int type = (MemorySegment.NULL.equals(pkey)) ? EVP_PKEY_NONE() - : (OPENSSL_3 ? EVP_PKEY_get_base_id(pkey) : EVP_PKEY_base_id(pkey)); + int type = (MemorySegment.NULL.equals(pkey)) ? EVP_PKEY_NONE() : EVP_PKEY_base_id(pkey); /* * OpenSSL will call us with either keylen == 512 or keylen == 1024 * (see the definition of SSL_EXPORT_PKEYLENGTH in ssl_locl.h). @@ -772,7 +771,7 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { */ int keylen = 0; if (type == EVP_PKEY_RSA() || type == EVP_PKEY_DSA()) { - keylen = (OPENSSL_3 ? EVP_PKEY_get_bits(pkey) : EVP_PKEY_bits(pkey)); + keylen = EVP_PKEY_bits(pkey); } for (int i = 0; i < OpenSSLLibrary.dhParameters.length; i++) { if (keylen >= OpenSSLLibrary.dhParameters[i].min) { @@ -850,7 +849,7 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { } MemorySegment buf = bufPointer.get(ValueLayout.ADDRESS, 0); certificateChain[i] = buf.reinterpret(length, localArena, null).toArray(ValueLayout.JAVA_BYTE); - CRYPTO_free(buf, MemorySegment.NULL, 0); // OPENSSL_free macro + OPENSSL_free(buf); } MemorySegment cipher = SSL_get_current_cipher(ssl); String authMethod = (MemorySegment.NULL.equals(cipher)) ? "UNKNOWN" --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org