aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Patil <patilprashant@google.com>2023-01-07 23:25:54 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-01-07 23:25:54 +0000
commita42228efc6012441f75714bf0db1bf493ed93161 (patch)
tree20f7947e5b55dd3b38284c65c9b83dcf1653f7df
parent5397bfcb4903e8ee6fbfa1011b75709df4a0107c (diff)
parent2a67b1cf2ec2aa42e5c94b9d455cbbf5b1e39cb7 (diff)
downloadwycheproof-a42228efc6012441f75714bf0db1bf493ed93161.tar.gz
Keystore:Assumption for non default MGF digest. am: c9c8b81a1a am: 8801bdbf40 am: 2a67b1cf2e
Original change: https://android-review.googlesource.com/c/platform/external/wycheproof/+/2358819 Change-Id: Ied6422da6f356575a96ee49427abe9bcef8a8886 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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"));