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 d0c192e52f Panama API updates
d0c192e52f is described below

commit d0c192e52fe413e1fe4444412ddfa6df94eaaf01
Author: remm <r...@apache.org>
AuthorDate: Wed Mar 8 00:02:56 2023 +0100

    Panama API updates
---
 .../tomcat/util/net/openssl/panama/OpenSSLContext.java   | 14 +++++++-------
 .../tomcat/util/net/openssl/panama/OpenSSLEngine.java    | 16 ++++++++--------
 .../org/apache/tomcat/util/openssl/RuntimeHelper.java    |  2 +-
 .../openssl/SSL_CTX_set_cert_verify_callback$cb.java     |  2 +-
 .../util/openssl/SSL_CTX_set_tmp_dh_callback$dh.java     |  2 +-
 .../tomcat/util/openssl/SSL_set_info_callback$cb.java    |  2 +-
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
index d851c9731e..92d4ec0772 100644
--- 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
+++ 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
@@ -794,7 +794,7 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
             return SSL_TLSEXT_ERR_NOACK();
         }
         try (var localArena = Arena.ofConfined()) {
-            MemorySegment inSeg = in.reinterpret(inlen, localArena.scope(), 
null);
+            MemorySegment inSeg = in.reinterpret(inlen, localArena, null);
             byte[] advertisedBytes = inSeg.toArray(ValueLayout.JAVA_BYTE);
             for (byte[] negotiableProtocolBytes : state.negotiableProtocols) {
                 for (int i = 0; i <= advertisedBytes.length - 
negotiableProtocolBytes.length; i++) {
@@ -803,9 +803,9 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
                             if (advertisedBytes[i + j] == 
negotiableProtocolBytes[j]) {
                                 if (j == negotiableProtocolBytes.length - 1) {
                                     // Match
-                                    MemorySegment outSeg = 
out.reinterpret(ValueLayout.ADDRESS.byteSize(), localArena.scope(), null);
+                                    MemorySegment outSeg = 
out.reinterpret(ValueLayout.ADDRESS.byteSize(), localArena, null);
                                     outSeg.set(ValueLayout.ADDRESS, 0, 
inSeg.asSlice(i));
-                                    MemorySegment outlenSeg = 
outlen.reinterpret(ValueLayout.JAVA_BYTE.byteSize(), localArena.scope(), null);
+                                    MemorySegment outlenSeg = 
outlen.reinterpret(ValueLayout.JAVA_BYTE.byteSize(), localArena, null);
                                     outlenSeg.set(ValueLayout.JAVA_BYTE, 0, 
(byte) negotiableProtocolBytes.length);
                                     return SSL_TLSEXT_ERR_OK();
                                 }
@@ -851,7 +851,7 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
                     continue;
                 }
                 MemorySegment buf = bufPointer.get(ValueLayout.ADDRESS, 0);
-                certificateChain[i] = buf.reinterpret(length, 
localArena.scope(), null).toArray(ValueLayout.JAVA_BYTE);
+                certificateChain[i] = buf.reinterpret(length, localArena, 
null).toArray(ValueLayout.JAVA_BYTE);
                 CRYPTO_free(buf, MemorySegment.NULL, 0); // OPENSSL_free macro
             }
             MemorySegment cipher = SSL_get_current_cipher(ssl);
@@ -965,7 +965,7 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
                     // The password is too long
                     log.error(sm.getString("openssl.passwordTooLong"));
                 } else {
-                    MemorySegment bufSegment = buf.reinterpret(bufsiz, 
localArena.scope(), null);
+                    MemorySegment bufSegment = buf.reinterpret(bufsiz, 
localArena, null);
                     bufSegment.copyFrom(callbackPasswordNative);
                     return (int) callbackPasswordNative.byteSize();
                 }
@@ -1383,9 +1383,9 @@ public class OpenSSLContext implements 
org.apache.tomcat.util.net.SSLContext {
             this.negotiableProtocols = negotiableProtocols;
             // Use another arena to avoid keeping a reference through segments
             // This also allows making further accesses to the main pointers 
safer
-            this.sslCtx = sslCtx.reinterpret(ValueLayout.ADDRESS.byteSize(), 
stateArena.scope(), null);
+            this.sslCtx = sslCtx.reinterpret(ValueLayout.ADDRESS.byteSize(), 
stateArena, null);
             if (!MemorySegment.NULL.equals(confCtx)) {
-                this.confCtx = 
confCtx.reinterpret(ValueLayout.ADDRESS.byteSize(), stateArena.scope(), null);
+                this.confCtx = 
confCtx.reinterpret(ValueLayout.ADDRESS.byteSize(), stateArena, null);
             } else {
                 this.confCtx = null;
             }
diff --git 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java
 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java
index dbfee4dced..c3755f0d40 100644
--- 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java
+++ 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java
@@ -914,7 +914,7 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
                 return null;
             }
             MemorySegment buf = bufPointer.get(ValueLayout.ADDRESS, 0);
-            byte[] certificate = buf.reinterpret(length, localArena.scope(), 
null).toArray(ValueLayout.JAVA_BYTE);
+            byte[] certificate = buf.reinterpret(length, localArena, 
null).toArray(ValueLayout.JAVA_BYTE);
             X509_free(x509);
             CRYPTO_free(buf, MemorySegment.NULL, 0); // OPENSSL_free macro
             return certificate;
@@ -938,7 +938,7 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
                     continue;
                 }
                 MemorySegment buf = bufPointer.get(ValueLayout.ADDRESS, 0);
