Skip to content

Commit e838abc

Browse files
Remove JDK21 code for security provider handling.
1 parent 967efbb commit e838abc

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SecuritySubstitutions.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
import com.oracle.svm.util.ReflectionUtil;
6767

6868
import jdk.graal.compiler.core.common.SuppressFBWarnings;
69-
import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
7069
import sun.security.util.Debug;
7170
import sun.security.util.SecurityConstants;
7271

@@ -471,7 +470,6 @@ final class Target_sun_security_jca_ProviderConfig {
471470
* reachable via a security service.
472471
*/
473472
@Substitute
474-
@SuppressWarnings("fallthrough")
475473
@SuppressFBWarnings(value = "DC_DOUBLECHECK", justification = "This double-check is implemented correctly and is intentional.")
476474
Provider getProvider() {
477475
// volatile variable load
@@ -508,6 +506,11 @@ Provider getProvider() {
508506
p = support.isSecurityProviderExpected("SunJSSE", "sun.security.ssl.SunJSSE") ? new sun.security.ssl.SunJSSE() : null;
509507
break;
510508
}
509+
case "SunEC": {
510+
// Constructor inside method and then allocate. ModuleSupport to open.
511+
p = support.isSecurityProviderExpected("SunEC", "sun.security.ec.SunEC") ? support.allocateSunECProvider() : null;
512+
break;
513+
}
511514
case "Apple", "apple.security.AppleProvider": {
512515
// need to use reflection since this class only exists on MacOsx
513516
try {
@@ -525,20 +528,6 @@ Provider getProvider() {
525528
}
526529
break;
527530
}
528-
case "SunEC": {
529-
if (JavaVersionUtil.JAVA_SPEC > 21) {
530-
// Constructor inside method and then allocate. ModuleSupport to open.
531-
p = support.isSecurityProviderExpected("SunEC", "sun.security.ec.SunEC") ? support.allocateSunECProvider() : null;
532-
break;
533-
}
534-
/*
535-
* On older JDK versions, SunEC was part of the `jdk.crypto.ec` module and was
536-
* allocated via the service loading mechanism, so this fallthrough is
537-
* intentional. On newer JDK versions, SunEC is part of `java.base` and is
538-
* allocated directly.
539-
*/
540-
}
541-
// fall through
542531
default: {
543532
if (isLoading) {
544533
// because this method is synchronized, this can only

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,9 @@ public void duringSetup(DuringSetupAccess a) {
220220
oidTableField = access.findField("sun.security.util.ObjectIdentifier", "oidTable");
221221
oidMapField = access.findField(OIDMap.class, "oidMap");
222222

223-
if (JavaVersionUtil.JAVA_SPEC > 21) {
224-
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, SecuritySubstitutions.class, false, "java.base", "sun.security.ec");
225-
Constructor<?> sunECConstructor = constructor(a, "sun.security.ec.SunEC");
226-
SecurityProvidersSupport.singleton().setSunECConstructor(sunECConstructor);
227-
}
223+
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, SecuritySubstitutions.class, false, "java.base", "sun.security.ec");
224+
Constructor<?> sunECConstructor = constructor(a, "sun.security.ec.SunEC");
225+
SecurityProvidersSupport.singleton().setSunECConstructor(sunECConstructor);
228226

229227
Properties securityProperties = SharedSecrets.getJavaSecurityPropertiesAccess().getInitialProperties();
230228
SecurityProvidersSupport.singleton().setSavedInitialSecurityProperties(securityProperties);

0 commit comments

Comments
 (0)