Skip to content

Commit 26b98c8

Browse files
authored
Merge pull request #1927 from SAP/pr-jdk-17.0.15+3
Merge to tag jdk-17.0.15+3
2 parents eb42869 + fae8034 commit 26b98c8

File tree

18 files changed

+500
-162
lines changed

18 files changed

+500
-162
lines changed

make/conf/github-actions.conf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ GTEST_VERSION=1.13.0
2929
JTREG_VERSION=7.3.1+1
3030

3131
LINUX_X64_BOOT_JDK_EXT=tar.gz
32-
LINUX_X64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.12/sapmachine-jdk-17.0.12_linux-x64_bin.tar.gz
33-
LINUX_X64_BOOT_JDK_SHA256=53c035d9d496f6a29a2beb19181d69597796c0903385207f76c3d63671681673
34-
35-
MACOS_X64_BOOT_JDK_EXT=tar.gz
36-
MACOS_X64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.12/sapmachine-jdk-17.0.12_macos-x64_bin.tar.gz
37-
MACOS_X64_BOOT_JDK_SHA256=fdb96f4ca96aa54bd90cfe0fcf1863f226be250e5ce942bc70f6bd41602f36d5
32+
LINUX_X64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.14/sapmachine-jdk-17.0.14_linux-x64_bin.tar.gz
33+
LINUX_X64_BOOT_JDK_SHA256=5d42032738a1d2e5ce7c0b08a9ace3f678158c01670b8f21b9701e38eda6127b
3834

3935
MACOS_AARCH64_BOOT_JDK_EXT=tar.gz
40-
MACOS_AARCH64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.12/sapmachine-jdk-17.0.12_macos-aarch64_bin.tar.gz
41-
MACOS_AARCH64_BOOT_JDK_SHA256=a6af44b288551a3394ad7a9ec16623d05e56ee7f0dda0f5751ad1a977c0dea9e
36+
MACOS_AARCH64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.14/sapmachine-jdk-17.0.14_macos-aarch64_bin.tar.gz
37+
MACOS_AARCH64_BOOT_JDK_SHA256=8dfd53f5cc6a00d85500fc637b68e256c0b8ed6770e9b9c9779297761a24f276
38+
39+
MACOS_X64_BOOT_JDK_EXT=tar.gz
40+
MACOS_X64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.14/sapmachine-jdk-17.0.14_macos-x64_bin.tar.gz
41+
MACOS_X64_BOOT_JDK_SHA256=eca737bbc29de298da04856fdc9c856c2638df4151885050f710675a989cd31f
4242

4343
WINDOWS_X64_BOOT_JDK_EXT=zip
44-
WINDOWS_X64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.12/sapmachine-jdk-17.0.12_windows-x64_bin.zip
45-
WINDOWS_X64_BOOT_JDK_SHA256=fa2ac8287963cbd2e23714253c50fc2edfdcc5bd511a42f36afe1f1982fef50d
44+
WINDOWS_X64_BOOT_JDK_URL=https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.14/sapmachine-jdk-17.0.14_windows-x64_bin.zip
45+
WINDOWS_X64_BOOT_JDK_SHA256=dce037469441f3f71d01b839cee4a95755b3f6deba34aa8c1c5649e07ecdac61

src/java.base/share/classes/sun/security/validator/CADistrustPolicy.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,22 @@ void checkDistrust(String variant, X509Certificate[] chain)
6969
}
7070
EntrustTLSPolicy.checkDistrust(chain);
7171
}
72+
},
73+
74+
/**
75+
* Distrust TLS Server certificates anchored by a CAMERFIRMA root CA and
76+
* issued after April 15, 2025. If enabled, this policy is currently
77+
* enforced by the PKIX and SunX509 TrustManager implementations
78+
* of the SunJSSE provider implementation.
79+
*/
80+
CAMERFIRMA_TLS {
81+
void checkDistrust(String variant, X509Certificate[] chain)
82+
throws ValidatorException {
83+
if (!variant.equals(Validator.VAR_TLS_SERVER)) {
84+
return;
85+
}
86+
CamerfirmaTLSPolicy.checkDistrust(chain);
87+
}
7288
};
7389

