Add authorization enforcement to AndroidKeymaster.
Note: Moving List.h into system/keymaster is unfortunate, but required
to allow Trusty to use it. b/22088154 tracks cleaning this up.
Bug: 19511945
Change-Id: Ia1dfe5fda5ea78935611b0a7656b323770edcbae
diff --git a/soft_keymaster_device.cpp b/soft_keymaster_device.cpp
index 852abb2..dba91ee 100644
--- a/soft_keymaster_device.cpp
+++ b/soft_keymaster_device.cpp
@@ -60,6 +60,15 @@
SoftKeymasterDevice::SoftKeymasterDevice(keymaster0_device_t* keymaster0_device)
: impl_(new AndroidKeymaster(new SoftKeymasterContext(keymaster0_device), 16)) {
+ initialize(keymaster0_device);
+}
+
+SoftKeymasterDevice::SoftKeymasterDevice(KeymasterContext* context)
+ : impl_(new AndroidKeymaster(context, 16)) {
+ initialize(nullptr);
+}
+
+void SoftKeymasterDevice::initialize(keymaster0_device_t* keymaster0_device) {
static_assert(std::is_standard_layout<SoftKeymasterDevice>::value,
"SoftKeymasterDevice must be standard layout");
static_assert(offsetof(SoftKeymasterDevice, device_) == 0,