Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -82,6 +83,7 @@ public final class RestrictedSecurity {

private static RestrictedSecurityProperties restricts;

private static final AtomicInteger hashPauseCount = new AtomicInteger(0);
private static final Set<String> unmodifiableProperties = new HashSet<>();

static {
Expand Down Expand Up @@ -164,13 +166,21 @@ private static void checkHashValues(boolean fromProviders) {
if (fromProviders) {
enableCheckHashes = true;
}
if (enableCheckHashes && !isJarVerifierInStackTrace()) {
if (enableCheckHashes && !isJarVerifierInStackTrace() && (hashPauseCount.get() == 0)) {
profileParser = null;
parser.checkHashValues();
}
}
}

public static void pauseHashCheck() {
hashPauseCount.incrementAndGet();
}

public static void resumeHashCheck() {
hashPauseCount.decrementAndGet();
}

/**
* Check if restricted security mode is enabled.
*
Expand Down
9 changes: 9 additions & 0 deletions src/java.base/share/classes/java/util/jar/JarFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2025, 2025 All Rights Reserved
* ===========================================================================
*/

package java.util.jar;

import jdk.internal.access.SharedSecrets;
import jdk.internal.access.JavaUtilZipFileAccess;
import jdk.internal.misc.ThreadTracker;
import openj9.internal.security.RestrictedSecurity;
import sun.security.util.ManifestEntryVerifier;
import sun.security.util.SignatureFileVerifier;

Expand Down Expand Up @@ -1045,10 +1052,12 @@ synchronized void ensureInitialization() {
}
if (jv != null && !jvInitialized) {
Object key = beginInit();
RestrictedSecurity.pauseHashCheck();
try {
initializeVerifier();
jvInitialized = true;
} finally {
RestrictedSecurity.resumeHashCheck();
endInit(key);
}
}
Expand Down
1 change: 0 additions & 1 deletion test/jdk/ProblemList-FIPS140_3_OpenJcePlus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ java/security/SecureRandom/Serialize.java https://github.com/eclipse-openj9/open
java/security/SecureRandom/SerializedSeedTest.java https://github.com/eclipse-openj9/openj9/issues/20978 generic-all
java/security/SecureRandom/ThreadSafe.java https://github.com/eclipse-openj9/openj9/issues/20978 generic-all
java/security/Security/CaseInsensitiveAlgNames.java https://github.com/eclipse-openj9/openj9/issues/20978 generic-all
java/security/Security/ClassLoaderDeadlock/Deadlock.java https://github.com/eclipse-openj9/openj9/issues/21919 generic-all
java/security/Security/ConfigFileTest.java https://github.com/eclipse-openj9/openj9/issues/20978 generic-all
java/security/Security/ProviderFiltering.java https://github.com/eclipse-openj9/openj9/issues/20978 generic-all
java/security/Security/removing/RemoveProviderByIdentity.java https://github.com/eclipse-openj9/openj9/issues/20978 generic-all
Expand Down