1 /*
2 * Copyright (c) 2020 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 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 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 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 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 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
60
HalReadToken(char * token,unsigned int len)61 int HalReadToken(char *token, unsigned int len)
62 {
63 if (token == NULL) {
64 return EC_FAILURE;
65 }
66
67 return OEMReadToken(token, len);
68 }
69
HalWriteToken(const char * token,unsigned int len)70 int HalWriteToken(const char *token, unsigned int len)
71 {
72 if (token == NULL) {
73 return EC_FAILURE;
74 }
75
76 return OEMWriteToken(token, len);
77 }
78
HalGetAcKey(char * acKey,unsigned int len)79 int HalGetAcKey(char *acKey, unsigned int len)
80 {
81 if (acKey == NULL) {
82 return EC_FAILURE;
83 }
84
85 return OEMGetAcKey(acKey, len);
86 }
87
HalGetProdId(char * productId,unsigned int len)88 int HalGetProdId(char *productId, unsigned int len)
89 {
90 if (productId == NULL) {
91 return EC_FAILURE;
92 }
93
94 return OEMGetProdId(productId, len);
95 }
96
HalGetProdKey(char * productKey,unsigned int len)97 int HalGetProdKey(char *productKey, unsigned int len)
98 {
99 if (productKey == NULL) {
100 return EC_FAILURE;
101 }
102
103 return OEMGetProdKey(productKey, len);
104 }