diff options
-rw-r--r-- | rules.mk | 9 | ||||
-rw-r--r-- | trusty_gatekeeper.cpp | 8 |
2 files changed, 13 insertions, 4 deletions
@@ -43,6 +43,15 @@ MODULE_INCLUDES += \ # TODO(ncbray): remove the VLA and turn the warning back on. MODULE_COMPILEFLAGS := -Wno-vla + +# This should be set to an appropriate storage service port. +# For example, if a device implements factory reset protection using gatekeeper, +# it should be set to STORAGE_CLIENT_TDP_PORT or STORAGE_CLIENT_TP_PORT. +GATEKEEPER_STORAGE_PORT ?= STORAGE_CLIENT_TD_PORT + +MODULE_DEFINES += \ + GATEKEEPER_STORAGE_PORT=$(GATEKEEPER_STORAGE_PORT) \ + include $(LOCAL_DIR)/$(IPC)/rules.mk include make/module.mk diff --git a/trusty_gatekeeper.cpp b/trusty_gatekeeper.cpp index 99c466e..a24974d 100644 --- a/trusty_gatekeeper.cpp +++ b/trusty_gatekeeper.cpp @@ -212,7 +212,7 @@ bool TrustyGateKeeper::GetSecureFailureRecord(uint32_t uid, secure_id_t user_id, failure_record_t* record) { storage_session_t session; - int rc = storage_open_session(&session, STORAGE_CLIENT_TD_PORT); + int rc = storage_open_session(&session, GATEKEEPER_STORAGE_PORT); if (rc < 0) { TLOGE("Error: [%d] opening storage session\n", rc); return false; @@ -279,7 +279,7 @@ bool TrustyGateKeeper::ClearFailureRecord(uint32_t uid, bool TrustyGateKeeper::WriteSecureFailureRecord(uint32_t uid, failure_record_t* record) { storage_session_t session; - int rc = storage_open_session(&session, STORAGE_CLIENT_TD_PORT); + int rc = storage_open_session(&session, GATEKEEPER_STORAGE_PORT); if (rc < 0) { TLOGE("Error: [%d] failed to open storage session\n", rc); return false; @@ -400,7 +400,7 @@ gatekeeper_error_t TrustyGateKeeper::RemoveUser(uint32_t uid) { } storage_session_t session; - int rc = storage_open_session(&session, STORAGE_CLIENT_TD_PORT); + int rc = storage_open_session(&session, GATEKEEPER_STORAGE_PORT); if (rc < 0) { TLOGE("Error: [%d] opening storage session\n", rc); return ERROR_UNKNOWN; @@ -426,7 +426,7 @@ gatekeeper_error_t TrustyGateKeeper::RemoveUser(uint32_t uid) { gatekeeper_error_t TrustyGateKeeper::RemoveAllUsers() { storage_session_t session; - int rc = storage_open_session(&session, STORAGE_CLIENT_TD_PORT); + int rc = storage_open_session(&session, GATEKEEPER_STORAGE_PORT); if (rc < 0) { TLOGE("Error: [%d] opening storage session\n", rc); return ERROR_UNKNOWN; |