aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-09 03:21:45 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-09 03:21:45 +0000
commit5fca9d52f43f26e04e068b09fac8eafffd38a04a (patch)
tree20f7947e5b55dd3b38284c65c9b83dcf1653f7df
parent289dbefcf8f901131a58b996bd0b275088088b0f (diff)
parent85e48ac1e3cb1a3f1e42c5da0b37a60b56cbf6b6 (diff)
downloadwycheproof-5fca9d52f43f26e04e068b09fac8eafffd38a04a.tar.gz
Snap for 9467325 from 85e48ac1e3cb1a3f1e42c5da0b37a60b56cbf6b6 to udc-d1-release
Change-Id: I67d2907d7061b147266521faf35e2cfeda6223e5
-rw-r--r--keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java5
-rw-r--r--keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java6
2 files changed, 11 insertions, 0 deletions
diff --git a/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java b/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
index a6c186f..d174cbf 100644
--- a/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
+++ b/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
@@ -15,6 +15,7 @@ package android.keystore.cts.util;
import android.content.Context;
import android.security.keystore.KeyProtection;
+import android.keystore.cts.util.TestUtils;
import androidx.test.core.app.ApplicationProvider;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
@@ -86,6 +87,10 @@ public class KeyStoreUtil {
}
}
+ public static int getFeatureVersionKeystore() {
+ return TestUtils.getFeatureVersionKeystore(ApplicationProvider.getApplicationContext());
+ }
+
public static boolean hasStrongBox() {
Context context = ApplicationProvider.getApplicationContext();
return TestUtils.hasStrongBox(context);
diff --git a/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java b/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java
index 39a3b0a..ed4987c 100644
--- a/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java
+++ b/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java
@@ -15,6 +15,7 @@ package com.google.security.wycheproof;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -196,6 +197,11 @@ public class RsaOaepTest {
String sha = getString(group, "sha");
String mgf = getString(group, "mgf");
String mgfSha = getString(group, "mgfSha");
+ // mgfDigest other than SHA-1 are supported from KeyMint V1 and above.
+ if (!mgfSha.equalsIgnoreCase("SHA-1")) {
+ assumeTrue("This test is valid for KeyMint version 1 and above.",
+ KeyStoreUtil.getFeatureVersionKeystore() >= KeyStoreUtil.KM_VERSION_KEYMINT_1);
+ }
PSource p = PSource.PSpecified.DEFAULT;
if (test.has("label") && !TextUtils.isEmpty(getString(test, "label"))) {
// p = new PSource.PSpecified(getBytes(test, "label"));