Skip to content

Commit b79827b

Browse files
committed
Apply standard code formatting
(to minimise differences between versions)
1 parent c433e29 commit b79827b

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ public OpenSSLContext(SSLHostConfigCertificate certificate, List<String> negotia
265265

266266
// Set server groups
267267
// Note: It is also possible to override setSSLParameters in OpenSSLEngine to set the final
268-
// list of groups per connection, but this is less efficient than setting the configured
269-
// group list on the SSL context and letting OpenSSL figure it out.
268+
// list of groups per connection, but this is less efficient than setting the configured
269+
// group list on the SSL context and letting OpenSSL figure it out.
270270
if (sslHostConfig.getGroupList() != null) {
271271
StringBuilder sb = new StringBuilder();
272272
boolean first = true;
@@ -532,7 +532,8 @@ public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws K
532532
}
533533
if (maxTlsVersion >= TLS1_3_VERSION()) {
534534
try {
535-
if (SSL_CTX_set_ciphersuites(state.sslCtx, localArena.allocateFrom(sslHostConfig.getCipherSuites())) <= 0) {
535+
if (SSL_CTX_set_ciphersuites(state.sslCtx,
536+
localArena.allocateFrom(sslHostConfig.getCipherSuites())) <= 0) {
536537
tls13Warning = sm.getString("engine.failedCipherSuite", sslHostConfig.getCipherSuites());
537538
} else {
538539
ciphersSet = true;
@@ -611,7 +612,8 @@ public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws K
611612
localArena
612613
.allocateFrom(SSLHostConfig.adjustRelativePath(sslHostConfig.getCaCertificatePath())) :
613614
MemorySegment.NULL;
614-
if (SSL_CTX_load_verify_locations(state.sslCtx, caCertificateFileNative, caCertificatePathNative) <= 0) {
615+
if (SSL_CTX_load_verify_locations(state.sslCtx, caCertificateFileNative,
616+
caCertificatePathNative) <= 0) {
615617
logLastError("openssl.errorConfiguringLocations");
616618
} else {
617619
var caCerts = SSL_CTX_get_client_CA_list(state.sslCtx);
@@ -1368,8 +1370,8 @@ public SSLSessionContext getServerSessionContext() {
13681370
public SSLEngine createSSLEngine() {
13691371
return new OpenSSLEngine(cleaner, state.sslCtx, defaultProtocol, false, sessionContext, alpn, initialized,
13701372
sslHostConfig.getCertificateVerificationDepth(),
1371-
sslHostConfig.getCertificateVerification() == CertificateVerification.OPTIONAL_NO_CA,
1372-
noOcspCheck, ocspSoftFail, ocspTimeout, ocspVerifyFlags);
1373+
sslHostConfig.getCertificateVerification() == CertificateVerification.OPTIONAL_NO_CA, noOcspCheck,
1374+
ocspSoftFail, ocspTimeout, ocspVerifyFlags);
13731375
}
13741376

13751377
@Override

java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public final class OpenSSLEngine extends SSLEngine implements SSLUtil.ProtocolIn
8787
final Set<String> availableCipherSuites = new LinkedHashSet<>(128);
8888
availableCipherSuites.addAll(OpenSSLLibrary.findCiphers("ALL"));
8989
AVAILABLE_CIPHER_SUITES = Collections.unmodifiableSet(availableCipherSuites);
90-
IMPLEMENTED_PROTOCOLS_SET = Set.of(Constants.SSL_PROTO_SSLv2Hello, Constants.SSL_PROTO_SSLv3,
91-
Constants.SSL_PROTO_TLSv1, Constants.SSL_PROTO_TLSv1_1, Constants.SSL_PROTO_TLSv1_2,
92-
Constants.SSL_PROTO_TLSv1_3);
90+
IMPLEMENTED_PROTOCOLS_SET =
91+
Set.of(Constants.SSL_PROTO_SSLv2Hello, Constants.SSL_PROTO_SSLv3, Constants.SSL_PROTO_TLSv1,
92+
Constants.SSL_PROTO_TLSv1_1, Constants.SSL_PROTO_TLSv1_2, Constants.SSL_PROTO_TLSv1_3);
9393
}
9494

9595
private static final int MAX_PLAINTEXT_LENGTH = 16 * 1024; // 2^14
@@ -185,8 +185,8 @@ private enum PHAState {
185185
*/
186186
OpenSSLEngine(Cleaner cleaner, MemorySegment sslCtx, String fallbackApplicationProtocol, boolean clientMode,
187187
OpenSSLSessionContext sessionContext, boolean alpn, boolean initialized, int certificateVerificationDepth,
188-
boolean certificateVerificationOptionalNoCA, boolean noOcspCheck, boolean ocspSoftFail,
189-
int ocspTimeout, int ocspVerifyFlags) {
188+
boolean certificateVerificationOptionalNoCA, boolean noOcspCheck, boolean ocspSoftFail, int ocspTimeout,
189+
int ocspVerifyFlags) {
190190
if (sslCtx == null) {
191191
throw new IllegalArgumentException(sm.getString("engine.noSSLContext"));
192192
}
@@ -832,8 +832,8 @@ private byte[] getPeerCertificate() {
832832
try (var localArena = Arena.ofConfined()) {
833833
// Use the new SSL_get0_peer_certificate call for OpenSSL 3+ to avoid having to call free
834834
MemorySegment/* (X509*) */ x509 =
835-
(openssl_h_Compatibility.OPENSSL3) ? SSL_get0_peer_certificate(state.ssl)
836-
: openssl_h_Compatibility.SSL_get_peer_certificate(state.ssl);
835+
(openssl_h_Compatibility.OPENSSL3) ? SSL_get0_peer_certificate(state.ssl) :
836+
openssl_h_Compatibility.SSL_get_peer_certificate(state.ssl);
837837
MemorySegment bufPointer = localArena.allocateFrom(ValueLayout.ADDRESS, MemorySegment.NULL);
838838
int length = i2d_X509(x509, bufPointer);
839839
if (length <= 0) {
@@ -1145,7 +1145,8 @@ public int apply(int preverify_ok, MemorySegment /* X509_STORE_CTX */ x509ctx) {
11451145
(errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN()) ||
11461146
(errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY()) ||
11471147
(errnum == X509_V_ERR_CERT_UNTRUSTED()) || (errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE());
1148-
if ((verifyErrorIsOptional || errnum == X509_V_OK()) && (state.certificateVerifyMode == OpenSSLContext.OPTIONAL_NO_CA)) {
1148+
if ((verifyErrorIsOptional || errnum == X509_V_OK()) &&
1149+
(state.certificateVerifyMode == OpenSSLContext.OPTIONAL_NO_CA)) {
11491150
ok = 1;
11501151
openssl_h_Compatibility.SSL_set_verify_result(state.ssl, X509_V_OK());
11511152
}
@@ -1247,7 +1248,8 @@ private static int processOCSP(EngineState state, MemorySegment /* X509_STORE_CT
12471248
for (String urlString : urls) {
12481249
try {
12491250
URL url = (new URI(urlString)).toURL();
1250-
ocspResponse = processOCSPRequest(state, url, issuer, x509, x509ctx, localArena);
1251+
ocspResponse =
1252+
processOCSPRequest(state, url, issuer, x509, x509ctx, localArena);
12511253
if (log.isDebugEnabled()) {
12521254
log.debug(sm.getString("engine.ocspResponse", urlString,
12531255
Integer.toString(ocspResponse)));
@@ -1376,7 +1378,8 @@ private static int processOCSPRequest(EngineState state, URL url, MemorySegment
13761378
return V_OCSP_CERTSTATUS_UNKNOWN();
13771379
}
13781380
MemorySegment certStack = OCSP_resp_get0_certs(basicResponse);
1379-
if (OCSP_basic_verify(basicResponse, certStack, X509_STORE_CTX_get0_store(x509ctx), state.ocspVerifyFlags) <= 0) {
1381+
if (OCSP_basic_verify(basicResponse, certStack, X509_STORE_CTX_get0_store(x509ctx),
1382+
state.ocspVerifyFlags) <= 0) {
13801383
X509_STORE_CTX_set_error(x509ctx, X509_V_ERR_OCSP_SIGNATURE_FAILURE());
13811384
return V_OCSP_CERTSTATUS_UNKNOWN();
13821385
}

java/org/apache/tomcat/util/net/openssl/panama/OpenSSLUtil.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,4 @@ public KeyManager[] getKeyManagers() throws Exception {
105105
throw e;
106106
}
107107
}
108-
109-
110108
}

0 commit comments

Comments
 (0)