aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-11 15:46:30 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-11 15:46:30 +0000
commit6c9551e5614794bf4a5263eecf600a8f850273e2 (patch)
treefc1429839dfe155c00109c53400f949d198e8ece
parent6fe2bbebe694b4e26de44382d3f5b7b52776f918 (diff)
parent13b87a9d1fa088ec191594f29e3c42f44de3ff40 (diff)
downloadlibcore-android13-frc-os-statsd-release.tar.gz
Snap for 8712302 from 13b87a9d1fa088ec191594f29e3c42f44de3ff40 to tm-frc-os-statsd-releaset_frc_sta_330443010android13-frc-os-statsd-release
Change-Id: I2ef9be49ba4e536ab0bce51ea250a6a780d83d43
-rw-r--r--support/src/test/java/libcore/java/security/StandardNames.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/support/src/test/java/libcore/java/security/StandardNames.java b/support/src/test/java/libcore/java/security/StandardNames.java
index 688d4572195..df1a135a34d 100644
--- a/support/src/test/java/libcore/java/security/StandardNames.java
+++ b/support/src/test/java/libcore/java/security/StandardNames.java
@@ -19,6 +19,7 @@ package libcore.java.security;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.security.Provider;
import java.security.Security;
import java.security.spec.DSAPrivateKeySpec;
import java.security.spec.DSAPublicKeySpec;
@@ -98,6 +99,15 @@ public final class StandardNames {
assertTrue("Duplicate " + type + " " + algorithm,
algorithms.add(algorithm.toUpperCase(Locale.ROOT)));
}
+ // Only add to PROVIDER_ALGORITHMS if actually present
+ private static void provideOptional(String type, String algorithm) {
+ for (Provider p : Security.getProviders()) {
+ if (p.getService(type, algorithm) != null) {
+ provide(type, algorithm);
+ return;
+ }
+ }
+ }
private static void unprovide(String type, String algorithm) {
Set<String> algorithms = PROVIDER_ALGORITHMS.get(type);
assertNotNull(algorithms);
@@ -420,7 +430,7 @@ public final class StandardNames {
provide("Signature", "SHA256withRSA/PSS");
provide("Signature", "SHA384withRSA/PSS");
provide("Signature", "SHA512withRSA/PSS");
- provide("Signature", "ED25519");
+ provideOptional("Signature", "ED25519");
// different names: ARCFOUR vs ARC4
unprovide("Cipher", "ARCFOUR");