mirror of
https://github.com/openharmony/security_deviceauth.git
synced 2026-07-18 22:54:27 -04:00
!99 adapt hals to commonlib and deps_adapter
Merge pull request !99 from 胡玉/master
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#define COMMON_UTIL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "hc_error.h"
|
||||
|
||||
#define BYTE_TO_HEX_OPER_LENGTH 2
|
||||
#define DEC 10
|
||||
@@ -24,7 +24,6 @@ if (defined(ohos_lite)) {
|
||||
include_dirs = hals_inc_path
|
||||
include_dirs += [
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/security/deviceauth/services/common/inc",
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
|
||||
@@ -34,15 +33,15 @@ if (defined(ohos_lite)) {
|
||||
|
||||
sources = hal_common_files
|
||||
sources += [
|
||||
"src/dev_info/3861/hc_dev_info.c",
|
||||
"src/liteos/L0/hc_file.c",
|
||||
"src/liteos/L0/hc_init_protection.c",
|
||||
"src/liteos/L0/huks_adapter.c",
|
||||
"src/liteos/hc_condition.c",
|
||||
"src/liteos/hc_mutex.c",
|
||||
"src/liteos/hc_thread.c",
|
||||
"src/liteos/hc_time.c",
|
||||
"src/liteos/hc_types.c",
|
||||
"${key_management_adapter_path}/impl/src/mini/huks_adapter.c",
|
||||
"${os_adapter_path}/impl/src/dev_info/3861/hc_dev_info.c",
|
||||
"${os_adapter_path}/impl/src/liteos/hc_condition.c",
|
||||
"${os_adapter_path}/impl/src/liteos/hc_mutex.c",
|
||||
"${os_adapter_path}/impl/src/liteos/hc_thread.c",
|
||||
"${os_adapter_path}/impl/src/liteos/hc_time.c",
|
||||
"${os_adapter_path}/impl/src/liteos/hc_types.c",
|
||||
"${os_adapter_path}/impl/src/liteos/mini/hc_file.c",
|
||||
"${os_adapter_path}/impl/src/liteos/mini/hc_init_protection.c",
|
||||
]
|
||||
|
||||
cflags = [ "-DHILOG_ENABLE" ]
|
||||
@@ -59,7 +58,6 @@ if (defined(ohos_lite)) {
|
||||
include_dirs = hals_inc_path
|
||||
include_dirs += [
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/security/deviceauth/services/common/inc",
|
||||
"//third_party/cJSON",
|
||||
"//utils/native/lite/include",
|
||||
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
|
||||
@@ -70,16 +68,16 @@ if (defined(ohos_lite)) {
|
||||
|
||||
sources = hal_common_files
|
||||
sources += [
|
||||
"src/dev_info/3516/hc_dev_info.c",
|
||||
"src/linux/hc_condition.c",
|
||||
"src/linux/hc_file.c",
|
||||
"src/linux/hc_init_protection.c",
|
||||
"src/linux/hc_mutex.c",
|
||||
"src/linux/hc_thread.c",
|
||||
"src/linux/hc_time.c",
|
||||
"src/linux/hc_types.c",
|
||||
"src/linux/lite/huks_adapter.c",
|
||||
"src/linux/lite/mbedtls_hash_to_point.c",
|
||||
"${key_management_adapter_path}/impl/src/small/huks_adapter.c",
|
||||
"${key_management_adapter_path}/impl/src/small/mbedtls_hash_to_point.c",
|
||||
"${os_adapter_path}/impl/src/dev_info/3516/hc_dev_info.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_condition.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_file.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_init_protection.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_mutex.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_thread.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_time.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_types.c",
|
||||
]
|
||||
|
||||
cflags = [ "-DHILOG_ENABLE" ]
|
||||
@@ -100,7 +98,6 @@ if (defined(ohos_lite)) {
|
||||
} else {
|
||||
ohos_static_library("deviceauth_hal_linux") {
|
||||
subsystem_name = "security"
|
||||
|
||||
include_dirs = hals_inc_path
|
||||
include_dirs += [
|
||||
"//third_party/cJSON",
|
||||
@@ -112,16 +109,16 @@ if (defined(ohos_lite)) {
|
||||
|
||||
sources = hal_common_files
|
||||
sources += [
|
||||
"src/dev_info/3516/hc_dev_info.c",
|
||||
"src/linux/hc_condition.c",
|
||||
"src/linux/hc_file.c",
|
||||
"src/linux/hc_init_protection.c",
|
||||
"src/linux/hc_mutex.c",
|
||||
"src/linux/hc_thread.c",
|
||||
"src/linux/hc_time.c",
|
||||
"src/linux/hc_types.c",
|
||||
"src/linux/standard/crypto_hash_to_point.c",
|
||||
"src/linux/standard/huks_adapter.c",
|
||||
"${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
|
||||
"${key_management_adapter_path}/impl/src/standard/huks_adapter.c",
|
||||
"${os_adapter_path}/impl/src/dev_info/3516/hc_dev_info.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_condition.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_file.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_init_protection.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_mutex.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_thread.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_time.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_types.c",
|
||||
]
|
||||
cflags = [ "-DHILOG_ENABLE" ]
|
||||
deps = [
|
||||
@@ -0,0 +1,49 @@
|
||||
# Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//base/security/deviceauth/deviceauth_env.gni")
|
||||
|
||||
if (target_os == "liteos" ||
|
||||
(defined(ohos_lite) && ohos_kernel_type == "liteos_m")) {
|
||||
hals_inc_path = [
|
||||
"${common_lib_path}/interfaces",
|
||||
"${key_management_adapter_path}/interfaces",
|
||||
"${key_management_adapter_path}/impl/inc",
|
||||
"${os_adapter_path}/interfaces",
|
||||
"${os_adapter_path}/interfaces/liteos",
|
||||
"${os_adapter_path}/interfaces/dev_info/3861",
|
||||
]
|
||||
hal_module_name = "deviceauth_hal_liteos"
|
||||
} else {
|
||||
hals_inc_path = [
|
||||
"${common_lib_path}/interfaces",
|
||||
"${key_management_adapter_path}/interfaces",
|
||||
"${key_management_adapter_path}/impl/inc",
|
||||
"${os_adapter_path}/interfaces",
|
||||
"${os_adapter_path}/interfaces/linux",
|
||||
"${os_adapter_path}/interfaces/dev_info/3516",
|
||||
]
|
||||
hal_module_name = "deviceauth_hal_linux"
|
||||
}
|
||||
|
||||
hal_common_files = [
|
||||
"${common_lib_path}/impl/src/hc_parcel.c",
|
||||
"${common_lib_path}/impl/src/hc_string.c",
|
||||
"${common_lib_path}/impl/src/hc_tlv_parser.c",
|
||||
"${common_lib_path}/impl/src/json_utils.c",
|
||||
"${common_lib_path}/impl/src/common_util.c",
|
||||
"${key_management_adapter_path}/impl/src/alg_loader.c",
|
||||
|
||||
"${os_adapter_path}/impl/src/hc_task_thread.c",
|
||||
"${os_adapter_path}/impl/src/hc_log.c",
|
||||
]
|
||||
+1
-2
@@ -17,8 +17,7 @@
|
||||
#define MBEDTLS_HASH_TO_POINT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "common_defs.h"
|
||||
#include "common_util.h"
|
||||
|
||||
#define HASH2POINT_PARA_PREPRO 0xc0
|
||||
#define BYTE_LENGTH_CURVE_25519 32
|
||||
+17
-13
@@ -13,15 +13,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mbedtls_hash_to_point.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mbedtls/bignum.h>
|
||||
#include <securec.h>
|
||||
|
||||
#include "alg_defs.h"
|
||||
#include "hc_error.h"
|
||||
#include "hc_log.h"
|
||||
#include "mbedtls_hash_to_point.h"
|
||||
|
||||
#define LEN_HALF_DIVISOR 2
|
||||
#define PARAM_A_INDEX 2
|
||||
#define PARAM_U_INDEX 4
|
||||
#define PARAM_MINUS_A_INDEX 3
|
||||
#define PARAM_ONE_INDEX 5
|
||||
#define HASH_TO_POINT_PARA_NUMS 6
|
||||
|
||||
#define LOG_AND_GOTO_CLEANUP_IF_FAIL(ret, fmt, ...) \
|
||||
@@ -30,7 +34,7 @@ do { \
|
||||
LOGE(fmt, ##__VA_ARGS__); \
|
||||
goto CLEAN_UP; \
|
||||
} \
|
||||
} while(0)
|
||||
} while (0)
|
||||
|
||||
static uint8_t g_hash2pointParas[HASH_TO_POINT_PARA_NUMS][BYTE_LENGTH_CURVE_25519] = {
|
||||
{ 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0:p */
|
||||
@@ -74,7 +78,7 @@ static void SwapEndian(uint8_t *pubKey, int len)
|
||||
if ((pubKey == NULL) || (len <= 0)) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < len / 2; ++i) {
|
||||
for (int i = 0; i < len / LEN_HALF_DIVISOR; ++i) {
|
||||
uint8_t tmp = pubKey[i];
|
||||
pubKey[i] = pubKey[len - i - 1];
|
||||
pubKey[len - i - 1] = tmp;
|
||||
@@ -103,10 +107,10 @@ static int32_t CalTmpParaX(mbedtls_mpi *tmpY, const mbedtls_mpi *tmpX, const mbe
|
||||
mbedtls_mpi_init(¶BnA);
|
||||
mbedtls_mpi_init(¶BnU);
|
||||
|
||||
status = mbedtls_mpi_read_binary(¶BnA, g_hash2pointParas[2], BYTE_LENGTH_CURVE_25519);
|
||||
status = mbedtls_mpi_read_binary(¶BnA, g_hash2pointParas[PARAM_A_INDEX], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "CalTmpParaX error1");
|
||||
|
||||
status = mbedtls_mpi_read_binary(¶BnU, g_hash2pointParas[4], BYTE_LENGTH_CURVE_25519);
|
||||
status = mbedtls_mpi_read_binary(¶BnU, g_hash2pointParas[PARAM_U_INDEX], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "CalTmpParaX error2");
|
||||
|
||||
status = mbedtls_mpi_copy(&tmpBnB, tmpX);
|
||||
@@ -157,11 +161,11 @@ static int32_t CalTmpParab(mbedtls_mpi *tmpX, const mbedtls_mpi *modP, const uin
|
||||
mbedtls_mpi_init(&tmpBnA);
|
||||
mbedtls_mpi_init(&tmpBnB);
|
||||
|
||||
status = mbedtls_mpi_read_binary(¶BnNegA, g_hash2pointParas[3], BYTE_LENGTH_CURVE_25519);
|
||||
status = mbedtls_mpi_read_binary(¶BnNegA, g_hash2pointParas[PARAM_MINUS_A_INDEX], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "CalTmpParab error1");
|
||||
status = mbedtls_mpi_read_binary(¶BNOne, g_hash2pointParas[5], BYTE_LENGTH_CURVE_25519);
|
||||
status = mbedtls_mpi_read_binary(¶BNOne, g_hash2pointParas[PARAM_ONE_INDEX], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "CalTmpParab error2");
|
||||
status = mbedtls_mpi_read_binary(¶BnU, g_hash2pointParas[4], BYTE_LENGTH_CURVE_25519);
|
||||
status = mbedtls_mpi_read_binary(¶BnU, g_hash2pointParas[PARAM_U_INDEX], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "CalTmpParab error3");
|
||||
status = mbedtls_mpi_read_binary(&tmpBnA, hash, hashLen);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "CalTmpParab error4");
|
||||
@@ -219,7 +223,7 @@ static int32_t Elligator(unsigned char *point, int pointLength, const unsigned c
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "Elligator error1");
|
||||
status = mbedtls_mpi_read_binary(¶BnSquare, g_hash2pointParas[1], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "Elligator error2");
|
||||
status = mbedtls_mpi_read_binary(¶BnNegA, g_hash2pointParas[3], BYTE_LENGTH_CURVE_25519);
|
||||
status = mbedtls_mpi_read_binary(¶BnNegA, g_hash2pointParas[PARAM_MINUS_A_INDEX], BYTE_LENGTH_CURVE_25519);
|
||||
LOG_AND_GOTO_CLEANUP_IF_FAIL(status, "Elligator error3");
|
||||
|
||||
status = CalTmpParab(&tmpBnB, ¶BnP, hash, hashLength);
|
||||
@@ -258,11 +262,11 @@ CLEAN_UP:
|
||||
int32_t MbedtlsHashToPoint(const Uint8Buff *hash, Uint8Buff *outEcPoint)
|
||||
{
|
||||
if (IsInvalidBlob(hash) || IsInvalidBlob(outEcPoint)) {
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
return HAL_ERR_INVALID_PARAM;
|
||||
}
|
||||
if (hash->length != BYTE_LENGTH_CURVE_25519 || outEcPoint->length != BYTE_LENGTH_CURVE_25519) {
|
||||
LOGE("MbedtlsHashToPoint invalid length.");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
return HAL_ERR_INVALID_PARAM;
|
||||
}
|
||||
uint8_t hashTmp[BYTE_LENGTH_CURVE_25519] = {0};
|
||||
(void)memcpy_s(hashTmp, BYTE_LENGTH_CURVE_25519, hash->val, BYTE_LENGTH_CURVE_25519);
|
||||
+2
-2
@@ -23,8 +23,8 @@
|
||||
#define HMAC_LEN 32
|
||||
#define SIGNATURE_LEN 64
|
||||
#define AE_TAG_LEN 16
|
||||
#define BIG_PRIME_LEN_384 384
|
||||
#define BIG_PRIME_LEN_256 256
|
||||
#define BIG_PRIME_LEN_384 384
|
||||
#define BIG_PRIME_LEN_256 256
|
||||
|
||||
typedef enum {
|
||||
PAIR_TYPE_BIND = 0,
|
||||
+1
-1
@@ -36,7 +36,7 @@ int32_t HcGetUdid(uint8_t *udid, int32_t udidLen)
|
||||
return HAL_SUCCESS;
|
||||
}
|
||||
|
||||
const char *GetStoragePath()
|
||||
const char *GetStoragePath(void)
|
||||
{
|
||||
#ifndef LITE_DEVICE
|
||||
const char *storageFile = "/data/data/deviceauth/hcgroup.dat";
|
||||
+1
-1
@@ -36,7 +36,7 @@ int32_t HcGetUdid(uint8_t *udid, int32_t udidLen)
|
||||
return HAL_SUCCESS;
|
||||
}
|
||||
|
||||
const char *GetStoragePath()
|
||||
const char *GetStoragePath(void)
|
||||
{
|
||||
return "hcgroup.dat";
|
||||
}
|
||||
+1
-1
@@ -46,7 +46,7 @@ int32_t HcGetUdid(uint8_t *udid, int32_t udidLen)
|
||||
return result;
|
||||
}
|
||||
|
||||
const char *GetStoragePath()
|
||||
const char *GetStoragePath(void)
|
||||
{
|
||||
return "user/Hichain/hcgroup.dat";
|
||||
}
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "hc_log.h"
|
||||
|
||||
#include <securec.h>
|
||||
|
||||
#define LOG_PRINT_MAX_LEN 256
|
||||
+1
-2
@@ -132,8 +132,7 @@ int32_t InitHcCond(HcCondition* hcCond, HcMutex* mutex)
|
||||
} else {
|
||||
hcCond->mutex = (HcMutex*)HcMalloc(sizeof(HcMutex), 0);
|
||||
if (hcCond->mutex != NULL) {
|
||||
int32_t res;
|
||||
res = InitHcMutex(hcCond->mutex);
|
||||
int32_t res = InitHcMutex(hcCond->mutex);
|
||||
if (res != 0) {
|
||||
HcFree(hcCond->mutex);
|
||||
hcCond->mutex = NULL;
|
||||
@@ -14,11 +14,11 @@
|
||||
*/
|
||||
|
||||
#include "hc_file.h"
|
||||
#include "securec.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "securec.h"
|
||||
#include "hc_log.h"
|
||||
#include "hc_types.h"
|
||||
|
||||
+4
-4
@@ -18,7 +18,7 @@
|
||||
|
||||
static bool g_isInitialized = false;
|
||||
|
||||
int CheckInit()
|
||||
int CheckInit(void)
|
||||
{
|
||||
if (g_isInitialized) {
|
||||
return FINISH_INIT;
|
||||
@@ -26,7 +26,7 @@ int CheckInit()
|
||||
return CONTINUE_INIT;
|
||||
}
|
||||
|
||||
int CheckDestroy()
|
||||
int CheckDestroy(void)
|
||||
{
|
||||
if (!g_isInitialized) {
|
||||
return FINISH_DESTROY;
|
||||
@@ -34,12 +34,12 @@ int CheckDestroy()
|
||||
return CONTINUE_DESTROY;
|
||||
}
|
||||
|
||||
void SetInitStatus()
|
||||
void SetInitStatus(void)
|
||||
{
|
||||
g_isInitialized = true;
|
||||
}
|
||||
|
||||
void SetDeInitStatus()
|
||||
void SetDeInitStatus(void)
|
||||
{
|
||||
g_isInitialized = false;
|
||||
}
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <securec.h>
|
||||
#include <stdio.h>
|
||||
#include "common_defs.h"
|
||||
#include "hc_error.h"
|
||||
#include "hc_log.h"
|
||||
#include "utils_file.h"
|
||||
+6
-6
@@ -23,7 +23,7 @@
|
||||
static HcMutex g_countMutex;
|
||||
static int g_singleCount = 0;
|
||||
|
||||
int CheckInit()
|
||||
int CheckInit(void)
|
||||
{
|
||||
g_countMutex.lock(&g_countMutex);
|
||||
if (g_singleCount < 0) {
|
||||
@@ -37,7 +37,7 @@ int CheckInit()
|
||||
return CONTINUE_INIT;
|
||||
}
|
||||
|
||||
int CheckDestroy()
|
||||
int CheckDestroy(void)
|
||||
{
|
||||
g_countMutex.lock(&g_countMutex);
|
||||
if (g_singleCount == 0) {
|
||||
@@ -58,7 +58,7 @@ int CheckDestroy()
|
||||
return CONTINUE_DESTROY;
|
||||
}
|
||||
|
||||
void SetInitStatus()
|
||||
void SetInitStatus(void)
|
||||
{
|
||||
g_countMutex.lock(&g_countMutex);
|
||||
g_singleCount = 1;
|
||||
@@ -66,7 +66,7 @@ void SetInitStatus()
|
||||
return;
|
||||
}
|
||||
|
||||
void SetDeInitStatus()
|
||||
void SetDeInitStatus(void)
|
||||
{
|
||||
g_countMutex.lock(&g_countMutex);
|
||||
g_singleCount = 0;
|
||||
@@ -74,7 +74,7 @@ void SetDeInitStatus()
|
||||
return;
|
||||
}
|
||||
|
||||
void InitSecurityDevAuth()
|
||||
void InitSecurityDevAuth(void)
|
||||
{
|
||||
int32_t res = InitHcMutex(&g_countMutex);
|
||||
if (res != 0) {
|
||||
@@ -83,7 +83,7 @@ void InitSecurityDevAuth()
|
||||
}
|
||||
SYS_SERVICE_INIT(InitSecurityDevAuth);
|
||||
|
||||
void DestroySecurityDevAuth()
|
||||
void DestroySecurityDevAuth(void)
|
||||
{
|
||||
DestroyHcMutex(&g_countMutex);
|
||||
}
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
|
||||
static bool g_isInitialized = false;
|
||||
|
||||
int CheckInit()
|
||||
int CheckInit(void)
|
||||
{
|
||||
if (g_isInitialized) {
|
||||
return FINISH_INIT;
|
||||
@@ -27,7 +27,7 @@ int CheckInit()
|
||||
return CONTINUE_INIT;
|
||||
}
|
||||
|
||||
int CheckDestroy()
|
||||
int CheckDestroy(void)
|
||||
{
|
||||
if (!g_isInitialized) {
|
||||
return FINISH_DESTROY;
|
||||
@@ -35,12 +35,12 @@ int CheckDestroy()
|
||||
return CONTINUE_DESTROY;
|
||||
}
|
||||
|
||||
void SetInitStatus()
|
||||
void SetInitStatus(void)
|
||||
{
|
||||
g_isInitialized = true;
|
||||
}
|
||||
|
||||
void SetDeInitStatus()
|
||||
void SetDeInitStatus(void)
|
||||
{
|
||||
g_isInitialized = false;
|
||||
}
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
#ifndef HC_CONDITION_H
|
||||
#define HC_CONDITION_H
|
||||
|
||||
#include "pthread.h"
|
||||
#include "hc_mutex.h"
|
||||
#include "hc_types.h"
|
||||
#include "pthread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
+1
-3
@@ -16,8 +16,6 @@
|
||||
#ifndef HC_INIT_PROTECTION_H
|
||||
#define HC_INIT_PROTECTION_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef enum InitStatusEnum {
|
||||
CONTINUE_INIT = 0,
|
||||
FINISH_INIT,
|
||||
@@ -30,4 +28,4 @@ int CheckDestroy(void);
|
||||
void SetInitStatus(void);
|
||||
void SetDeInitStatus(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -16,8 +16,8 @@
|
||||
#ifndef HC_MUTEX_H
|
||||
#define HC_MUTEX_H
|
||||
|
||||
#include "pthread.h"
|
||||
#include <stdint.h>
|
||||
#include "pthread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
#ifndef HC_CONDITION_H
|
||||
#define HC_CONDITION_H
|
||||
|
||||
#include <semaphore.h>
|
||||
#include "hc_mutex.h"
|
||||
#include "hc_types.h"
|
||||
#include <semaphore.h>
|
||||
|
||||
typedef struct HcConditionT {
|
||||
int (*wait)(struct HcConditionT*);
|
||||
+1
-3
@@ -16,8 +16,6 @@
|
||||
#ifndef HC_INIT_PROTECTION_H
|
||||
#define HC_INIT_PROTECTION_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef enum InitStatusEnum {
|
||||
CONTINUE_INIT = 0,
|
||||
FINISH_INIT,
|
||||
@@ -30,4 +28,4 @@ int CheckDestroy(void);
|
||||
void SetInitStatus(void);
|
||||
void SetDeInitStatus(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -16,8 +16,8 @@
|
||||
#ifndef HC_MUTEX_H
|
||||
#define HC_MUTEX_H
|
||||
|
||||
#include "pthread.h"
|
||||
#include <stdint.h>
|
||||
#include "pthread.h"
|
||||
|
||||
typedef struct HcMutexT {
|
||||
int (*lock)(struct HcMutexT* mutex);
|
||||
@@ -12,7 +12,14 @@
|
||||
# limitations under the License.
|
||||
|
||||
deviceauth_path = "//base/security/deviceauth"
|
||||
common_lib_path = "${deviceauth_path}/common_lib"
|
||||
deps_adapter_path = "${deviceauth_path}/deps_adapter"
|
||||
key_management_adapter_path =
|
||||
"${deviceauth_path}/deps_adapter/key_management_adapter"
|
||||
os_adapter_path = "${deviceauth_path}/deps_adapter/os_adapter"
|
||||
|
||||
hals_path = "${deviceauth_path}/hals"
|
||||
|
||||
innerkits_path = "${deviceauth_path}/interfaces/innerkits"
|
||||
frameworks_path = "${deviceauth_path}/frameworks"
|
||||
services_path = "${deviceauth_path}/services"
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//base/security/deviceauth/deviceauth_env.gni")
|
||||
|
||||
if (target_os == "liteos" ||
|
||||
(defined(ohos_lite) && ohos_kernel_type == "liteos_m")) {
|
||||
hals_inc_path = [
|
||||
"${hals_path}/inc/common",
|
||||
"${hals_path}/inc/liteos",
|
||||
"${hals_path}/inc/dev_info/3861",
|
||||
]
|
||||
hal_module_name = "deviceauth_hal_liteos"
|
||||
} else {
|
||||
hals_inc_path = [
|
||||
"${hals_path}/inc/common",
|
||||
"${hals_path}/inc/linux",
|
||||
"${hals_path}/inc/dev_info/3516",
|
||||
]
|
||||
hal_module_name = "deviceauth_hal_linux"
|
||||
}
|
||||
|
||||
hal_common_files = [
|
||||
"src/common/hc_parcel.c",
|
||||
"src/common/hc_string.c",
|
||||
"src/common/hc_task_thread.c",
|
||||
"src/common/hc_tlv_parser.c",
|
||||
"src/common/json_utils.c",
|
||||
"src/common/common_util.c",
|
||||
"src/common/alg_loader.c",
|
||||
"src/common/hc_log.c",
|
||||
]
|
||||
+7
-7
@@ -16,7 +16,7 @@ if (defined(ohos_lite)) {
|
||||
} else {
|
||||
import("//build/ohos.gni")
|
||||
}
|
||||
import("//base/security/deviceauth/hals/deviceauth_hals.gni")
|
||||
import("//base/security/deviceauth/deps_adapter/deviceauth_hals.gni")
|
||||
import("deviceauth.gni")
|
||||
|
||||
if (defined(ohos_lite)) {
|
||||
@@ -47,7 +47,7 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"${deps_adapter_path}:${hal_module_name}",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
"//utils/native/lite:utils",
|
||||
]
|
||||
@@ -90,7 +90,7 @@ if (defined(ohos_lite)) {
|
||||
|
||||
deps = [
|
||||
":deviceauth",
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"${deps_adapter_path}:${hal_module_name}",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//build/lite/config/component/cJSON:cjson_shared",
|
||||
"//foundation/communication/ipc_lite:liteipc_adapter",
|
||||
@@ -124,7 +124,7 @@ if (defined(ohos_lite)) {
|
||||
cflags += [ "-fPIC" ]
|
||||
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"${deps_adapter_path}:${hal_module_name}",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//foundation/communication/ipc_lite:liteipc_adapter",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
@@ -158,7 +158,7 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"${deps_adapter_path}:${hal_module_name}",
|
||||
"//third_party/cJSON:cjson_static",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
@@ -209,7 +209,7 @@ if (defined(ohos_lite)) {
|
||||
deps = [
|
||||
":auth_service.rc",
|
||||
":deviceauth",
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"${deps_adapter_path}:${hal_module_name}",
|
||||
"//third_party/cJSON:cjson_static",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
@@ -251,7 +251,7 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
|
||||
deps = [
|
||||
"${hals_path}:${hal_module_name}",
|
||||
"${deps_adapter_path}:${hal_module_name}",
|
||||
"//third_party/cJSON:cjson_static",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//base/security/deviceauth/hals/deviceauth_hals.gni")
|
||||
import("//base/security/deviceauth/deps_adapter/deviceauth_hals.gni")
|
||||
import("//base/security/deviceauth/services/deviceauth.gni")
|
||||
import("//build/test.gni")
|
||||
|
||||
@@ -31,22 +31,22 @@ ohos_unittest("deviceauth_llt") {
|
||||
include_dirs += hals_inc_path
|
||||
|
||||
sources = [
|
||||
"${hals_path}/src/common/alg_loader.c",
|
||||
"${hals_path}/src/common/common_util.c",
|
||||
"${hals_path}/src/common/hc_parcel.c",
|
||||
"${hals_path}/src/common/hc_string.c",
|
||||
"${hals_path}/src/common/hc_task_thread.c",
|
||||
"${hals_path}/src/common/hc_tlv_parser.c",
|
||||
"${hals_path}/src/common/json_utils.c",
|
||||
"${hals_path}/src/linux/standard/crypto_hash_to_point.c",
|
||||
"${hals_path}/src/linux/standard/huks_adapter.c",
|
||||
"${hals_path}/src/linux/hc_condition.c",
|
||||
"${hals_path}/src/linux/hc_file.c",
|
||||
"${hals_path}/src/linux/hc_init_protection.c",
|
||||
"${hals_path}/src/linux/hc_mutex.c",
|
||||
"${hals_path}/src/linux/hc_thread.c",
|
||||
"${hals_path}/src/linux/hc_time.c",
|
||||
"${hals_path}/src/linux/hc_types.c",
|
||||
"${common_lib_path}/impl/src/common_util.c",
|
||||
"${common_lib_path}/impl/src/hc_parcel.c",
|
||||
"${common_lib_path}/impl/src/hc_string.c",
|
||||
"${common_lib_path}/impl/src/hc_tlv_parser.c",
|
||||
"${common_lib_path}/impl/src/json_utils.c",
|
||||
"${key_management_adapter_path}/impl/src/alg_loader.c",
|
||||
"${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
|
||||
"${key_management_adapter_path}/impl/src/standard/huks_adapter.c",
|
||||
"${os_adapter_path}/impl/src/hc_task_thread.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_condition.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_file.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_init_protection.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_mutex.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_thread.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_time.c",
|
||||
"${os_adapter_path}/impl/src/linux/hc_types.c",
|
||||
]
|
||||
sources += deviceauth_files
|
||||
sources += [
|
||||
@@ -64,7 +64,7 @@ ohos_unittest("deviceauth_llt") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"dsoftbus_standard:softbus_client",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user