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 eceae16d54 Drop NPN calls
eceae16d54 is described below
commit eceae16d54f98736b522342c8aef7c082f4cfa0c
Author: remm <[email protected]>
AuthorDate: Tue May 31 11:28:32 2022 +0200
Drop NPN calls
Tomcat-native is dropping them as well as they are obsolete.
Also minor foreign API change.
---
modules/openssl-foreign/openssl-tomcat.conf | 1 -
.../util/net/openssl/panama/OpenSSLContext.java | 2 --
.../util/net/openssl/panama/OpenSSLEngine.java | 24 +++++++---------------
.../apache/tomcat/util/openssl/constants$12.java | 9 --------
.../org/apache/tomcat/util/openssl/openssl_h.java | 11 ----------
5 files changed, 7 insertions(+), 40 deletions(-)
diff --git a/modules/openssl-foreign/openssl-tomcat.conf
b/modules/openssl-foreign/openssl-tomcat.conf
index 5273538daf..f6765453b4 100644
--- a/modules/openssl-foreign/openssl-tomcat.conf
+++ b/modules/openssl-foreign/openssl-tomcat.conf
@@ -214,7 +214,6 @@
--include-function SSL_get_shutdown # header:
/usr/include/openssl/ssl.h
--include-function SSL_get_version # header:
/usr/include/openssl/ssl.h
--include-function SSL_get0_alpn_selected # header:
/usr/include/openssl/ssl.h
---include-function SSL_get0_next_proto_negotiated # header:
/usr/include/openssl/ssl.h
--include-function SSL_in_init # header:
/usr/include/openssl/ssl.h
--include-function SSL_load_client_CA_file # header:
/usr/include/openssl/ssl.h
--include-function SSL_new # header:
/usr/include/openssl/ssl.h
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 8f8e857d59..9657f33945 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
@@ -681,8 +681,6 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
Linker.nativeLinker().upcallStub(openSSLCallbackAlpnSelectProtoHandle,
openSSLCallbackAlpnSelectProtoFunctionDescriptor,
state.contextMemorySession);
SSL_CTX_set_alpn_select_cb(state.sslCtx,
openSSLCallbackAlpnSelectProto, state.sslCtx);
- // Skip NPN (annoying and likely not useful anymore)
- //SSLContext.setNpnProtos(state.ctx, protocolsArray,
SSL.SSL_SELECTOR_FAILURE_NO_ADVERTISE);
}
// Apply OpenSSLConfCmd if used
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 b9c7ed64b0..3d355d5393 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
@@ -305,7 +305,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
final int sslWrote;
if (src.isDirect()) {
- sslWrote = SSL_write(ssl, MemorySegment.ofByteBuffer(src), len);
+ sslWrote = SSL_write(ssl, MemorySegment.ofBuffer(src), len);
if (sslWrote > 0) {
src.position(pos + sslWrote);
return sslWrote;
@@ -339,7 +339,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
final int pos = src.position();
final int len = src.remaining();
if (src.isDirect()) {
- final int netWrote = BIO_write(networkBIO,
MemorySegment.ofByteBuffer(src), len);
+ final int netWrote = BIO_write(networkBIO,
MemorySegment.ofBuffer(src), len);
if (netWrote > 0) {
src.position(pos + netWrote);
return netWrote;
@@ -352,7 +352,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
try {
buf.put(src);
buf.flip();
- final int netWrote = BIO_write(networkBIO,
MemorySegment.ofByteBuffer(buf), len);
+ final int netWrote = BIO_write(networkBIO,
MemorySegment.ofBuffer(buf), len);
if (netWrote > 0) {
src.position(pos + netWrote);
return netWrote;
@@ -379,7 +379,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
if (dst.isDirect()) {
final int len = dst.remaining();
- final int sslRead = SSL_read(ssl, MemorySegment.ofByteBuffer(dst),
len);
+ final int sslRead = SSL_read(ssl, MemorySegment.ofBuffer(dst),
len);
if (sslRead > 0) {
dst.position(dst.position() + sslRead);
return sslRead;
@@ -414,7 +414,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
clearLastError();
final int pos = dst.position();
if (dst.isDirect()) {
- final int bioRead = BIO_read(networkBIO,
MemorySegment.ofByteBuffer(dst), pending);
+ final int bioRead = BIO_read(networkBIO,
MemorySegment.ofBuffer(dst), pending);
if (bioRead > 0) {
dst.position(pos + bioRead);
return bioRead;
@@ -425,7 +425,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
// This uses unsafe and does not need to be used: the connector
should be configured with direct buffers
final ByteBuffer buf = ByteBuffer.allocateDirect(pending);
try {
- final int bioRead = BIO_read(networkBIO,
MemorySegment.ofByteBuffer(buf), pending);
+ final int bioRead = BIO_read(networkBIO,
MemorySegment.ofBuffer(buf), pending);
if (bioRead > 0) {
buf.limit(bioRead);
int oldLimit = dst.limit();
@@ -1008,9 +1008,6 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
MemorySegment lenAddress = allocator.allocate(ValueLayout.JAVA_INT, 0);
MemorySegment protocolPointer =
allocator.allocate(ValueLayout.ADDRESS, MemoryAddress.NULL);
SSL_get0_alpn_selected(state.ssl, protocolPointer, lenAddress);
- if (MemoryAddress.NULL.equals(protocolPointer.address())) {
- SSL_get0_next_proto_negotiated(state.ssl, protocolPointer,
lenAddress);
- }
if (MemoryAddress.NULL.equals(protocolPointer.address())) {
return null;
}
@@ -1809,14 +1806,7 @@ public final class OpenSSLEngine extends SSLEngine
implements SSLUtil.ProtocolIn
public String getProtocol() {
String applicationProtocol =
OpenSSLEngine.this.applicationProtocol;
if (applicationProtocol == null) {
- synchronized (OpenSSLEngine.this) {
- if (!destroyed) {
- applicationProtocol = getProtocolNegotiated();
- }
- }
- if (applicationProtocol == null) {
- applicationProtocol = fallbackApplicationProtocol;
- }
+ applicationProtocol = fallbackApplicationProtocol;
if (applicationProtocol != null) {
OpenSSLEngine.this.applicationProtocol =
applicationProtocol.replace(':', '_');
} else {
diff --git
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/constants$12.java
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/constants$12.java
index 685268aab8..df4926405e 100644
---
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/constants$12.java
+++
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/constants$12.java
@@ -42,15 +42,6 @@ class constants$12 {
"SSL_set_options",
constants$12.SSL_set_options$FUNC, false
);
- static final FunctionDescriptor SSL_get0_next_proto_negotiated$FUNC =
FunctionDescriptor.ofVoid(
- ADDRESS,
- ADDRESS,
- ADDRESS
- );
- static final MethodHandle SSL_get0_next_proto_negotiated$MH =
RuntimeHelper.downcallHandle(
- "SSL_get0_next_proto_negotiated",
- constants$12.SSL_get0_next_proto_negotiated$FUNC, false
- );
static final FunctionDescriptor SSL_CTX_set_alpn_select_cb$FUNC =
FunctionDescriptor.ofVoid(
ADDRESS,
ADDRESS,
diff --git
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/openssl_h.java
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/openssl_h.java
index bfb6b9e5df..da1c7b8afb 100644
---
a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/openssl_h.java
+++
b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/openssl/openssl_h.java
@@ -1002,17 +1002,6 @@ public class openssl_h {
throw new AssertionError("should not reach here", ex$);
}
}
- public static MethodHandle SSL_get0_next_proto_negotiated$MH() {
- return
RuntimeHelper.requireNonNull(constants$12.SSL_get0_next_proto_negotiated$MH,"SSL_get0_next_proto_negotiated");
- }
- public static void SSL_get0_next_proto_negotiated ( Addressable s,
Addressable data, Addressable len) {
- var mh$ =
RuntimeHelper.requireNonNull(constants$12.SSL_get0_next_proto_negotiated$MH,
"SSL_get0_next_proto_negotiated");
- try {
- mh$.invokeExact(s, data, len);
- } catch (Throwable ex$) {
- throw new AssertionError("should not reach here", ex$);
- }
- }
public static MethodHandle SSL_CTX_set_alpn_select_cb$MH() {
return
RuntimeHelper.requireNonNull(constants$12.SSL_CTX_set_alpn_select_cb$MH,"SSL_CTX_set_alpn_select_cb");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]