Fix pass-through of deletion on wrapped KM0 and KM1.
SoftKeymasterDevice was incorrectly directly sending deletion requests
to wrapped hardware. In some cases the key blob passed in by
SoftKeymasterDevice is a hardware blob encapsulated by a wrapper, and we
need to remove the encapsulation before passing it on.
Bug: 25676862
Change-Id: Ic315c6b08d9ec15aa0be8f28f485a221bc7f1135
diff --git a/keymaster1_engine.cpp b/keymaster1_engine.cpp
index 6b40022..bec3007 100644
--- a/keymaster1_engine.cpp
+++ b/keymaster1_engine.cpp
@@ -121,6 +121,18 @@
return error;
}
+keymaster_error_t Keymaster1Engine::DeleteKey(const KeymasterKeyBlob& blob) const {
+ if (!keymaster1_device_->delete_key)
+ return KM_ERROR_OK;
+ return keymaster1_device_->delete_key(keymaster1_device_, &blob);
+}
+
+keymaster_error_t Keymaster1Engine::DeleteAllKeys() const {
+ if (!keymaster1_device_->delete_all_keys)
+ return KM_ERROR_OK;
+ return keymaster1_device_->delete_all_keys(keymaster1_device_);
+}
+
RSA* Keymaster1Engine::BuildRsaKey(const KeymasterKeyBlob& blob,
const AuthorizationSet& additional_params,
keymaster_error_t* error) const {