Fix missing error handling in keymaster comatibility check

The compatibility check assumes that the keymaster session was created
successfully which is a faulty assumption.

This patch adds propper error handling to the check.

Bug: 35576166
Change-Id: I0c70a0e53f488f8bd3164898722f490cd0573ce3
This commit is contained in:
Janis Danisevskis 2017-03-08 11:02:30 -08:00
parent a3b6d90934
commit e7152c38df

View file

@ -196,7 +196,12 @@ bool Keymaster::isSecure() {
using namespace ::android::vold;
int keymaster_compatibility_cryptfs_scrypt() {
return Keymaster().isSecure();
Keymaster dev;
if (!dev) {
LOG(ERROR) << "Failed to initiate keymaster session";
return -1;
}
return dev.isSecure();
}
int keymaster_create_key_for_cryptfs_scrypt(uint32_t rsa_key_size,