Keystore 2.0: Add back dependency on KeyMint AIDL spec.
We are using SecurityLevel, KeyParameter, and HardwareAuthenticatorType
from the KeyMint spec now, instead of defining our own versions of these
types.
Test: keystore2_test
Change-Id: I0080382cb3619f7153ea3a6e49bb7b5f4b23f15b
diff --git a/keystore2/src/utils.rs b/keystore2/src/utils.rs
index 66a7e50..1c678c3 100644
--- a/keystore2/src/utils.rs
+++ b/keystore2/src/utils.rs
@@ -19,11 +19,10 @@
use crate::permission::{KeyPerm, KeyPermSet, KeystorePerm};
use crate::{error::Error, key_parameter::KeyParameterValue};
use android_hardware_keymint::aidl::android::hardware::keymint::{
- KeyCharacteristics::KeyCharacteristics, KeyParameter::KeyParameter as KmParam,
- SecurityLevel::SecurityLevel, Tag::Tag,
+ KeyCharacteristics::KeyCharacteristics, SecurityLevel::SecurityLevel,
};
use android_system_keystore2::aidl::android::system::keystore2::{
- Authorization::Authorization, KeyDescriptor::KeyDescriptor, KeyParameter::KeyParameter,
+ Authorization::Authorization, KeyDescriptor::KeyDescriptor,
};
use anyhow::{anyhow, Context};
use binder::{FromIBinder, SpIBinder, ThreadState};
@@ -78,40 +77,6 @@
})
}
-/// This function converts a `KeyParameter` from the keystore2 AIDL
-/// bindings into a `KeyParameter` from the keymint AIDL bindings.
-/// TODO This is a temporary workaround until the keymint AIDL spec
-/// lands.
-pub fn keyparam_ks_to_km(p: &KeyParameter) -> KmParam {
- KmParam {
- tag: Tag(p.tag),
- boolValue: p.boolValue,
- integer: p.integer,
- longInteger: p.longInteger,
- blob: match &p.blob {
- Some(b) => b.clone(),
- None => vec![],
- },
- }
-}
-
-/// This function converts a `KeyParameter` from the keymint AIDL
-/// bindings into a `KeyParameter` from the keystore2 AIDL bindings.
-/// TODO This is a temporary workaround until the keymint AIDL spec
-/// lands.
-pub fn keyparam_km_to_ks(p: &KmParam) -> KeyParameter {
- KeyParameter {
- tag: p.tag.0,
- boolValue: p.boolValue,
- integer: p.integer,
- longInteger: p.longInteger,
- blob: match p.blob.len() {
- 0 => None,
- _ => Some(p.blob.clone()),
- },
- }
-}
-
/// Thread safe wrapper around SpIBinder. It is safe to have SpIBinder smart pointers to the
/// same object in multiple threads, but cloning a SpIBinder is not thread safe.
/// Keystore frequently hands out binder tokens to the security level interface. If this