7490
/**
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package sun.security.validator;
26+
27+
import java.security.cert.X509Certificate;
28+
import java.time.LocalDate;
29+
import java.time.Month;
30+
import java.time.ZoneOffset;
31+
import java.util.Date;
32+
import java.util.Map;
33+
import java.util.Set;
34+
35+
import sun.security.util.Debug;
36+
import sun.security.x509.X509CertImpl;
37+
38+
/**
39+
* This class checks if Camerfirma issued TLS Server certificates should be
40+
* restricted.
41+
*/
42+
final class CamerfirmaTLSPolicy {
43+
44+
private static final Debug debug = Debug.getInstance("certpath");
45+
46+
// SHA-256 certificate fingerprints of distrusted roots
47+
private static final Set<String> FINGERPRINTS = Set.of(
48+
// cacerts alias: camerfirmachamberscommerceca
49+
// DN: CN=Chambers of Commerce Root,
50+
// OU=http://www.chambersign.org,
51+
// O=AC Camerfirma SA CIF A82743287, C=EU
52+
"0C258A12A5674AEF25F28BA7DCFAECEEA348E541E6F5CC4EE63B71B361606AC3",
53+
// cacerts alias: camerfirmachambersca
54+
// DN: CN=Chambers of Commerce Root - 2008,
55+
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
56+
// L=Madrid (see current address at www.camerfirma.com/address),
57+
// C=EU
58+
"063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0",
59+
// cacerts alias: camerfirmachambersignca
60+
// DN: CN=Global Chambersign Root - 2008,
61+
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
62+
// L=Madrid (see current address at www.camerfirma.com/address),
63+
// C=EU
64+
"136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA"
65+
);
66+
67+
// Any TLS Server certificate that is anchored by one of the Camerfirma
68+
// roots above and is issued after this date will be distrusted.
69+
private static final LocalDate APRIL_15_2025 =
70+
LocalDate.of(2025, Month.APRIL, 15);
71+
72+
/**
73+
* This method assumes the eeCert is a TLS Server Cert and chains back to
74+
* the anchor.
75+
*
76+
* @param chain the end-entity's certificate chain. The end entity cert
77+
* is at index 0, the trust anchor at index n-1.
78+
* @throws ValidatorException if the certificate is distrusted
79+
*/
80+
static void checkDistrust(X509Certificate[] chain)
81+
throws ValidatorException {
82+
X509Certificate anchor = chain[chain.length-1];
83+
String fp = fingerprint(anchor);
84+
if (fp == null) {
85+
throw new ValidatorException("Cannot generate fingerprint for "
86+
+ "trust anchor of TLS server certificate");
87+
}
88+
if (FINGERPRINTS.contains(fp)) {
89+
Date notBefore = chain[0].getNotBefore();
90+
LocalDate ldNotBefore = LocalDate.ofInstant(notBefore.toInstant(),
91+
ZoneOffset.UTC);
92+
// reject if certificate is issued after April 15, 2025
93+
checkNotBefore(ldNotBefore, APRIL_15_2025, anchor);
94+
}
95+
}
96+
97+
private static String fingerprint(X509Certificate cert) {
98+
return X509CertImpl.getFingerprint("SHA-256", cert, debug);
99+
}
100+
101+
private static void checkNotBefore(LocalDate notBeforeDate,
102+
LocalDate distrustDate, X509Certificate anchor)
103+
throws ValidatorException {
104+
if (notBeforeDate.isAfter(distrustDate)) {
105+
throw new ValidatorException
106+
("TLS Server certificate issued after " + distrustDate +
107+
" and anchored by a distrusted legacy Camerfirma root CA: "
108+
+ anchor.getSubjectX500Principal(),
109+
ValidatorException.T_UNTRUSTED_CERT, anchor);
110+
}
111+
}
112+
113+
private CamerfirmaTLSPolicy() {}
114+
}

