• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 "attest_utils_log.h"
17 #include "attest_adapter_oem.h"
18 #include "attest_adapter_os.h"
19 #include "attest_adapter_mock.h"
20 #include "attest_adapter.h"
21 
22 // 是否存在重置标记
AttestIsResetFlagExist(void)23 bool AttestIsResetFlagExist(void)
24 {
25     return OEMIsFlagExist(OEM_FLAG_RESET);
26 }
27 
28 // 创建重置标记
AttestCreateResetFlag(void)29 int32_t AttestCreateResetFlag(void)
30 {
31     return OEMCreateFlag(OEM_FLAG_RESET);
32 }
33 
34 // 写入认证结果
AttestWriteAuthStatus(const char * data,uint32_t len)35 int32_t AttestWriteAuthStatus(const char* data, uint32_t len)
36 {
37     return OEMWriteAuthStatus(data, len);
38 }
39 
40 // 读取认证结果
AttestReadAuthStatus(char * buffer,uint32_t bufferLen)41 int32_t AttestReadAuthStatus(char* buffer, uint32_t bufferLen)
42 {
43     return OEMReadAuthStatus(buffer, bufferLen);
44 }
45 
46 // 读取认证结果长度
AttestGetAuthStatusFileSize(uint32_t * len)47 int32_t AttestGetAuthStatusFileSize(uint32_t* len)
48 {
49     return OEMGetAuthStatusFileSize(len);
50 }
51 
52 // 读取凭据
AttestReadTicket(TicketInfo * ticketInfo)53 int32_t AttestReadTicket(TicketInfo* ticketInfo)
54 {
55     return OEMReadTicket(ticketInfo);
56 }
57 
58 // 写入凭据
AttestWriteTicket(const TicketInfo * ticketInfo)59 int32_t AttestWriteTicket(const TicketInfo* ticketInfo)
60 {
61     return OEMWriteTicket(ticketInfo);
62 }
63 
AttestSetParameter(const char * key,const char * value)64 int32_t AttestSetParameter(const char *key, const char *value)
65 {
66     return OsSetParameter(key, value);
67 }
68 
AttestGetParameter(const char * key,const char * def,char * value,uint32_t len)69 int32_t AttestGetParameter(const char *key, const char *def, char *value, uint32_t len)
70 {
71     return OsGetParameter(key, def, value, len);
72 }
73 
AttestNetworkConfigExist(void)74 bool AttestNetworkConfigExist(void)
75 {
76     return OEMIsNetworkConfigExist();
77 }
78 
AttestWriteNetworkConfig(const char * buffer,uint32_t bufferLen)79 int32_t AttestWriteNetworkConfig(const char* buffer, uint32_t bufferLen)
80 {
81     return OEMWriteNetworkConfig(buffer, bufferLen);
82 }
83 
AttestReadNetworkConfig(char * buffer,uint32_t bufferLen)84 int32_t AttestReadNetworkConfig(char* buffer, uint32_t bufferLen)
85 {
86     return OEMReadNetworkConfig(buffer, bufferLen);
87 }
88 
AttestReadDefaultNetworkConfig(char * buffer,uint32_t bufferLen)89 int32_t AttestReadDefaultNetworkConfig(char* buffer, uint32_t bufferLen)
90 {
91     return OEMReadDefaultNetworkConfig(buffer, bufferLen);
92 }
93 
AttestWriteAuthResultCode(const char * data,uint32_t len)94 int32_t AttestWriteAuthResultCode(const char* data, uint32_t len)
95 {
96     return OEMWriteAuthResultCode(data, len);
97 }
98 
AttestReadAuthResultCode(char * buffer,uint32_t bufferLen)99 int32_t AttestReadAuthResultCode(char* buffer, uint32_t bufferLen)
100 {
101     return OEMReadAuthResultCode(buffer, bufferLen);
102 }
103