1 /*
2 * Copyright (c) 2020-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 "hal_token.h"
17 #include "ohos_errno.h"
18 #include "ohos_types.h"
19
OEMReadToken(char * token,unsigned int len)20 __attribute__((weak)) static int OEMReadToken(char* token, unsigned int len)
21 {
22 // OEM need add here, read token from device
23 (void)(token);
24 (void)(len);
25 return EC_SUCCESS;
26 }
27
OEMWriteToken(const char * token,unsigned int len)28 __attribute__((weak)) static int OEMWriteToken(const char* token, unsigned int len)
29 {
30 // OEM need add here, write token to device
31 (void)(token);
32 (void)(len);
33 return EC_SUCCESS;
34 }
35
OEMGetAcKey(char * acKey,unsigned int len)36 __attribute__((weak)) static int OEMGetAcKey(char* acKey, unsigned int len)
37 {
38 // OEM need add here, get AcKey
39 (void)(acKey);
40 (void)(len);
41 return EC_SUCCESS;
42 }
43
OEMGetProdId(char * productId,unsigned int len)44 __attribute__((weak)) static int OEMGetProdId(char* productId, unsigned int len)
45 {
46 // OEM need add here, get ProdId
47 (void)(productId);
48 (void)(len);
49 return EC_SUCCESS;
50 }
51
OEMGetProdKey(char * productKey,unsigned int len)52 __attribute__((weak)) static int OEMGetProdKey(char* productKey, unsigned int len)
53 {
54 // OEM need add here, get ProdKey
55 (void)(productKey);
56 (void)(len);
57 return EC_SUCCESS;
58 }
59
HalReadToken(char * token,unsigned int len)60 __attribute__((weak)) int HalReadToken(char* token, unsigned int len)
61 {
62 if (token == NULL) {
63 return EC_FAILURE;
64 }
65
66 return OEMReadToken(token, len);
67 }
68
HalWriteToken(const char * token,unsigned int len)69 __attribute__((weak)) int HalWriteToken(const char* token, unsigned int len)
70 {
71 if (token == NULL) {
72 return EC_FAILURE;
73 }
74
75 return OEMWriteToken(token, len);
76 }
77
HalGetAcKey(char * acKey,unsigned int len)78 __attribute__((weak)) int HalGetAcKey(char* acKey, unsigned int len)
79 {
80 if (acKey == NULL) {
81 return EC_FAILURE;
82 }
83
84 return OEMGetAcKey(acKey, len);
85 }
86
HalGetProdId(char * productId,unsigned int len)87 __attribute__((weak)) int HalGetProdId(char* productId, unsigned int len)
88 {
89 if (productId == NULL) {
90 return EC_FAILURE;
91 }
92
93 return OEMGetProdId(productId, len);
94 }
95
HalGetProdKey(char * productKey,unsigned int len)96 __attribute__((weak)) int HalGetProdKey(char* productKey, unsigned int len)
97 {
98 if (productKey == NULL) {
99 return EC_FAILURE;
100 }
101
102 return OEMGetProdKey(productKey, len);
103 }