src/java.base/share/conf/security/java.security

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,9 @@ jdk.sasl.disabledMechanisms=
12891289
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
12901290
# an Entrust root CA and issued after November 11, 2024.
12911291
#
1292+
# CAMERFIRMA_TLS : Distrust TLS Server certificates anchored by
1293+
# a Camerfirma root CA and issued after April 15, 2025.
1294+
#
12921295
# Leading and trailing whitespace surrounding each value are ignored.
12931296
# Unknown values are ignored. If the property is commented out or set to the
12941297
# empty String, no policies are enforced.
@@ -1300,7 +1303,7 @@ jdk.sasl.disabledMechanisms=
13001303
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
13011304
# if this property is not enabled.
13021305
#
1303-
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
1306+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS,CAMERFIRMA_TLS
13041307

13051308
#
13061309
# FilePermission path canonicalization

src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,41 +28,20 @@
2828
import java.awt.GraphicsEnvironment;
2929
import java.awt.Toolkit;
3030

31-
import sun.awt.windows.WToolkit;
32-
3331
public class PlatformGraphicsInfo {
3432

35-
private static final boolean hasDisplays;
36-
37-
static {
38-
loadAWTLibrary();
39-
hasDisplays = hasDisplays0();
40-
}
41-
42-
@SuppressWarnings("removal")
43-
private static void loadAWTLibrary() {
44-
java.security.AccessController.doPrivileged(
45-
new java.security.PrivilegedAction<Void>() {
46-
public Void run() {
47-
System.loadLibrary("awt");
48-
return null;
49-
}
50-
});
51-
}
52-
53-
private static native boolean hasDisplays0();
54-
5533
public static GraphicsEnvironment createGE() {
5634
return new Win32GraphicsEnvironment();
5735
}
5836

5937
public static Toolkit createToolkit() {
60-
return new WToolkit();
38+
return new sun.awt.windows.WToolkit();
6139
}
6240

6341
public static boolean getDefaultHeadlessProperty() {
64-
// If we don't find usable displays, we run headless.
65-
return !hasDisplays;
42+
// On Windows, we assume we can always create headful apps.
43+
// Here is where we can add code that would actually check.
44+
return false;
6645
}
6746

6847
/*

src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -60,8 +60,7 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
6060
WToolkit.loadLibraries();
6161
// setup flags before initializing native layer
6262
WindowsFlags.initFlags();
63-
64-
initDisplay();
63+
initDisplayWrapper();
6564

6665
// Install correct surface manager factory.
6766
SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory());
@@ -89,6 +88,14 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
8988
*/
9089
private static native void initDisplay();
9190

91+
private static boolean displayInitialized; // = false;
92+
public static void initDisplayWrapper() {
93+
if (!displayInitialized) {
94+
displayInitialized = true;
95+
initDisplay();
96+
}
97+
}
98+
9299
public Win32GraphicsEnvironment() {
93100
}
94101

src/java.desktop/windows/native/libawt/windows/Devices.cpp

Lines changed: 33 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -85,75 +85,60 @@
8585
#include "Trace.h"
8686
#include "D3DPipelineManager.h"
8787

88-
typedef struct {
89-
int monitorCounter;
90-
int monitorLimit;
91-
HMONITOR* hmpMonitors;
92-
} MonitorData;
9388

89+
/* Some helper functions (from awt_MMStub.h/cpp) */
9490

95-
// Only monitors where CreateDC does not fail are valid
96-
static BOOL IsValidMonitor(HMONITOR hMon)
97-
{
98-
MONITORINFOEX mieInfo;
99-
memset((void*)(&mieInfo), 0, sizeof(MONITORINFOEX));
100-
mieInfo.cbSize = sizeof(MONITORINFOEX);
101-
if (!::GetMonitorInfo(hMon, (LPMONITORINFOEX)(&mieInfo))) {
102-
J2dTraceLn1(J2D_TRACE_INFO, "Devices::IsValidMonitor: GetMonitorInfo failed for monitor with handle %p", hMon);
103-
return FALSE;
104-
}
105-
106-
HDC hDC = CreateDC(mieInfo.szDevice, NULL, NULL, NULL);
107-
if (NULL == hDC) {
108-
J2dTraceLn2(J2D_TRACE_INFO, "Devices::IsValidMonitor: CreateDC failed for monitor with handle %p, device: %S", hMon, mieInfo.szDevice);
109-
return FALSE;
110-
}
111-
112-
::DeleteDC(hDC);
113-
return TRUE;
114-
}
91+
int g_nMonitorCounter;
92+
int g_nMonitorLimit;
93+
HMONITOR* g_hmpMonitors;
11594

11695
// Callback for CountMonitors below
117-
static BOOL WINAPI clb_fCountMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lpMonitorCounter)
96+
BOOL WINAPI clb_fCountMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lP)
11897
{
119-
if (IsValidMonitor(hMon)) {
120-
(*((int *)lpMonitorCounter))++;
121-
}
122-
98+
g_nMonitorCounter ++;
12399
return TRUE;
124100
}
125101

