• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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("[OS]: 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     LOGI("[OS]: storageFile: %s", storageFile);
47     return storageFile;
48 }
49 
GetStorageDirPath(void)50 const char *GetStorageDirPath(void)
51 {
52 #ifndef LITE_DEVICE
53     const char *storageFile = "/data/service/el1/public/deviceauth";
54 #else
55     const char *storageFile = "/storage/deviceauth";
56 #endif
57     LOGI("[OS]: storageDirFile: %s", storageFile);
58     return storageFile;
59 }
60 
GetAccountStoragePath(void)61 const char *GetAccountStoragePath(void)
62 {
63 #ifndef LITE_DEVICE
64     const char *storageFile = "/data/service/el1/public/deviceauth/account";
65 #else
66     const char *storageFile = "/storage/deviceauth/account";
67 #endif
68     LOGI("[OS]: Account storage dir: %s", storageFile);
69     return storageFile;
70 }
71 
72 #ifdef __cplusplus
73 }
74 #endif
75