-                byte[] certificate = buf.reinterpret(length, 
localArena.scope(), null).toArray(ValueLayout.JAVA_BYTE);
+                byte[] certificate = buf.reinterpret(length, localArena, 
null).toArray(ValueLayout.JAVA_BYTE);
                 certificateChain[i] = certificate;
                 CRYPTO_free(buf, MemorySegment.NULL, 0); // OPENSSL_free macro
             }
@@ -959,7 +959,7 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
                 return null;
             }
             MemorySegment protocolAddress = 
protocolPointer.get(ValueLayout.ADDRESS, 0);
-            byte[] name = protocolAddress.reinterpret(length, 
localArena.scope(), null).toArray(ValueLayout.JAVA_BYTE);
+            byte[] name = protocolAddress.reinterpret(length, localArena, 
null).toArray(ValueLayout.JAVA_BYTE);
             if (log.isDebugEnabled()) {
                 log.debug("Protocol negotiated [" + new String(name) + "]");
             }
@@ -1329,7 +1329,7 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
                             int length = ASN1_STRING_length(os);
                             MemorySegment data = ASN1_STRING_get0_data(os);
                             // ocsp_urls = decode_OCSP_url(os);
-                            byte[] asn1String = data.reinterpret(length, 
localArenal.scope(), null).toArray(ValueLayout.JAVA_BYTE);
+                            byte[] asn1String = data.reinterpret(length, 
localArenal, null).toArray(ValueLayout.JAVA_BYTE);
                             Asn1Parser parser = new Asn1Parser(asn1String);
                             // Parse the byte sequence
                             ArrayList<String> urls = new ArrayList<>();
@@ -1425,7 +1425,7 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
             // Host: urlHost:urlPort
             // Content-Type: application/ocsp-request
             // Content-Length: ocspRequestData.length
-            byte[] ocspRequestData = buf.reinterpret(requestLength, 
localArena.scope(), null).toArray(ValueLayout.JAVA_BYTE);
+            byte[] ocspRequestData = buf.reinterpret(requestLength, 
localArena, null).toArray(ValueLayout.JAVA_BYTE);
             connection = (HttpURLConnection) url.openConnection();
             connection.setRequestMethod("POST");
             connection.setDoInput(true);
@@ -1515,7 +1515,7 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
                         MemorySegment sessionId = SSL_SESSION_get_id(session, 
lenPointer);
                         int len = lenPointer.get(ValueLayout.JAVA_INT, 0);
                         id = (len == 0) ? new byte[0]
-                                : sessionId.reinterpret(len, 
localArena.scope(), null).toArray(ValueLayout.JAVA_BYTE);
+                                : sessionId.reinterpret(len, localArena, 
null).toArray(ValueLayout.JAVA_BYTE);
                     }
                 }
             }
@@ -1814,8 +1814,8 @@ public final class OpenSSLEngine extends SSLEngine 
implements SSLUtil.ProtocolIn
             this.noOcspCheck = noOcspCheck;
             // Use another arena to avoid keeping a reference through segments
             // This also allows making further accesses to the main pointers 