126102
int WINAPI CountMonitors(void)
127103
{
128-
int monitorCounter = 0;
129-
::EnumDisplayMonitors(NULL, NULL, clb_fCountMonitors, (LPARAM)&monitorCounter);
130-
return monitorCounter;
104+
g_nMonitorCounter = 0;
105+
::EnumDisplayMonitors(NULL, NULL, clb_fCountMonitors, 0L);
106+
return g_nMonitorCounter;
107+
131108
}
132109

133110
// Callback for CollectMonitors below
134-
static BOOL WINAPI clb_fCollectMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lpMonitorData)
111+
BOOL WINAPI clb_fCollectMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lP)
135112
{
136-
MonitorData* pMonitorData = (MonitorData *)lpMonitorData;
137-
if ((pMonitorData->monitorCounter < pMonitorData->monitorLimit) && (IsValidMonitor(hMon))) {
138-
pMonitorData->hmpMonitors[pMonitorData->monitorCounter] = hMon;
139-
pMonitorData->monitorCounter++;
113+
114+
if ((g_nMonitorCounter < g_nMonitorLimit) && (NULL != g_hmpMonitors)) {
115+
g_hmpMonitors[g_nMonitorCounter] = hMon;
116+
g_nMonitorCounter ++;
140117
}
141118

142119
return TRUE;
143120
}
144121

145-
static int WINAPI CollectMonitors(HMONITOR* hmpMonitors, int nNum)
122+
int WINAPI CollectMonitors(HMONITOR* hmpMonitors, int nNum)
146123
{
124+
int retCode = 0;
125+
147126
if (NULL != hmpMonitors) {
148-
MonitorData monitorData;
149-
monitorData.monitorCounter = 0;
150-
monitorData.monitorLimit = nNum;
151-
monitorData.hmpMonitors = hmpMonitors;
152-
::EnumDisplayMonitors(NULL, NULL, clb_fCollectMonitors, (LPARAM)&monitorData);
153-
return monitorData.monitorCounter;
154-
} else {
155-
return 0;
127+
128+
g_nMonitorCounter = 0;
129+
g_nMonitorLimit = nNum;
130+
g_hmpMonitors = hmpMonitors;
131+
132+
::EnumDisplayMonitors(NULL, NULL, clb_fCollectMonitors, 0L);
133+
134+
retCode = g_nMonitorCounter;
135+
136+
g_nMonitorCounter = 0;
137+
g_nMonitorLimit = 0;
138+
g_hmpMonitors = NULL;
139+
156140
}
141+
return retCode;
157142
}
158143

159144
BOOL WINAPI MonitorBounds(HMONITOR hmMonitor, RECT* rpBounds)

0 commit comments

Comments
 (0)