This commit is contained in:
Jesper Wilhelmsson 2021-06-15 22:45:28 +00:00
commit e0f6f70d3f
62 changed files with 1423 additions and 424 deletions

View file

@ -26,6 +26,7 @@
package sun.security.jca;
import java.security.Provider;
import sun.security.x509.AlgorithmId;
/**
* Collection of methods to get and set provider list. Also includes
@ -150,7 +151,17 @@ public class Providers {
} else {
changeThreadProviderList(newList);
}
clearCachedValues();
}
/**
* Clears the cached provider-list-specific values. These values need to
* be re-generated whenever provider list is changed. The logic for
* generating them is in the respective classes.
*/
private static void clearCachedValues() {
JCAUtil.clearDefSecureRandom();
AlgorithmId.clearAliasOidsTable();
}
/**

View file

@ -536,6 +536,11 @@ public class AlgorithmId implements Serializable, DerEncoder {
// oid string cache index'ed by algorithm name and oid strings
private static volatile Map<String,String> aliasOidsTable;
// called by sun.security.jca.Providers whenever provider list is changed
public static void clearAliasOidsTable() {
aliasOidsTable = null;
}
// returns the aliasOidsTable, lazily initializing it on first access.
private static Map<String,String> aliasOidsTable() {
// Double checked locking; safe because aliasOidsTable is volatile