safer
-            this.ssl = ssl.reinterpret(ValueLayout.ADDRESS.byteSize(), 
stateArena.scope(), null);
-            this.networkBIO = 
networkBIO.reinterpret(ValueLayout.ADDRESS.byteSize(), stateArena.scope(), 
null);
+            this.ssl = ssl.reinterpret(ValueLayout.ADDRESS.byteSize(), 
stateArena, null);
+            this.networkBIO = 
networkBIO.reinterpret(ValueLayout.ADDRESS.byteSize(), stateArena, null);
         }
 
         @Override
diff --git 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/RuntimeHelper.java
 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/RuntimeHelper.java
index 5b0fbb4521..beab875552 100644
--- 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/RuntimeHelper.java
+++ 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/RuntimeHelper.java
@@ -107,7 +107,7 @@ final class RuntimeHelper {
     }
 
     static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int 
numElements, Arena arena) {
-         return addr.reinterpret(numElements * layout.byteSize(), 
arena.scope(), null);
+         return addr.reinterpret(numElements * layout.byteSize(), arena, null);
     }
 
     // Internals only below this point
diff --git 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_cert_verify_callback$cb.java
 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_cert_verify_callback$cb.java
index 939f42c600..4686d04ca0 100644
--- 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_cert_verify_callback$cb.java
+++ 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_cert_verify_callback$cb.java
@@ -36,7 +36,7 @@ public interface SSL_CTX_set_cert_verify_callback$cb {
         return 
RuntimeHelper.upcallStub(constants$15.SSL_CTX_set_cert_verify_callback$cb_UP$MH,
 fi, constants$15.SSL_CTX_set_cert_verify_callback$cb$FUNC, scope);
     }
     static SSL_CTX_set_cert_verify_callback$cb ofAddress(MemorySegment addr, 
Arena arena) {
-        MemorySegment symbol = addr.reinterpret(arena.scope(), null);
+        MemorySegment symbol = addr.reinterpret(arena, null);
         return (java.lang.foreign.MemorySegment __x0, 
java.lang.foreign.MemorySegment __x1) -> {
             try {
                 return 
(int)constants$15.SSL_CTX_set_cert_verify_callback$cb_DOWN$MH.invokeExact(symbol,
 __x0, __x1);
diff --git 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_tmp_dh_callback$dh.java
 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_tmp_dh_callback$dh.java
index 674e8ec228..77a68cda04 100644
--- 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_tmp_dh_callback$dh.java
+++ 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_CTX_set_tmp_dh_callback$dh.java
@@ -36,7 +36,7 @@ public interface SSL_CTX_set_tmp_dh_callback$dh {
         return 
RuntimeHelper.upcallStub(constants$21.SSL_CTX_set_tmp_dh_callback$dh_UP$MH, fi, 
constants$21.SSL_CTX_set_tmp_dh_callback$dh$FUNC, scope);
     }
     static SSL_CTX_set_tmp_dh_callback$dh ofAddress(MemorySegment addr, Arena 
arena) {
-        MemorySegment symbol = addr.reinterpret(arena.scope(), null);
+        MemorySegment symbol = addr.reinterpret(arena, null);
         return (java.lang.foreign.MemorySegment __x0, int __x1, int __x2) -> {
             try {
                 return 
(java.lang.foreign.MemorySegment)constants$22.SSL_CTX_set_tmp_dh_callback$dh_DOWN$MH.invokeExact(symbol,
 __x0, __x1, __x2);
diff --git 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_set_info_callback$cb.java
 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_set_info_callback$cb.java
index 5811cf2994..16b7144980 100644
--- 
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_set_info_callback$cb.java
+++ 
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/SSL_set_info_callback$cb.java
@@ -36,7 +36,7 @@ public interface SSL_set_info_callback$cb {
         return 
RuntimeHelper.upcallStub(constants$21.SSL_set_info_callback$cb_UP$MH, fi, 
constants$21.SSL_set_info_callback$cb$FUNC, scope);
     }
     static SSL_set_info_callback$cb ofAddress(MemorySegment addr, Arena arena) 
{
-        MemorySegment symbol = addr.reinterpret(arena.scope(), null);
+        MemorySegment symbol = addr.reinterpret(arena, null);
         return (java.lang.foreign.MemorySegment __x0, int __x1, int __x2) -> {
             try {
                 
constants$21.SSL_set_info_callback$cb_DOWN$MH.invokeExact(symbol, __x0, __x1, 
__x2);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to