Use wrapped keymaster0 device's value of KEYMASTER_SOFTWARE_ONLY
SoftKeymasterDevice always sets KEYMASTER_SOFTWARE_ONLY but this isn't
true when wrapping a keymaster0 hardware device. This breaks CTS.
Note this with how the wrapper is implemented _some_ keys from the
wrapped adapter will be software backed and there is no way to tell in
keychain where it'll land.
Bug: 21635583
Change-Id: Ic2e38d4ffe12536eea37e688aaf17c2516f3194b
diff --git a/soft_keymaster_device.cpp b/soft_keymaster_device.cpp
index 60037df..6e5ed80 100644
--- a/soft_keymaster_device.cpp
+++ b/soft_keymaster_device.cpp
@@ -76,8 +76,12 @@
device_.common.module = reinterpret_cast<hw_module_t*>(&soft_keymaster_device_module);
device_.common.close = &close_device;
- device_.flags =
- KEYMASTER_SOFTWARE_ONLY | KEYMASTER_BLOBS_ARE_STANDALONE | KEYMASTER_SUPPORTS_EC;
+ device_.flags = KEYMASTER_BLOBS_ARE_STANDALONE | KEYMASTER_SUPPORTS_EC;
+ if (keymaster0_device) {
+ device_.flags |= keymaster0_device->flags & KEYMASTER_SOFTWARE_ONLY;
+ } else {
+ device_.flags |= KEYMASTER_SOFTWARE_ONLY;
+ }
// keymaster0 APIs
device_.generate_keypair = generate_keypair;