Merge "Fix KM3.0 deleteKey behavior inconsistent with VTS test." into oc-dev

am: 8c5d56ecf5

Change-Id: I056e835343534887c7bb7afa05618bbe68bc7fbd
This commit is contained in:
Janis Danisevskis 2017-04-27 23:59:08 +00:00 committed by android-build-merger
commit 88f4efef4a

View file

@ -603,7 +603,13 @@ Return<ErrorCode> KeymasterDevice::deleteKey(const hidl_vec<uint8_t>& keyBlob) {
return ErrorCode::UNIMPLEMENTED; return ErrorCode::UNIMPLEMENTED;
} }
auto kmKeyBlob = hidlVec2KmKeyBlob(keyBlob); auto kmKeyBlob = hidlVec2KmKeyBlob(keyBlob);
return legacy_enum_conversion(keymaster_device_->delete_key(keymaster_device_, &kmKeyBlob)); auto rc = legacy_enum_conversion(
keymaster_device_->delete_key(keymaster_device_, &kmKeyBlob));
// Keymaster 3.0 requires deleteKey to return ErrorCode::OK if the key
// blob is unusable after the call. This is equally true if the key blob was
// unusable before.
if (rc == ErrorCode::INVALID_KEY_BLOB) return ErrorCode::OK;
return rc;
} }
Return<ErrorCode> KeymasterDevice::deleteAllKeys() { Return<ErrorCode> KeymasterDevice::deleteAllKeys() {