summaryrefslogtreecommitdiffstats
path: root/keymaster
diff options
context:
space:
mode:
authorGarret Kelly <gdk@google.com>2019-04-24 17:38:40 -0400
committerGarret Kelly <gdk@google.com>2019-04-24 17:39:57 -0400
commitebfdba67d23044ce9f65744425790b4ee107fc46 (patch)
treeeaac323e9b8b0642b5f80116f0cb75efb246da1d /keymaster
parent34e718703d37d19ef377d5eeb06e75d5d05b6762 (diff)
downloadandroid_hardware_interfaces-ebfdba67d23044ce9f65744425790b4ee107fc46.tar.gz
android_hardware_interfaces-ebfdba67d23044ce9f65744425790b4ee107fc46.tar.bz2
android_hardware_interfaces-ebfdba67d23044ce9f65744425790b4ee107fc46.zip
Fix comparison between hex and binary values
The verified boot hash in the attestation record is a binary blob, while the property read from the system is a hex-encoded value. Convert the boot hash from the attestation record into hex before comparing. Test: VtsHalKeymasterV4_0TargetTest Bug: 130843899 Change-Id: I6f6e0da71501d741dd8b27d0778e1854af17ace6
Diffstat (limited to 'keymaster')
-rw-r--r--keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index fc9672422..cf12e2a4b 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -414,7 +414,7 @@ bool verify_attestation_record(const string& challenge, const string& app_id,
EXPECT_NE(strcmp(property_value, "nogood"), 0);
string prop_string(property_value);
EXPECT_EQ(prop_string.size(), 64);
- EXPECT_EQ(0, memcmp(verified_boot_hash.data(), prop_string.data(), verified_boot_hash.size()));
+ EXPECT_EQ(prop_string, bin2hex(verified_boot_hash));
property_get("ro.boot.vbmeta.device_state", property_value, "nogood");
EXPECT_NE(property_value, "nogood");