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
DeleteClassEPinCode(uint32_t userIdSingle, uint32_t userIdDouble)43 int FBEX::DeleteClassEPinCode(uint32_t userIdSingle, uint32_t userIdDouble)
44 {
45 return IFbexMoc::fbexMoc->DeleteClassEPinCode(userIdSingle, userIdDouble);
46 }
47
ChangePinCodeClassE(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)48 int FBEX::ChangePinCodeClassE(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)
49 {
50 return IFbexMoc::fbexMoc->ChangePinCodeClassE(userIdSingle, userIdDouble, isFbeSupport);
51 }
52
53 // for el3 & el4
LockScreenToKernel(uint32_t userId)54 int FBEX::LockScreenToKernel(uint32_t userId)
55 {
56 return IFbexMoc::fbexMoc->LockScreenToKernel(userId);
57 }
58
GenerateAppkey(UserIdToFbeStr &userIdToFbe, uint32_t appUid, std::unique_ptr<uint8_t[]> &appKey, uint32_t size)59 int FBEX::GenerateAppkey(UserIdToFbeStr &userIdToFbe, uint32_t appUid, std::unique_ptr<uint8_t[]> &appKey,
60 uint32_t size)
61 {
62 return IFbexMoc::fbexMoc->GenerateAppkey(userIdToFbe, appUid, appKey, size);
63 }
64
65 // for el5
LockUece(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)66 int FBEX::LockUece(uint32_t userIdSingle, uint32_t userIdDouble, bool &isFbeSupport)
67 {
68 return IFbexMoc::fbexMoc->LockUece(userIdSingle, userIdDouble, isFbeSupport);
69 }
70
UnlockScreenToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size)71 int FBEX::UnlockScreenToKernel(uint32_t userId, uint32_t type, uint8_t *iv, uint32_t size)
72 {
73 return IFbexMoc::fbexMoc->UnlockScreenToKernel(userId, type, iv, size);
74 }
75
ReadESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, std::unique_ptr<uint8_t[]> &eBuffer, uint32_t length, bool &isFbeSupport)76 int FBEX::ReadESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, std::unique_ptr<uint8_t[]> &eBuffer,
77 uint32_t length, bool &isFbeSupport)
78 {
79 return IFbexMoc::fbexMoc->ReadESecretToKernel(userIdToFbe, status, eBuffer, length, isFbeSupport);
80 }
81
WriteESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, uint8_t *eBuffer, uint32_t length)82 int FBEX::WriteESecretToKernel(UserIdToFbeStr &userIdToFbe, uint32_t status, uint8_t *eBuffer, uint32_t length)
83 {
84 return IFbexMoc::fbexMoc->WriteESecretToKernel(userIdToFbe, status, eBuffer, length);
85 }
86
IsMspReady()87 bool FBEX::IsMspReady()
88 {
89 return IFbexMoc::fbexMoc->IsMspReady();
90 }
91
GetStatus()92 int FBEX::GetStatus()
93 {
94 return IFbexMoc::fbexMoc->GetStatus();
95 }