Keystore 2.0: Observe revision of the Keystore 2.0 AIDL interface.
Remove output parameters by moving them into designated output
structures.
Test: see VTS test
Change-Id: If629f206b4bb69a798e63be37062bf507338d0f5
diff --git a/keystore2/src/utils.rs b/keystore2/src/utils.rs
index 825b34a..27044dd 100644
--- a/keystore2/src/utils.rs
+++ b/keystore2/src/utils.rs
@@ -95,6 +95,24 @@
}
}
+/// 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,
+ dateTime: p.dateTime,
+ 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