1/*
2 * Copyright (C) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#include "mock.h"
16
17namespace OHOS {
18namespace HDI {
19namespace SecureElement {
20
21int SecureElementCaProxy::VendorSecureElementCaOnStart() const
22{
23    auto p = MockTee::GetMockTee();
24    if (!p) {
25        return 0;
26    }
27    return p->VendorSecureElementCaOnStart();
28}
29
30int SecureElementCaProxy::VendorSecureElementCaInit() const
31{
32    auto p = MockTee::GetMockTee();
33    if (!p) {
34        return 0;
35    }
36    return p->VendorSecureElementCaInit();
37}
38
39int SecureElementCaProxy::VendorSecureElementCaUninit() const
40{
41    auto p = MockTee::GetMockTee();
42    if (!p) {
43        return 0;
44    }
45    return p->VendorSecureElementCaUninit();
46}
47
48int SecureElementCaProxy::VendorSecureElementCaGetAtr(uint8_t *rsp, uint32_t *rspLen) const
49{
50    auto p = MockTee::GetMockTee();
51    if (!p) {
52        return 0;
53    }
54    return p->VendorSecureElementCaGetAtr(rsp, rspLen);
55}
56
57int SecureElementCaProxy::VendorSecureElementCaOpenLogicalChannel(uint8_t *aid, uint32_t len, uint8_t p2,
58    uint8_t *rsp, uint32_t *rspLen, uint32_t *channelNum) const
59{
60    auto p = MockTee::GetMockTee();
61    if (!p) {
62        return 0;
63    }
64    return p->VendorSecureElementCaOpenLogicalChannel(aid, len, p2, rsp, rspLen, channelNum);
65}
66
67int SecureElementCaProxy::VendorSecureElementCaOpenBasicChannel(uint8_t *aid, uint32_t len, uint8_t *rsp,
68    uint32_t *rspLen) const
69{
70    auto p = MockTee::GetMockTee();
71    if (!p) {
72        return 0;
73    }
74    return p->VendorSecureElementCaOpenBasicChannel(aid, len, rsp, rspLen);
75}
76
77int SecureElementCaProxy::VendorSecureElementCaCloseChannel(uint32_t channelNum) const
78{
79    auto p = MockTee::GetMockTee();
80    if (!p) {
81        return 0;
82    }
83    return p->VendorSecureElementCaCloseChannel(channelNum);
84}
85
86int SecureElementCaProxy::VendorSecureElementCaTransmit(uint8_t *cmd, uint32_t cmdLen, uint8_t *rsp,
87    uint32_t *rspLen) const
88{
89    auto p = MockTee::GetMockTee();
90    if (!p) {
91        return 0;
92    }
93    return p->VendorSecureElementCaTransmit(cmd, cmdLen, rsp, rspLen);
94}
95SecureElementCaProxy::DynamicLoad::DynamicLoad(const std::string &lib) {}
96
97SecureElementCaProxy::DynamicLoad::~DynamicLoad() {}
98
99bool SecureElementCaProxy::DynamicLoad::LoadLib()
100{
101    return false;
102}
103
104bool SecureElementCaProxy::DynamicLoad::CloseLib()
105{
106    return false;
107}
108} // SecureElement
109} // HDI
110} // OHOS