From ebfdba67d23044ce9f65744425790b4ee107fc46 Mon Sep 17 00:00:00 2001 From: Garret Kelly Date: Wed, 24 Apr 2019 17:38:40 -0400 Subject: [PATCH] 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 --- keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fc96724225..cf12e2a4b5 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");