1
2 /*
3 * Copyright (c) 2024 Huawei Device Co., Ltd.
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
17 #include "fbex_mock.h"
18
19 using namespace std;
20
21 using namespace OHOS::StorageDaemon;
22
IsFBEXSupported()23 bool FBEX::IsFBEXSupported()
24 {
25 return IFbexMoc::fbexMoc->IsFBEXSupported();
26 }
27
InstallEL5KeyToKernel(uint32_t userIdSingle,uint32_t userIdDouble,uint8_t flag,bool & isSupport,bool & isNeedEncryptClassE)28 int FBEX::InstallEL5KeyToKernel(uint32_t userIdSingle, uint32_t userIdDouble, uint8_t flag,
29 bool &isSupport, bool &isNeedEncryptClassE)
30 {
31 return IFbexMoc::fbexMoc->InstallEL5KeyToKernel(userIdSingle, userIdDouble, flag, isSupport, isNeedEncryptClassE);
32 }
33
InstallKeyToKernel(uint32_t userId,uint32_t type,uint8_t * iv,uint32_t size,uint8_t flag)34 int FBEX::InstallKeyToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size, uint8_t flag)
35 {
36 return IFbexMoc::fbexMoc->InstallKeyToKernel(userId, type, iv, size, flag);
37 }
38
UninstallOrLockUserKeyToKernel(uint32_t userId,uint32_t type,uint8_t * iv,uint32_t size,bool destroy)39 int FBEX::UninstallOrLockUserKeyToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size, bool destroy)
40 {
41 return IFbexMoc::fbexMoc->UninstallOrLockUserKeyToKernel(userId, type, iv, size, destroy);
42 }
43
DeleteClassEPinCode(uint32_t userIdSingle,uint32_t userIdDouble)44 int FBEX::DeleteClassEPinCode(uint32_t userIdSingle, uint32_t userIdDouble)
45 {
46 return IFbexMoc::fbexMoc->DeleteClassEPinCode(userIdSingle, userIdDouble);
47 }
48
ChangePinCodeClassE(uint32_t userIdSingle,uint32_t userIdDouble,bool & isFbeSupport)49 int FBEX::ChangePinCodeClassE(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)
50 {
51 return IFbexMoc::fbexMoc->ChangePinCodeClassE(userIdSingle, userIdDouble, isFbeSupport);
52 }
53
54 // for el3 & el4
LockScreenToKernel(uint32_t userId)55 int FBEX::LockScreenToKernel(uint32_t userId)
56 {
57 return IFbexMoc::fbexMoc->LockScreenToKernel(userId);
58 }
59
GenerateAppkey(UserIdToFbeStr & userIdToFbe,uint32_t appUid,std::unique_ptr<uint8_t[]> & appKey,uint32_t size)60 int FBEX::GenerateAppkey(UserIdToFbeStr &userIdToFbe, uint32_t appUid, std::unique_ptr<uint8_t[]> &appKey,
61 uint32_t size)
62 {
63 return IFbexMoc::fbexMoc->GenerateAppkey(userIdToFbe, appUid, appKey, size);
64 }
65
66 // for el5
LockUece(uint32_t userIdSingle,uint32_t userIdDouble,bool & isFbeSupport)67 int FBEX::LockUece(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)
68 {
69 return IFbexMoc::fbexMoc->LockUece(userIdSingle, userIdDouble, isFbeSupport);
70 }
71
UnlockScreenToKernel(uint32_t userId,uint32_t type,uint8_t * iv,uint32_t size)72 int FBEX::UnlockScreenToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size)
73 {
74 return IFbexMoc::fbexMoc->UnlockScreenToKernel(userId, type, iv, size);
75 }
76
ReadESecretToKernel(UserIdToFbeStr & userIdToFbe,uint32_t status,std::unique_ptr<uint8_t[]> & eBuffer,uint32_t length,bool & isFbeSupport)77 int FBEX::ReadESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, std::unique_ptr<uint8_t[]> &eBuffer,
78 uint32_t length, bool &isFbeSupport)
79 {
80 return IFbexMoc::fbexMoc->ReadESecretToKernel(userIdToFbe, status, eBuffer, length, isFbeSupport);
81 }
82
WriteESecretToKernel(UserIdToFbeStr & userIdToFbe,uint32_t status,uint8_t * eBuffer,uint32_t length)83 int FBEX::WriteESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, uint8_t *eBuffer, uint32_t length)
84 {
85 return IFbexMoc::fbexMoc->WriteESecretToKernel(userIdToFbe, status, eBuffer, length);
86 }
87
IsMspReady()88 bool FBEX::IsMspReady()
89 {
90 return IFbexMoc::fbexMoc->IsMspReady();
91 }
92
GetStatus()93 int FBEX::GetStatus()
94 {
95 return IFbexMoc::fbexMoc->GetStatus();
96 }