• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2023 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 "hc_dev_info.h"
17 #include "hal_error.h"
18 #include "hc_log.h"
19 #include "parameter.h"
20 #include "securec.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
HcGetUdid(uint8_t * udid,int32_t udidLen)26 int32_t HcGetUdid(uint8_t *udid, int32_t udidLen)
27 {
28     if (udid == NULL || udidLen < INPUT_UDID_LEN || udidLen > MAX_INPUT_UDID_LEN) {
29         return HAL_ERR_INVALID_PARAM;
30     }
31     int32_t res = GetDevUdid((char *)udid, udidLen);
32     if (res != 0) {
33         LOGE("[UDID]: GetDevUdid fail. [Res]: %d", res);
34         return HAL_FAILED;
35     }
36     return HAL_SUCCESS;
37 }
38 
GetStoragePath(void)39 const char *GetStoragePath(void)
40 {
41 #ifndef LITE_DEVICE
42     const char *storageFile = "/data/service/el1/public/deviceauth/hcgroup.dat";
43 #else
44     const char *storageFile = "/storage/deviceauth/hcgroup.dat";
45 #endif
46     return storageFile;
47 }
48 
GetStorageDirPath(void)49 const char *GetStorageDirPath(void)
50 {
51 #ifndef LITE_DEVICE
52     const char *storageFile = "/data/service/el1/public/deviceauth";
53 #else
54     const char *storageFile = "/storage/deviceauth";
55 #endif
56     return storageFile;
57 }
58 
GetAccountStoragePath(void)59 const char *GetAccountStoragePath(void)
60 {
61 #ifndef LITE_DEVICE
62     const char *storageFile = "/data/service/el1/public/deviceauth/account";
63 #else
64     const char *storageFile = "/storage/deviceauth/account";
65 #endif
66     return storageFile;
67 }
68 
GetPseudonymStoragePath(void)69 const char *GetPseudonymStoragePath(void)
70 {
71 #ifndef LITE_DEVICE
72     const char *storageFile = "/data/service/el1/public/deviceauth/pseudonym";
73 #else
74     const char *storageFile = "/storage/deviceauth/pseudonym";
75 #endif
76     return storageFile;
77 }
78 
79 #ifdef __cplusplus
80 }
81 #endif
82