• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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,uint8_t * iv,uint32_t size,uint8_t flag)33 int FBEX::InstallKeyToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size, uint8_t flag)
34 {
35     return IFbexMoc::fbexMoc->InstallKeyToKernel(userId, type, iv, size, flag);
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,uint8_t * iv,uint32_t size,uint8_t flag)43 int FBEX::InstallDoubleDeKeyToKernel(UserIdToFbeStr &userIdToFbe, uint8_t *iv, uint32_t size, uint8_t flag)
44 {
45     return IFbexMoc::fbexMoc->InstallDoubleDeKeyToKernel(userIdToFbe, iv, size, flag);
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 
58 // for el3 & el4
LockScreenToKernel(uint32_t userId)59 int FBEX::LockScreenToKernel(uint32_t userId)
60 {
61     return IFbexMoc::fbexMoc->LockScreenToKernel(userId);
62 }
63 
GenerateAppkey(UserIdToFbeStr & userIdToFbe,uint32_t appUid,std::unique_ptr<uint8_t[]> & appKey,uint32_t size)64 int FBEX::GenerateAppkey(UserIdToFbeStr &userIdToFbe, uint32_t appUid, std::unique_ptr<uint8_t[]> &appKey,
65                          uint32_t size)
66 {
67     return IFbexMoc::fbexMoc->GenerateAppkey(userIdToFbe, appUid, appKey, size);
68 }
69 
70 // for el5
LockUece(uint32_t userIdSingle,uint32_t userIdDouble,bool & isFbeSupport)71 int FBEX::LockUece(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)
72 {
73     return IFbexMoc::fbexMoc->LockUece(userIdSingle, userIdDouble, isFbeSupport);
74 }
75 
UnlockScreenToKernel(uint32_t userId,uint32_t type,uint8_t * iv,uint32_t size)76 int FBEX::UnlockScreenToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size)
77 {
78     return IFbexMoc::fbexMoc->UnlockScreenToKernel(userId, type, iv, size);
79 }
80 
ReadESecretToKernel(UserIdToFbeStr & userIdToFbe,uint32_t status,std::unique_ptr<uint8_t[]> & eBuffer,uint32_t length,bool & isFbeSupport)81 int FBEX::ReadESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, std::unique_ptr<uint8_t[]> &eBuffer,
82                               uint32_t length, bool &isFbeSupport)
83 {
84     return IFbexMoc::fbexMoc->ReadESecretToKernel(userIdToFbe, status, eBuffer, length, isFbeSupport);
85 }
86 
WriteESecretToKernel(UserIdToFbeStr & userIdToFbe,uint32_t status,uint8_t * eBuffer,uint32_t length)87 int FBEX::WriteESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, uint8_t *eBuffer, uint32_t length)
88 {
89     return IFbexMoc::fbexMoc->WriteESecretToKernel(userIdToFbe, status, eBuffer, length);
90 }
91 
IsMspReady()92 bool FBEX::IsMspReady()
93 {
94     return IFbexMoc::fbexMoc->IsMspReady();
95 }
96 
GetStatus()97 int FBEX::GetStatus()
98 {
99     return IFbexMoc::fbexMoc->GetStatus();
100 }