From def8fdd030efb1ff8779926b160ca8e7b683857d Mon Sep 17 00:00:00 2001 From: zhuofan0129 <861080528@qq.com> Date: Mon, 20 May 2024 22:13:14 +0800 Subject: [PATCH 1/2] feat: huks adapter Signed-off-by: zhuofan0129 <861080528@qq.com> --- oem_property/ohos/common/external_interface_adapter.c | 2 ++ oem_property/ohos/common/hks_adapter.c | 1 + 2 files changed, 3 insertions(+) diff --git a/oem_property/ohos/common/external_interface_adapter.c b/oem_property/ohos/common/external_interface_adapter.c index 22c343e..e6fab52 100644 --- a/oem_property/ohos/common/external_interface_adapter.c +++ b/oem_property/ohos/common/external_interface_adapter.c @@ -120,6 +120,7 @@ int32_t DslmCredAttestAdapter(struct DslmInfoInCertChain *info, uint8_t **certCh {.tag = HKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO, .blob = {strlen(info->credStr) + 1, (uint8_t *)info->credStr}}, {.tag = HKS_TAG_ATTESTATION_ID_UDID, .blob = {strlen(info->udidStr) + 1, (uint8_t *)info->udidStr}}, {.tag = HKS_TAG_ATTESTATION_ID_ALIAS, .blob = keyAlias}, + {.tag = HKS_TAG_AUTH_STORAGE_LEVEL, .uint32Param = HKS_AUTH_STORAGE_LEVEL_DE}, }; struct HksParamSet *inputParam = NULL; @@ -170,6 +171,7 @@ int32_t ValidateCertChainAdapter(const uint8_t *data, uint32_t dataLen, struct D {.tag = HKS_TAG_ATTESTATION_CHALLENGE, .blob = {DSLM_INFO_MAX_LEN_NONCE, (uint8_t *)nonceStr}}, {.tag = HKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO, .blob = {DSLM_INFO_MAX_LEN_CRED, (uint8_t *)credStr}}, {.tag = HKS_TAG_ATTESTATION_ID_UDID, .blob = {DSLM_INFO_MAX_LEN_UDID, (uint8_t *)udidStr}}, + {.tag = HKS_TAG_AUTH_STORAGE_LEVEL, .uint32Param = HKS_AUTH_STORAGE_LEVEL_DE}, }; struct HksParamSet *outputParam = NULL; struct HksBlob certBlob[CERT_CHAIN_CERT_NUM] = {{0}}; diff --git a/oem_property/ohos/common/hks_adapter.c b/oem_property/ohos/common/hks_adapter.c index 1313ae5..b6795fc 100644 --- a/oem_property/ohos/common/hks_adapter.c +++ b/oem_property/ohos/common/hks_adapter.c @@ -75,6 +75,7 @@ int32_t HksGenerateKeyAdapter(const struct HksBlob *keyAlias) {.tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PSS}, {.tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT}, {.tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB}, + {.tag = HKS_TAG_AUTH_STORAGE_LEVEL, .uint32Param = HKS_AUTH_STORAGE_LEVEL_DE}, }; struct HksParamSet *paramSet = NULL; if (FillHksParamSet(¶mSet, tmpParams, sizeof(tmpParams) / sizeof(tmpParams[0])) != SUCCESS) { -- Gitee From c125e1beb18d1c7f710be556e6c719f3ecd2dc42 Mon Sep 17 00:00:00 2001 From: zhuofan0129 <861080528@qq.com> Date: Tue, 21 May 2024 22:13:19 +0800 Subject: [PATCH 2/2] feat: build independently Signed-off-by: zhuofan0129 <861080528@qq.com> --- baselib/utils/BUILD.gn | 3 +-- bundle.json | 7 +++---- oem_property/common/BUILD.gn | 9 +++++---- services/common/BUILD.gn | 16 +++++++--------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/baselib/utils/BUILD.gn b/baselib/utils/BUILD.gn index 3fbefa5..2ff37f1 100644 --- a/baselib/utils/BUILD.gn +++ b/baselib/utils/BUILD.gn @@ -76,11 +76,10 @@ ohos_static_library("utils_static") { sources += [ "src/utils_timer.cpp" ] - deps += [ "//third_party/cJSON:cjson" ] - external_deps = [ "c_utils:utils", "hilog:libhilog", + "cJSON:cjson", ] } diff --git a/bundle.json b/bundle.json index cba9724..cfd2757 100644 --- a/bundle.json +++ b/bundle.json @@ -39,12 +39,11 @@ "init", "ipc", "safwk", - "samgr" - ], - "third_party": [ + "samgr", "cJSON", "openssl" - ] + ], + "third_party": [] }, "build": { "group_type": { diff --git a/oem_property/common/BUILD.gn b/oem_property/common/BUILD.gn index 6aafa0e..6689302 100644 --- a/oem_property/common/BUILD.gn +++ b/oem_property/common/BUILD.gn @@ -31,8 +31,10 @@ ohos_source_set("oem_common_obj") { if (defined(ohos_lite)) { if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") { - deps += [ "//third_party/openssl/ohos_lite:openssl_shared" ] - external_deps = [ "hilog_lite:hilog_shared" ] + external_deps = [ + "hilog_lite:hilog_shared", + "openssl/ohos_lite:openssl_shared", + ] } else if (ohos_kernel_type == "liteos_m") { deps += [ "$dslm_hilog_path/featured:hilog_static" ] } @@ -47,11 +49,10 @@ ohos_source_set("oem_common_obj") { } branch_protector_ret = "pac_ret" - deps += [ "//third_party/openssl:libcrypto_shared" ] - external_deps = [ "c_utils:utils", "hilog:libhilog", + "openssl:libcrypto_shared", ] } configs = [ diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index f663130..ff6a139 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -30,16 +30,14 @@ ohos_source_set("service_common_obj") { if (defined(ohos_lite)) { if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") { - deps += [ - "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single", - "//third_party/openssl/ohos_lite:openssl_shared", + deps += [ "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single" ] + external_deps = [ + "hilog_lite:hilog_shared", + "openssl/ohos_lite:openssl_shared", ] - external_deps = [ "hilog_lite:hilog_shared" ] } else if (ohos_kernel_type == "liteos_m") { - deps += [ - "$dslm_hilog_path/featured:hilog_static", - "//third_party/openssl/ohos_lite:openssl_static", - ] + deps += [ "$dslm_hilog_path/featured:hilog_static" ] + external_deps = [ "openssl/ohos_lite:openssl_static" ] } } else { sanitize = { @@ -52,12 +50,12 @@ ohos_source_set("service_common_obj") { } branch_protector_ret = "pac_ret" - deps += [ "//third_party/openssl:libcrypto_shared" ] external_deps = [ "c_utils:utils", "hilog:libhilog", "ipc:ipc_core", + "openssl:libcrypto_shared", ] } -- Gitee