• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 
17 #include "identity_operation.h"
18 
19 #include "alg_defs.h"
20 #include "alg_loader.h"
21 #include "clib_error.h"
22 #include "device_auth.h"
23 #include "device_auth_defines.h"
24 #include "hal_error.h"
25 #include "hc_log.h"
26 #include "identity_service_defines.h"
27 
GetCredentialById(int32_t osAccountId,const char * credId,Credential ** returnEntry)28 int32_t GetCredentialById(int32_t osAccountId, const char *credId, Credential **returnEntry)
29 {
30     (void)osAccountId;
31     (void)credId;
32     (void)returnEntry;
33     return IS_ERR_NOT_SUPPORT;
34 }
35 
GenerateCredId(int32_t osAccountId,Credential * credential,Uint8Buff * credIdByte)36 int32_t GenerateCredId(int32_t osAccountId, Credential *credential, Uint8Buff *credIdByte)
37 {
38     (void)osAccountId;
39     (void)credential;
40     (void)credIdByte;
41     return IS_ERR_NOT_SUPPORT;
42 }
43 
AddKeyValueToHuks(int32_t osAccountId,Uint8Buff * credIdByte,Credential * credential,uint8_t method,Uint8Buff * keyValue)44 int32_t AddKeyValueToHuks(int32_t osAccountId, Uint8Buff *credIdByte, Credential *credential, uint8_t method,
45     Uint8Buff *keyValue)
46 {
47     (void)osAccountId;
48     (void)credential;
49     (void)credIdByte;
50     (void)method;
51     (void)keyValue;
52     return IS_ERR_NOT_SUPPORT;
53 }
54 
GetValidKeyAlias(int32_t osAccountId,const char * credId,Uint8Buff * credIdHashBuff)55 int32_t GetValidKeyAlias(int32_t osAccountId, const char *credId, Uint8Buff *credIdHashBuff)
56 {
57     (void)osAccountId;
58     (void)credId;
59     (void)credIdHashBuff;
60     return IS_ERR_NOT_SUPPORT;
61 }
62 
AddCredAndSaveDb(int32_t osAccountId,Credential * credential)63 int32_t AddCredAndSaveDb(int32_t osAccountId, Credential *credential)
64 {
65     (void)osAccountId;
66     (void)credential;
67     return IS_ERR_NOT_SUPPORT;
68 }
69 
CheckAndSetCredInfo(int32_t osAccountId,Credential * credential,CJson * json,uint8_t * method,Uint8Buff * keyValue)70 int32_t CheckAndSetCredInfo(int32_t osAccountId,
71     Credential *credential, CJson *json, uint8_t *method, Uint8Buff *keyValue)
72 {
73     (void)osAccountId;
74     (void)credential;
75     (void)json;
76     (void)method;
77     (void)keyValue;
78     return IS_ERR_NOT_SUPPORT;
79 }
80 
SetQueryParamsFromJson(QueryCredentialParams * queryParams,CJson * json)81 int32_t SetQueryParamsFromJson(QueryCredentialParams *queryParams, CJson *json)
82 {
83     (void)queryParams;
84     (void)json;
85     return IS_ERR_NOT_SUPPORT;
86 }
87 
GetCredIdsFromCredVec(int32_t osAccountId,CJson * reqJson,CredentialVec * credentialVec,CJson * credIdJson)88 int32_t GetCredIdsFromCredVec(int32_t osAccountId, CJson *reqJson, CredentialVec *credentialVec, CJson *credIdJson)
89 {
90     (void)osAccountId;
91     (void)reqJson;
92     (void)credentialVec;
93     (void)credIdJson;
94     return IS_ERR_NOT_SUPPORT;
95 }
96 
UpdateInfoFromJson(Credential * credential,CJson * json)97 int32_t UpdateInfoFromJson(Credential *credential, CJson *json)
98 {
99     (void)credential;
100     (void)json;
101     return IS_ERR_NOT_SUPPORT;
102 }
103 
DelCredById(int32_t osAccountId,const char * credId)104 int32_t DelCredById(int32_t osAccountId, const char *credId)
105 {
106     (void)osAccountId;
107     (void)credId;
108     return IS_ERR_NOT_SUPPORT;
109 }
110 
AddKeyValueToReturn(Uint8Buff keyValue,char ** returnData)111 int32_t AddKeyValueToReturn(Uint8Buff keyValue, char **returnData)
112 {
113     (void)keyValue;
114     (void)returnData;
115     return IS_ERR_NOT_SUPPORT;
116 }
117 
GenerateReturnEmptyArrayStr(char ** returnVec)118 int32_t GenerateReturnEmptyArrayStr(char **returnVec)
119 {
120     (void)returnVec;
121     return IS_ERR_NOT_SUPPORT;
122 }
123 
CheckOwnerUidPermission(Credential * credential)124 int32_t CheckOwnerUidPermission(Credential *credential)
125 {
126     (void)credential;
127     return IS_ERR_NOT_SUPPORT;
128 }
129 
GenerateCredKeyAlias(const char * credId,const char * deviceId,Uint8Buff * alias)130 int32_t GenerateCredKeyAlias(const char *credId, const char *deviceId, Uint8Buff *alias)
131 {
132     (void)credId;
133     (void)deviceId;
134     (void)alias;
135     return IS_ERR_NOT_SUPPORT;
136 }
137 
SetAgreeCredInfo(int32_t osAccountId,CJson * reqJson,Credential * agreeCredential,Uint8Buff * keyValue,Uint8Buff * agreeCredIdByte)138 int32_t SetAgreeCredInfo(int32_t osAccountId, CJson *reqJson,
139     Credential *agreeCredential, Uint8Buff *keyValue, Uint8Buff *agreeCredIdByte)
140 {
141     (void)osAccountId;
142     (void)reqJson;
143     (void)agreeCredential;
144     (void)keyValue;
145     (void)agreeCredIdByte;
146     return IS_ERR_NOT_SUPPORT;
147 }
148 
ImportAgreeKeyValue(int32_t osAccountId,Credential * agreeCredential,Uint8Buff * keyValue,Uint8Buff * peerKeyAlias)149 int32_t ImportAgreeKeyValue(int32_t osAccountId, Credential *agreeCredential, Uint8Buff *keyValue,
150     Uint8Buff *peerKeyAlias)
151 {
152     (void)osAccountId;
153     (void)agreeCredential;
154     (void)keyValue;
155     (void)peerKeyAlias;
156     return IS_ERR_NOT_SUPPORT;
157 }
158 
CheckAndDelInvalidCred(int32_t osAccountId,const char * selfCredId,Uint8Buff * selfCredIdByte)159 int32_t CheckAndDelInvalidCred(int32_t osAccountId, const char *selfCredId, Uint8Buff *selfCredIdByte)
160 {
161     (void)osAccountId;
162     (void)selfCredId;
163     (void)selfCredIdByte;
164     return IS_ERR_NOT_SUPPORT;
165 }
166 
ComputePskAndDelInvalidKey(int32_t osAccountId,uint8_t credAlgo,Uint8Buff * selfCredIdByte,Uint8Buff * peerKeyAlias,Uint8Buff * agreeCredIdByte)167 int32_t ComputePskAndDelInvalidKey(int32_t osAccountId, uint8_t credAlgo, Uint8Buff *selfCredIdByte,
168     Uint8Buff *peerKeyAlias, Uint8Buff *agreeCredIdByte)
169 {
170     (void)osAccountId;
171     (void)credAlgo;
172     (void)selfCredIdByte;
173     (void)peerKeyAlias;
174     (void)agreeCredIdByte;
175     return IS_ERR_NOT_SUPPORT;
176 }
177 
SetRequiredParamsFromJson(QueryCredentialParams * queryParams,CJson * baseInfoJson)178 int32_t SetRequiredParamsFromJson(QueryCredentialParams *queryParams, CJson *baseInfoJson)
179 {
180     (void)queryParams;
181     (void)baseInfoJson;
182     return IS_ERR_NOT_SUPPORT;
183 }
184 
SetUpdateToQueryParams(CJson * json,QueryCredentialParams * queryParams)185 int32_t SetUpdateToQueryParams(CJson *json, QueryCredentialParams *queryParams)
186 {
187     (void)json;
188     (void)queryParams;
189     return IS_ERR_NOT_SUPPORT;
190 }
191 
AddUpdateInfoToJson(QueryCredentialParams * queryParams,CJson * baseInfoJson)192 int32_t AddUpdateInfoToJson(QueryCredentialParams *queryParams, CJson *baseInfoJson)
193 {
194     (void)queryParams;
195     (void)baseInfoJson;
196     return IS_ERR_NOT_SUPPORT;
197 }
198 
EraseUpdateCredIdInSelfVec(CredentialVec * updateCredVec,CredentialVec * selfCredVec)199 int32_t EraseUpdateCredIdInSelfVec(CredentialVec *updateCredVec, CredentialVec *selfCredVec)
200 {
201     (void)updateCredVec;
202     (void)selfCredVec;
203     return IS_ERR_NOT_SUPPORT;
204 }
205 
GetQueryJsonStr(CJson * baseInfoJson,char ** queryJsonStr)206 int32_t GetQueryJsonStr(CJson *baseInfoJson, char **queryJsonStr)
207 {
208     (void)baseInfoJson;
209     (void)queryJsonStr;
210     return IS_ERR_NOT_SUPPORT;
211 }
212 
GetUpdateCredVec(int32_t osAccountId,CJson * updateInfo,QueryCredentialParams * queryParams,CredentialVec * updateCredVec)213 int32_t GetUpdateCredVec(int32_t osAccountId, CJson *updateInfo,
214     QueryCredentialParams *queryParams, CredentialVec *updateCredVec)
215 {
216     (void)osAccountId;
217     (void)updateInfo;
218     (void)queryParams;
219     (void)updateCredVec;
220     return IS_ERR_NOT_SUPPORT;
221 }
222 
IsCredHashMatch(Credential * credential,CJson * reqJson)223 bool IsCredHashMatch(Credential *credential, CJson *reqJson)
224 {
225     (void)credential;
226     (void)reqJson;
227     return false;
228 }
229