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