1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <dlfcn.h>
17 #include <log/log.h>
18 
19 #include "SecureElement.h"
20 #include <aidl/android/hardware/secure_element/BnSecureElement.h>
21 #include <android-base/hex.h>
22 #include <android-base/logging.h>
23 #include <android/binder_manager.h>
24 #include <android/binder_process.h>
25 
26 using android::OK;
27 
28 using aidl::android::hardware::secure_element::BnSecureElement;
29 using aidl::android::hardware::secure_element::ISecureElementCallback;
30 using aidl::android::hardware::secure_element::LogicalChannelResponse;
31 using android::base::HexString;
32 using ndk::ScopedAStatus;
33 
main()34 int main() {
35   ALOGD("android.hardware.secure_element-service.thales-st33 is starting.");
36   ALOGD("Thales Secure Element AIDL for eSE1 Service 1.6.0 is starting. libse-gto v1.13");
37 
38   ABinderProcess_setThreadPoolMaxThreadCount(0);
39 
40   auto se_service = ndk::SharedRefBase::make<se::SecureElement>("eSE1");
41   const std::string name = std::string() + BnSecureElement::descriptor + "/eSE1";
42   binder_status_t status = AServiceManager_addService(se_service->asBinder().get(), name.c_str());
43   CHECK_EQ(status, STATUS_OK);
44 
45   ABinderProcess_joinThreadPool();
46   return EXIT_FAILURE;  // should not reach
47 
48 }
49