summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-02 00:23:52 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-02 00:23:52 +0000
commit5a4c85f69e001b23c530f2e04d2dc1a166015d00 (patch)
tree399488b95d25cadc312a90313fca743f1cfaa751
parent509d161c208c6aaea62a66fd3481235efce2cf31 (diff)
parente69d04f02edf88af6ed2bca1c2eb7719d9abc155 (diff)
downloadsecure_element-android13-d4-s1-release.tar.gz
Change-Id: I3baab1aee7f53de3ad86fbb9d2767e21b5632f8a
-rw-r--r--1.2/SecureElement.cpp8
-rw-r--r--1.2/StEseService.cpp20
2 files changed, 26 insertions, 2 deletions
diff --git a/1.2/SecureElement.cpp b/1.2/SecureElement.cpp
index 0ec90ae..b8b020f 100644
--- a/1.2/SecureElement.cpp
+++ b/1.2/SecureElement.cpp
@@ -523,6 +523,7 @@ SecureElement::seHalDeInit() {
Return<::android::hardware::secure_element::V1_0::SecureElementStatus>
SecureElement::reset() {
int ret = 0;
+ void* stdll = nullptr;
ESESTATUS status = ESESTATUS_SUCCESS;
SecureElementStatus sestatus = SecureElementStatus::FAILED;
std::string valueStr =
@@ -534,8 +535,11 @@ SecureElement::reset() {
if (status != ESESTATUS_SUCCESS) {
STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
if (valueStr.length() > 0) {
- valueStr = VENDOR_LIB_PATH + valueStr + VENDOR_LIB_EXT;
- void* stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+ stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+ if (!stdll) {
+ valueStr = VENDOR_LIB_PATH + valueStr + VENDOR_LIB_EXT;
+ stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+ }
if (stdll) {
STEseReset fn = (STEseReset)dlsym(stdll, "direct_reset");
if (fn) {
diff --git a/1.2/StEseService.cpp b/1.2/StEseService.cpp
index 7fa8e9f..c6faef3 100644
--- a/1.2/StEseService.cpp
+++ b/1.2/StEseService.cpp
@@ -17,12 +17,16 @@
*
******************************************************************************/
#define LOG_TAG "ese@1.2-service.st"
+#include <android-base/properties.h>
#include <android/hardware/secure_element/1.2/ISecureElement.h>
+#include <dlfcn.h>
#include <hidl/LegacySupport.h>
#include <log/log.h>
#include "SecureElement.h"
+typedef int (*STEsePreProcess)(void);
+
// Generated HIDL files
using android::OK;
using android::sp;
@@ -36,6 +40,22 @@ int main() {
ALOGD("Secure Element HAL Service 1.2 is starting.");
sp<ISecureElement> se_service = new SecureElement();
configureRpcThreadpool(1, true /*callerWillJoin*/);
+
+ // Ignore this dlopen if you don't need it.
+ std::string valueStr =
+ android::base::GetProperty("persist.vendor.se.stpreprocess", "");
+ void* stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+ if (stdll) {
+ STEsePreProcess fn = (STEsePreProcess)dlsym(stdll, "pre_process");
+ if (fn) {
+ if (fn() == 0) {
+ ALOGD("%s: init done", __func__);
+ } else {
+ ALOGE("%s: Error init ", __func__);
+ }
+ }
+ }
+
status_t status = se_service->registerAsService("eSE1");
if (status != OK) {
LOG_ALWAYS_FATAL(