Add placeholder for types generated from AIDL
Test: None
Bug: 160623310
Change-Id: Ib16003543c416010edf17ee7659033434d70c0f3
diff --git a/keystore2/Android.bp b/keystore2/Android.bp
index 5df94cb..4b031f8 100644
--- a/keystore2/Android.bp
+++ b/keystore2/Android.bp
@@ -25,3 +25,12 @@
test_suites: ["general-tests"],
auto_gen_config: true,
}
+
+// This is a placeholder for the libraries that will be generated from the AIDL specs
+// eventually.
+rust_library {
+ name: "libkeystore_aidl_generated",
+ crate_name: "keystore_aidl_generated",
+
+ srcs: ["src/aidl_generated.rs"],
+}
diff --git a/keystore2/src/aidl_generated.rs b/keystore2/src/aidl_generated.rs
new file mode 100644
index 0000000..4b6a844
--- /dev/null
+++ b/keystore2/src/aidl_generated.rs
@@ -0,0 +1,99 @@
+// Copyright 2020, The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#![allow(missing_docs)]
+
+//! This crate holds types that we are depending on and will be generated by the AIDL
+//! compiler.
+
+use std::cmp::PartialEq;
+use std::fmt;
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct Result {
+ pub rc: ResponseCode,
+ pub km_error_code: i32,
+}
+
+impl fmt::Display for Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "{:?}", self)
+ }
+}
+
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub enum ResponseCode {
+ Ok = 0,
+ // 1 Reserved - formerly NO_ERROR
+ Locked = 2,
+ Uninitialized = 3,
+ SystemError = 4,
+ // 5 Reserved - formerly "protocol error" was never used
+ PermissionDenied = 6,
+ KeyNotFound = 7,
+ ValueCorrupted = 8,
+ // 9 Reserved - formerly "undefined action" was never used
+ WrongPassword = 10,
+ // 11 - 13 Reserved - formerly password retry count indicators: obsolete
+ //
+ // 14 Reserved - formerly SIGNATURE_INVALID: Keystore does not perform public key
+ // operations any more.
+
+ // Indicates to the caller that user authorization is required before the operation may
+ // commence.
+ OpAuthNeeded = 15,
+ // 16 Reserved
+ KeyPermanentlyInvalidated = 17,
+ NoSuchSecurityLevel = 18,
+ KeymintErrorCode = 19,
+ BackendBusy = 20,
+}
+
+pub type ErrorCode = i32;
+
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub enum KeyPermission {
+ None = 0,
+ Delete = 1,
+ GenUniqueId = 2,
+ GetInfo = 4,
+ Grant = 8,
+ List = 0x10,
+ ManageBlob = 0x20,
+ Rebind = 0x40,
+ ReqForcedOp = 0x80,
+ Update = 0x100,
+ Use = 0x200,
+ UseDevId = 0x400,
+}
+
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub enum Domain {
+ App = 0,
+ Grant = 1,
+ SELinux = 2,
+ Blob = 3,
+ KeyId = 4,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct KeyDescriptor {
+ pub domain: Domain,
+ pub namespace_: i64,
+ pub alias: Option<String>,
+ pub blob: Option<Vec<u8>>,
+}