From f09ae181c55ab6cf1a3af4be11031a27e0fe3915 Mon Sep 17 00:00:00 2001 From: Dinesh K Garg Date: Wed, 28 Oct 2015 14:41:10 -0700 Subject: Wait for QSEECom listeners before calling KMS APIs Sometime it is possible that KMS APIs are invoked and QSEECom listeners are not up. This would cause failure from secure side and KMS API will fail eventually. This change waits for QSEECom listeners to be up before calling KMS APIs. If QSEECom listeners are not up even after wait period, API would fail without going to secure side. Change-Id: I211248645f92fc0fcfe6f250cb1f26661f5fb06c --- cryptfs_hw.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cryptfs_hw.c b/cryptfs_hw.c index b2efa4a..c7adfd1 100755 --- a/cryptfs_hw.c +++ b/cryptfs_hw.c @@ -67,6 +67,8 @@ #define KEYMASTER_PARTITION_NAME "/dev/block/bootdevice/by-name/keymaster" +#define QSEECOM_UP_CHECK_COUNT 10 + static int loaded_library = 0; static int (*qseecom_create_key)(int, void*); static int (*qseecom_update_key)(int, void*, void*); @@ -118,12 +120,32 @@ static void wipe_userdata() android_reboot(ANDROID_RB_RESTART2, 0, "recovery"); } +static int is_qseecom_up() +{ + int i = 0; + char value[PROPERTY_VALUE_MAX] = {0}; + + for (; i