!29 请求将dsoftbus合入next分支

From: @zxstty 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
This commit is contained in:
openeuler-ci-bot 2023-12-12 08:04:41 +00:00 committed by Gitee
commit 28b0fd13bb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
37 changed files with 1156 additions and 2903 deletions

View File

@ -1,390 +0,0 @@
From a7244bd742f999e7ec8462797c7e7a393a844a7b Mon Sep 17 00:00:00 2001
From: hmilylmk <liumingkai@huawei.com>
Date: Sat, 13 Aug 2022 08:21:36 +0800
Subject: [PATCH] add dsoftbus build support for embedded env
Signed-off-by: hmilylmk <liumingkai@huawei.com>
---
build_scripts/build.sh | 9 ++++----
config/BUILDCONFIG.gn | 11 ++++-----
config/compiler/compiler.gni | 6 +----
config/ohos/BUILD.gn | 32 +-------------------------
config/ohos/abi.gni | 5 -----
config/ohos/config.gni | 4 ++--
config/ohos/musl.gni | 4 +++-
core/gn/BUILD.gn | 35 ++---------------------------
loader/preloader/platforms.template | 4 ++--
ohos.gni | 7 ------
subsystem_config.json | 6 +++++
toolchain/linux/BUILD.gn | 8 +++++--
12 files changed, 31 insertions(+), 100 deletions(-)
diff --git a/build_scripts/build.sh b/build_scripts/build.sh
index 3514b36..e2404ca 100755
--- a/build_scripts/build.sh
+++ b/build_scripts/build.sh
@@ -70,22 +70,22 @@ do
shift
done
-
if [[ "${source_root_dir}x" == "x" ]]; then
echo "Error: source_root_dir cannot be empty."
exit 1
fi
+
if [[ ! -d "${source_root_dir}" ]]; then
echo "Error: source_root_dir is incorrect."
exit 1
fi
+
if [[ "${product_name}x" == "x" ]]; then
echo -e "\033[31mError: the product name should be specified!\033[0m"
help
exit 1
fi
-
case $(uname -s) in
Darwin)
HOST_DIR="darwin-x86"
@@ -102,10 +102,9 @@ case $(uname -s) in
esac
# set python3
-PYTHON3=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.8.5/bin/python3
-
+PYTHON3=`which python`
if [[ ! -f "${PYTHON3}" ]]; then
- echo -e "\033[33m Please execute the build/prebuilts_download.sh \033[0m"
+ echo -e "\033[33m python3 not found, please check\033[0m"
exit 1
fi
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 98bb98b..9e016df 100755
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -130,10 +130,7 @@ declare_args() {
is_desktop_linux = current_os == "linux"
# Set to true when compiling with the Clang compiler.
- is_clang = current_os != "linux" ||
- (current_cpu != "s390x" && current_cpu != "s390" &&
- current_cpu != "ppc64" && current_cpu != "ppc" &&
- current_cpu != "mips" && current_cpu != "mips64")
+ is_clang = false
# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
@@ -154,7 +151,7 @@ declare_args() {
}
declare_args() {
- use_musl = true
+ use_musl = false
}
asdk_libs_dir = "//prebuilts/asdk_libs"
@@ -220,7 +217,7 @@ if (host_toolchain == "") {
if (host_os == "linux") {
if (target_os != "linux") {
- host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
+ host_toolchain = "//build/toolchain/linux:$host_cpu"
} else if (is_clang) {
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
} else {
@@ -250,7 +247,7 @@ _default_toolchain = ""
if (target_os == "ohos") {
assert(host_os == "linux" || host_os == "mac",
"ohos builds are only supported on Linux and Mac hosts.")
- _default_toolchain = "//build/toolchain/ohos:ohos_clang_$target_cpu"
+ _default_toolchain = "//build/toolchain/linux:$target_cpu"
} else if (target_os == "linux") {
if (is_clang) {
_default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
diff --git a/config/compiler/compiler.gni b/config/compiler/compiler.gni
index b77100a..ae45cc8 100755
--- a/config/compiler/compiler.gni
+++ b/config/compiler/compiler.gni
@@ -152,11 +152,7 @@ declare_args() {
declare_args() {
# Whether to use the gold linker from binutils instead of lld or bfd.
- use_gold = !use_lld &&
- ((is_linux && (current_cpu == "x64" || current_cpu == "x86" ||
- current_cpu == "arm")) ||
- (is_ohos && (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64")))
+ use_gold = false
}
# If it wasn't manually set, set to an appropriate default.
diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn
index aa5ac7c..941cc2e 100755
--- a/config/ohos/BUILD.gn
+++ b/config/ohos/BUILD.gn
@@ -24,31 +24,17 @@ config("compiler") {
"HAVE_SYS_UIO_H",
]
- defines += [
- "__MUSL__",
- "_LIBCPP_HAS_MUSL_LIBC",
- "__BUILD_LINUX_WITH_CLANG",
- ]
-
ldflags = [
"-Wl,--no-undefined",
- "-Wl,--exclude-libs=libunwind_llvm.a",
- "-Wl,--exclude-libs=libc++_static.a",
# Don't allow visible symbols from libraries that contain
# assembly code with symbols that aren't hidden properly.
# http://crbug.com/448386
- "-Wl,--exclude-libs=libvpx_assembly_arm.a",
]
- cflags += [ "--target=$abi_target" ]
include_dirs = [
- "${musl_sysroot}/usr/include/${abi_target}",
- "${clang_base_path}/include/c++/v1",
]
- ldflags += [ "--target=$abi_target" ]
-
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler.
asmflags = cflags
@@ -66,13 +52,6 @@ config("runtime_library") {
"CHROMIUM_CXX_TWEAK_INLINES", # Saves binary size.
]
- defines += [
- "__MUSL__",
- "_LIBCPP_HAS_MUSL_LIBC",
- "__BUILD_LINUX_WITH_CLANG",
- ]
- ldflags = [ "-nostdlib" ]
-
libs = []
# arm builds of libc++ starting in NDK r12 depend on unwind.
@@ -80,20 +59,11 @@ config("runtime_library") {
libs += [ "unwind" ]
}
- ldflags += [
- "-L" +
- rebase_path("${clang_base_path}/lib/${abi_target}/c++", root_build_dir),
- "-L" + rebase_path("${musl_sysroot}/usr/lib/${abi_target}", root_build_dir),
- "-L" + rebase_path("${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}",
- root_build_dir),
+ ldflags = [
]
- ldflags += [ "-Wl,--dynamic-linker,/system/bin/ld-musl-${musl_arch}.so.1" ]
libs += [
- rebase_path(libclang_rt_file),
"c",
- "c++",
- "c++abi",
]
if (current_cpu == "arm" && arm_version == 6) {
diff --git a/config/ohos/abi.gni b/config/ohos/abi.gni
index 57d1dca..600bc3e 100755
--- a/config/ohos/abi.gni
+++ b/config/ohos/abi.gni
@@ -61,8 +61,3 @@ if (target_cpu == "arm64") {
ohos_secondary_abi_cpu = "x86"
ohos_app_secondary_abi = "x86"
}
-
-if (defined(ohos_secondary_abi_cpu)) {
- ohos_secondary_abi_toolchain =
- "//build/toolchain/ohos:ohos_clang_${ohos_secondary_abi_cpu}"
-}
diff --git a/config/ohos/config.gni b/config/ohos/config.gni
index 072bce1..00c7311 100644
--- a/config/ohos/config.gni
+++ b/config/ohos/config.gni
@@ -26,11 +26,11 @@ if (is_ohos) {
}
if (current_cpu == "arm") {
- abi_target = "arm-linux-ohosmusl"
+ abi_target = ""
} else if (current_cpu == "x86") {
abi_target = ""
} else if (current_cpu == "arm64") {
- abi_target = "aarch64-linux-ohosmusl"
+ abi_target = ""
} else if (current_cpu == "x86_64") {
abi_target = ""
} else {
diff --git a/config/ohos/musl.gni b/config/ohos/musl.gni
index 2468ca8..f9cead9 100644
--- a/config/ohos/musl.gni
+++ b/config/ohos/musl.gni
@@ -16,4 +16,6 @@ if (use_musl){
musl_target = "//third_party/musl:musl_libs"
musl_sysroot = get_label_info(musl_target, "target_out_dir")
import("//third_party/musl/musl_config.gni")
-}
\ No newline at end of file
+} else {
+ musl_sysroot = ""
+}
diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn
index 38d3cc9..cde44b1 100755
--- a/core/gn/BUILD.gn
+++ b/core/gn/BUILD.gn
@@ -86,41 +86,10 @@ if (product_name == "ohos-sdk") {
deps = [ "//build/ohos/sdk:ohos_sdk" ]
}
} else {
- group("make_all") {
- deps = [
- ":images",
- ":make_inner_kits",
- ":packages",
- ]
- }
-
group("images") {
- deps = [ "//build/ohos/images:make_images" ]
- }
-
- group("packages") {
- deps = [ "//build/ohos/packages:make_packages" ]
- }
-
- group("make_inner_kits") {
- deps = [ "$root_build_dir/build_configs:inner_kits" ]
- }
-
- group("build_all_test_pkg") {
- testonly = true
deps = [
- "$root_build_dir/build_configs:parts_test",
- "//test/developertest:make_temp_test",
+ "//foundation/communication/dsoftbus/core/frame:softbus_server_main",
+ "//foundation/communication/dsoftbus/sdk:softbus_client",
]
}
-
- group("make_test") {
- testonly = true
- deps = [ ":build_all_test_pkg" ]
- deps += [ "//build/ohos/packages:package_testcase_mlf" ]
- deps += [ "//build/ohos/packages:package_testcase" ]
- if (archive_component) {
- deps += [ "//build/ohos/testfwk:archive_testcase" ]
- }
- }
}
diff --git a/loader/preloader/platforms.template b/loader/preloader/platforms.template
index 5cad64d..7577fd6 100644
--- a/loader/preloader/platforms.template
+++ b/loader/preloader/platforms.template
@@ -4,13 +4,13 @@
{
"target_os": "ohos",
"target_cpu": "arm64",
- "toolchain": "//build/toolchain/ohos:ohos_clang_arm64",
+ "toolchain": "//build/toolchain/linux:arm64",
"parts_config": "./parts.json"
},
{
"target_os": "ohos",
"target_cpu": "arm",
- "toolchain": "//build/toolchain/ohos:ohos_clang_arm",
+ "toolchain": "//build/toolchain/linux:arm",
"parts_config": "./parts.json"
}
]
diff --git a/ohos.gni b/ohos.gni
index 77be836..a34baa3 100755
--- a/ohos.gni
+++ b/ohos.gni
@@ -11,19 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build/config/sanitizers/sanitizers.gni")
-import("//build/ohos/ndk/ndk.gni")
-import("//build/ohos/notice/notice.gni")
-import("//build/ohos/sa_profile/sa_profile.gni")
import("//build/ohos_var.gni")
import("//build/toolchain/toolchain.gni")
# import cxx base templates
import("//build/templates/cxx/cxx.gni")
-import("//build/ohos/ace/ace.gni")
-import("//build/ohos/app/app.gni")
-
import("//build/templates/common/ohos_templates.gni")
# import prebuilt templates
diff --git a/subsystem_config.json b/subsystem_config.json
index f04f29e..ebc0869 100644
--- a/subsystem_config.json
+++ b/subsystem_config.json
@@ -178,5 +178,11 @@
"path": "kernel/linux/build",
"name": "kernel",
"dir": "kernel/linux"
+ },
+ "depend": {
+ "project":"openEuler/depend",
+ "path": "depend",
+ "name": "depend",
+ "dir": "depend"
}
}
diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn
index 1a4c4e9..c811cf9 100755
--- a/toolchain/linux/BUILD.gn
+++ b/toolchain/linux/BUILD.gn
@@ -22,7 +22,8 @@ clang_toolchain("clang_arm64") {
}
gcc_toolchain("arm64") {
- toolprefix = "aarch64-linux-gnu-"
+ tool_path = rebase_path("//toolchain/bin", root_build_dir)
+ toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-"
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
@@ -31,6 +32,7 @@ gcc_toolchain("arm64") {
ld = cxx
readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
+ strip = "${toolprefix}strip"
toolchain_args = {
current_cpu = "arm64"
@@ -40,7 +42,8 @@ gcc_toolchain("arm64") {
}
gcc_toolchain("arm") {
- toolprefix = "arm-linux-gnueabihf-"
+ tool_path = rebase_path("//toolchain/bin", root_build_dir)
+ toolprefix = "${tool_path}/arm-openeuler-linux-gnu-"
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
@@ -49,6 +52,7 @@ gcc_toolchain("arm") {
ld = cxx
readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
+ strip = "${toolprefix}strip"
toolchain_args = {
current_cpu = "arm"
--
2.34.1

View File

@ -0,0 +1,934 @@
From ad68a9dc1f289fb63cc4b10613f3bd46b546c225 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:01:51 +0800
Subject: [PATCH] remove dependency and adapt for openeuler
---
adapter/BUILD.gn | 2 +-
.../common/bus_center/bus_center_adapter.gni | 4 +-
.../common/dfx/softbus_adapter_hisysevent.cpp | 263 +++++++++---------
bundle.json | 4 +-
.../bus_center/src/bus_center_adapter.c | 2 +-
core/authentication/include/auth_hichain.h | 2 +
core/authentication/src/auth_hichain.c | 8 +-
core/authentication/src/auth_session_fsm.c | 8 +
.../lane_manager/src/lnn_lane_link_proc.c | 2 +-
.../lane_manager/src/lnn_select_rule.c | 2 +-
.../standard/softbus_permission.cpp | 151 +++++-----
.../common/src/softbus_thread_pool.c | 3 +-
core/frame/BUILD.gn | 6 +-
.../src/permission_status_change_cb.cpp | 18 +-
.../src/softbus_client_info_manager.cpp | 9 +-
.../standard/init/src/softbus_server_stub.cpp | 137 ++++-----
16 files changed, 325 insertions(+), 296 deletions(-)
diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn
index 20f4e606d..2b7fa0fb8 100644
--- a/adapter/BUILD.gn
+++ b/adapter/BUILD.gn
@@ -206,7 +206,7 @@ if (defined(ohos_lite)) {
public_configs = [ ":config_adapter_common" ]
if (is_standard_system) {
external_deps = [
- "hisysevent_native:libhisysevent",
+ # "hisysevent_native:libhisysevent",
"hiviewdfx_hilog_native:libhilog",
]
}
diff --git a/adapter/common/bus_center/bus_center_adapter.gni b/adapter/common/bus_center/bus_center_adapter.gni
index ebd12a0f3..6c8887d8b 100644
--- a/adapter/common/bus_center/bus_center_adapter.gni
+++ b/adapter/common/bus_center/bus_center_adapter.gni
@@ -87,8 +87,8 @@ if (defined(ohos_lite)) {
if (has_ces_part) {
bus_center_adapter_src +=
[ "$adapter_bus_center_path/common_event/lnn_common_event_monitor.cpp" ]
- bus_center_adapter_external_deps +=
- [ "common_event_service:cesfwk_innerkits" ]
+ # bus_center_adapter_external_deps +=
+ # [ "common_event_service:cesfwk_innerkits" ]
} else {
bus_center_adapter_src += [ "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp" ]
}
diff --git a/adapter/common/dfx/softbus_adapter_hisysevent.cpp b/adapter/common/dfx/softbus_adapter_hisysevent.cpp
index 1c6d36352..d04490317 100644
--- a/adapter/common/dfx/softbus_adapter_hisysevent.cpp
+++ b/adapter/common/dfx/softbus_adapter_hisysevent.cpp
@@ -23,127 +23,127 @@
#include "softbus_adapter_mem.h"
#include "softbus_adapter_thread.h"
#include "message_handler.h"
-#include "hisysevent_c.h"
+// #include "hisysevent_c.h"
-static const char *g_domain = "DSOFTBUS";
-static bool g_init_lock = false;
-static SoftBusMutex g_dfx_lock;
-static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT];
+// static const char *g_domain = "DSOFTBUS";
+// static bool g_init_lock = false;
+// static SoftBusMutex g_dfx_lock;
+// static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT];
-static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam)
-{
- switch (srcParam->paramType) {
- case SOFTBUS_EVT_PARAMTYPE_BOOL:
- dstParam->t = HISYSEVENT_BOOL;
- dstParam->v.b = srcParam->paramValue.b;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT8:
- dstParam->t = HISYSEVENT_UINT8;
- dstParam->v.ui8 = srcParam->paramValue.u8v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT16:
- dstParam->t = HISYSEVENT_UINT16;
- dstParam->v.ui16 = srcParam->paramValue.u16v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_INT32:
- dstParam->t = HISYSEVENT_INT32;
- dstParam->v.i32 = srcParam->paramValue.i32v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT32:
- dstParam->t = HISYSEVENT_UINT32;
- dstParam->v.ui32 = srcParam->paramValue.u32v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT64:
- dstParam->t = HISYSEVENT_UINT64;
- dstParam->v.ui64 = srcParam->paramValue.u64v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_FLOAT:
- dstParam->t = HISYSEVENT_FLOAT;
- dstParam->v.f = srcParam->paramValue.f;
- break;
- case SOFTBUS_EVT_PARAMTYPE_DOUBLE:
- dstParam->t = HISYSEVENT_DOUBLE;
- dstParam->v.d = srcParam->paramValue.d;
- break;
- case SOFTBUS_EVT_PARAMTYPE_STRING:
- dstParam->t = HISYSEVENT_STRING;
- dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN);
- if (dstParam->v.s == NULL) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail");
- return SOFTBUS_ERR;
- }
- if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) {
- SoftBusFree(dstParam->v.s);
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail");
- return SOFTBUS_ERR;
- }
- break;
- default:
- break;
- }
- return SOFTBUS_OK;
-}
+// static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam)
+// {
+ // switch (srcParam->paramType) {
+ // case SOFTBUS_EVT_PARAMTYPE_BOOL:
+ // dstParam->t = HISYSEVENT_BOOL;
+ // dstParam->v.b = srcParam->paramValue.b;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT8:
+ // dstParam->t = HISYSEVENT_UINT8;
+ // dstParam->v.ui8 = srcParam->paramValue.u8v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT16:
+ // dstParam->t = HISYSEVENT_UINT16;
+ // dstParam->v.ui16 = srcParam->paramValue.u16v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_INT32:
+ // dstParam->t = HISYSEVENT_INT32;
+ // dstParam->v.i32 = srcParam->paramValue.i32v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT32:
+ // dstParam->t = HISYSEVENT_UINT32;
+ // dstParam->v.ui32 = srcParam->paramValue.u32v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT64:
+ // dstParam->t = HISYSEVENT_UINT64;
+ // dstParam->v.ui64 = srcParam->paramValue.u64v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_FLOAT:
+ // dstParam->t = HISYSEVENT_FLOAT;
+ // dstParam->v.f = srcParam->paramValue.f;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_DOUBLE:
+ // dstParam->t = HISYSEVENT_DOUBLE;
+ // dstParam->v.d = srcParam->paramValue.d;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_STRING:
+ // dstParam->t = HISYSEVENT_STRING;
+ // dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN);
+ // if (dstParam->v.s == NULL) {
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail");
+ // return SOFTBUS_ERR;
+ // }
+ // if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) {
+ // SoftBusFree(dstParam->v.s);
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail");
+ // return SOFTBUS_ERR;
+ // }
+ // break;
+ // default:
+ // break;
+ // }
+// return SOFTBUS_OK;
+// }
-static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg)
-{
- if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0,
- sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail");
- return SOFTBUS_ERR;
- }
- for (uint32_t i = 0; i < msg->paramNum; i++) {
- if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail");
- return SOFTBUS_ERR;
- }
- if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail");
- return SOFTBUS_ERR;
- }
- }
- return SOFTBUS_OK;
-}
+// static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg)
+// {
+// if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0,
+// sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail");
+// return SOFTBUS_ERR;
+// }
+// for (uint32_t i = 0; i < msg->paramNum; i++) {
+// if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail");
+// return SOFTBUS_ERR;
+// }
+// if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail");
+// return SOFTBUS_ERR;
+// }
+// }
+// return SOFTBUS_OK;
+// }
-static void HiSysEventParamDeInit(uint32_t size)
-{
- for (uint32_t i = 0; i < size; i++) {
- if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) {
- SoftBusFree(g_dstParam[i].v.s);
- g_dstParam[i].v.s = NULL;
- }
- }
- }
+// static void HiSysEventParamDeInit(uint32_t size)
+// {
+// for (uint32_t i = 0; i < size; i++) {
+// if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) {
+// SoftBusFree(g_dstParam[i].v.s);
+// g_dstParam[i].v.s = NULL;
+// }
+// }
+// }
-static HiSysEventEventType ConvertMsgType(SoftBusEvtType type)
-{
- HiSysEventEventType hiSysEvtType;
- switch (type) {
- case SOFTBUS_EVT_TYPE_FAULT:
- hiSysEvtType = HISYSEVENT_FAULT;
- break;
- case SOFTBUS_EVT_TYPE_STATISTIC:
- hiSysEvtType = HISYSEVENT_STATISTIC;
- break;
- case SOFTBUS_EVT_TYPE_SECURITY:
- hiSysEvtType = HISYSEVENT_SECURITY;
- break;
- case SOFTBUS_EVT_TYPE_BEHAVIOR:
- hiSysEvtType = HISYSEVENT_BEHAVIOR;
- break;
- default:
- hiSysEvtType = HISYSEVENT_STATISTIC;
- break;
- }
- return hiSysEvtType;
-}
+// static HiSysEventEventType ConvertMsgType(SoftBusEvtType type)
+// {
+// HiSysEventEventType hiSysEvtType;
+// switch (type) {
+// case SOFTBUS_EVT_TYPE_FAULT:
+// hiSysEvtType = HISYSEVENT_FAULT;
+// break;
+// case SOFTBUS_EVT_TYPE_STATISTIC:
+// hiSysEvtType = HISYSEVENT_STATISTIC;
+// break;
+// case SOFTBUS_EVT_TYPE_SECURITY:
+// hiSysEvtType = HISYSEVENT_SECURITY;
+// break;
+// case SOFTBUS_EVT_TYPE_BEHAVIOR:
+// hiSysEvtType = HISYSEVENT_BEHAVIOR;
+// break;
+// default:
+// hiSysEvtType = HISYSEVENT_STATISTIC;
+// break;
+// }
+// return hiSysEvtType;
+// }
-static void InitHisEvtMutexLock()
-{
- if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail");
- return;
- }
-}
+// static void InitHisEvtMutexLock()
+// {
+// if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail");
+// return;
+// }
+// }
#ifdef __cplusplus
#if __cplusplus
@@ -153,22 +153,23 @@ extern "C" {
int32_t SoftbusWriteHisEvt(SoftBusEvtReportMsg* reportMsg)
{
- if (reportMsg == nullptr) {
- return SOFTBUS_ERR;
- }
- if (!g_init_lock) {
- InitHisEvtMutexLock();
- g_init_lock = true;
- }
- if (SoftBusMutexLock(&g_dfx_lock) != 0) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__);
- return SOFTBUS_LOCK_ERR;
- }
- ConvertMsgToHiSysEvent(reportMsg);
- OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType),
- g_dstParam, reportMsg->paramNum);
- HiSysEventParamDeInit(reportMsg->paramNum);
- (void)SoftBusMutexUnlock(&g_dfx_lock);
+ // if (reportMsg == nullptr) {
+ // return SOFTBUS_ERR;
+ // }
+ // if (!g_init_lock) {
+ // InitHisEvtMutexLock();
+ // g_init_lock = true;
+ // }
+ // if (SoftBusMutexLock(&g_dfx_lock) != 0) {
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__);
+ // return SOFTBUS_LOCK_ERR;
+ // }
+ // ConvertMsgToHiSysEvent(reportMsg);
+ // OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType),
+ // g_dstParam, reportMsg->paramNum);
+ // HiSysEventParamDeInit(reportMsg->paramNum);
+ // (void)SoftBusMutexUnlock(&g_dfx_lock);
+ (void)reportMsg;
return SOFTBUS_OK;
}
diff --git a/bundle.json b/bundle.json
index fafbe1a58..e6f2752ba 100644
--- a/bundle.json
+++ b/bundle.json
@@ -81,7 +81,9 @@
"bus_center/softbus_bus_center.h",
"common/softbus_common.h",
"discovery/discovery_service.h",
- "transport/session.h"
+ "transport/session.h",
+ "../inner_kits/transport/dfs_session.h",
+ "../inner_kits/transport/inner_session.h"
],
"header_base": "//foundation/communication/dsoftbus/interfaces/kits"
}
diff --git a/core/adapter/bus_center/src/bus_center_adapter.c b/core/adapter/bus_center/src/bus_center_adapter.c
index 70f1d4a87..909a67563 100644
--- a/core/adapter/bus_center/src/bus_center_adapter.c
+++ b/core/adapter/bus_center/src/bus_center_adapter.c
@@ -27,7 +27,7 @@
#include "softbus_errcode.h"
#include "softbus_log.h"
-#define DEFAULT_DEVICE_NAME "OpenHarmony"
+#define DEFAULT_DEVICE_NAME "openEuler"
int32_t GetCommonDevInfo(const CommonDeviceKey key, char *value, uint32_t len)
{
diff --git a/core/authentication/include/auth_hichain.h b/core/authentication/include/auth_hichain.h
index 812541147..dbbff1e1f 100644
--- a/core/authentication/include/auth_hichain.h
+++ b/core/authentication/include/auth_hichain.h
@@ -37,6 +37,8 @@ int32_t HichainProcessData(int64_t authSeq, const uint8_t *data, uint32_t len);
void HichainDestroy(void);
+void OnFinish(int64_t authSeq, int operationCode, const char *returnData);
+
#ifdef __cplusplus
#if __cplusplus
}
diff --git a/core/authentication/src/auth_hichain.c b/core/authentication/src/auth_hichain.c
index f7b362e03..78a5f0783 100644
--- a/core/authentication/src/auth_hichain.c
+++ b/core/authentication/src/auth_hichain.c
@@ -90,7 +90,7 @@ static void OnSessionKeyReturned(int64_t authSeq, const uint8_t *sessionKey, uin
(void)AuthSessionSaveSessionKey(authSeq, sessionKey, sessionKeyLen);
}
-static void OnFinish(int64_t authSeq, int operationCode, const char *returnData)
+void OnFinish(int64_t authSeq, int operationCode, const char *returnData)
{
(void)operationCode;
(void)returnData;
@@ -286,6 +286,12 @@ void UnregTrustDataChangeListener(void)
int32_t HichainStartAuth(int64_t authSeq, const char *udid, const char *uid)
{
+ // bypass auth
+ uint8_t tempKey[32] = {0};
+ memset(tempKey, 1, 32);
+ g_hichainCallback.onSessionKeyReturned(authSeq, tempKey, 32);
+ return SOFTBUS_OK;
+
if (udid == NULL || uid == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "udid/uid is invalid.");
return SOFTBUS_INVALID_PARAM;
diff --git a/core/authentication/src/auth_session_fsm.c b/core/authentication/src/auth_session_fsm.c
index eaf6844e9..56d9b84fc 100644
--- a/core/authentication/src/auth_session_fsm.c
+++ b/core/authentication/src/auth_session_fsm.c
@@ -264,6 +264,11 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para)
ret = SOFTBUS_AUTH_SYNC_DEVID_FAIL;
break;
}
+ // bypass auth
+ if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) {
+ ret = SOFTBUS_AUTH_HICHAIN_AUTH_FAIL;
+ break;
+ }
} else {
/* just client need start authDevice. */
if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) {
@@ -275,6 +280,9 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para)
ret = SOFTBUS_OK;
} while (false);
+ // by pass auth
+ OnFinish(authFsm->authSeq, 0, NULL);
+
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "handle devId msg fail, ret=%d", ret);
CompleteAuthSession(authFsm, ret);
diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
index c966df363..b37b90a76 100755
--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
+++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
@@ -34,7 +34,7 @@
#include "softbus_network_utils.h"
#include "softbus_protocol_def.h"
#include "softbus_utils.h"
-#include "wifi_device.h"
+// #include "wifi_device.h"
typedef int32_t (*LaneLinkByType)(uint32_t reqId, const LinkRequest *reqInfo, const LaneLinkCb *callback);
diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
index 79712a68f..ec66978ec 100644
--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
+++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
@@ -30,7 +30,7 @@
#include "softbus_network_utils.h"
#include "softbus_utils.h"
#include "softbus_wifi_api_adapter.h"
-#include "wifi_device.h"
+// #include "wifi_device.h"
#define LNN_LINK_DEFAULT_SCORE 60 /* Indicates that scoring is not supported */
diff --git a/core/common/security/permission/standard/softbus_permission.cpp b/core/common/security/permission/standard/softbus_permission.cpp
index e2b3ac720..5016dec1d 100644
--- a/core/common/security/permission/standard/softbus_permission.cpp
+++ b/core/common/security/permission/standard/softbus_permission.cpp
@@ -17,8 +17,9 @@
#include <sys/types.h>
#include <unistd.h>
+#include <string.h>
-#include "accesstoken_kit.h"
+// #include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "permission_entry.h"
#include "softbus_adapter_mem.h"
@@ -32,95 +33,100 @@
#endif
namespace {
- using namespace OHOS::Security;
+ // using namespace OHOS::Security;
const std::string PERMISSION_JSON_FILE = PERMISSION_JSON_FILE_PATH;
const std::string DANGER_APP_PERMISSION = "ohos.permission.DISTRIBUTED_DATASYNC";
- const int32_t SYSTEM_UID = 1000;
- const int32_t MULTE_USER_RADIX = 100000;
- const std::string SAMGR_PROCESS_NAME = "samgr";
+ // const int32_t SYSTEM_UID = 1000;
+ // const int32_t MULTE_USER_RADIX = 100000;
+ // const std::string SAMGR_PROCESS_NAME = "samgr";
}
int32_t TransPermissionInit(void)
{
- int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str());
- if (ret != SOFTBUS_OK) {
- return ret;
- }
- return InitDynamicPermission();
+ // int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str());
+ // if (ret != SOFTBUS_OK) {
+ // return ret;
+ // }
+ // return InitDynamicPermission();
+ return SOFTBUS_OK;
}
void TransPermissionDeinit(void)
{
- DeinitPermissionJson();
+ // DeinitPermissionJson();
}
int32_t CheckTransPermission(pid_t callingUid, pid_t callingPid,
const char *pkgName, const char *sessionName, uint32_t actions)
{
- if (sessionName == nullptr || pkgName == nullptr) {
- return SOFTBUS_PERMISSION_DENIED;
- }
- SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions);
- if (pItem == nullptr) {
- return SOFTBUS_MALLOC_ERR;
- }
- int32_t ret = CheckPermissionEntry(sessionName, pItem);
- SoftBusFree(pItem);
- if (ret >= SYSTEM_APP) {
- return SOFTBUS_OK;
- }
- return SOFTBUS_PERMISSION_DENIED;
+ // if (sessionName == nullptr || pkgName == nullptr) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+ // SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions);
+ // if (pItem == nullptr) {
+ // return SOFTBUS_MALLOC_ERR;
+ // }
+ // int32_t ret = CheckPermissionEntry(sessionName, pItem);
+ // SoftBusFree(pItem);
+ // if (ret >= SYSTEM_APP) {
+ // return SOFTBUS_OK;
+ // }
+ // return SOFTBUS_PERMISSION_DENIED;
+ return SOFTBUS_OK;
}
int32_t CheckTransSecLevel(const char *mySessionName, const char *peerSessionName)
{
- if (mySessionName == nullptr || peerSessionName == nullptr) {
- return SOFTBUS_INVALID_PARAM;
- }
- if (strcmp(mySessionName, peerSessionName) == 0) {
- return SOFTBUS_OK;
- }
- if (!PermIsSecLevelPublic(mySessionName)) {
- return SOFTBUS_PERMISSION_DENIED;
- }
- if (!PermIsSecLevelPublic(peerSessionName)) {
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // if (mySessionName == nullptr || peerSessionName == nullptr) {
+ // return SOFTBUS_INVALID_PARAM;
+ // }
+ // if (strcmp(mySessionName, peerSessionName) == 0) {
+ // return SOFTBUS_OK;
+ // }
+ // if (!PermIsSecLevelPublic(mySessionName)) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+ // if (!PermIsSecLevelPublic(peerSessionName)) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
bool CheckDiscPermission(pid_t callingUid, const char *pkgName)
{
- std::string pkg = "";
- if (pkgName != nullptr) {
- pkg = std::string(pkgName);
- } else {
- return false;
- }
- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
- return true;
- }
- return false;
+ // std::string pkg = "";
+ // if (pkgName != nullptr) {
+ // pkg = std::string(pkgName);
+ // } else {
+ // return false;
+ // }
+ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
+ // return true;
+ // }
+ // return false;
+ return 0;
}
bool CheckBusCenterPermission(pid_t callingUid, const char *pkgName)
{
- std::string pkg = "";
- if (pkgName != nullptr) {
- pkg = std::string(pkgName);
- } else {
- return false;
- }
- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
- return true;
- }
- return false;
+ // std::string pkg = "";
+ // if (pkgName != nullptr) {
+ // pkg = std::string(pkgName);
+ // } else {
+ // return false;
+ // }
+ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
+ // return true;
+ // }
+ // return false;
+ return true;
}
int32_t GrantTransPermission(int32_t callingUid, int32_t callingPid, const char *sessionName)
{
- return AddDynamicPermission(callingUid, callingPid, sessionName);
+ // return AddDynamicPermission(callingUid, callingPid, sessionName);
+ return SOFTBUS_OK;
}
int32_t RemoveTransPermission(const char *sessionName)
@@ -130,19 +136,20 @@ int32_t RemoveTransPermission(const char *sessionName)
int32_t CheckDynamicPermission(void)
{
- uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID();
-
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken);
- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call");
- return SOFTBUS_ERR;
- }
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo);
- if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
- return SOFTBUS_OK;
- }
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
- "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str());
- return SOFTBUS_ERR;
+ // uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID();
+
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken);
+ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call");
+ // return SOFTBUS_ERR;
+ // }
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo);
+ // if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
+ // return SOFTBUS_OK;
+ // }
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
+ // "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str());
+ // return SOFTBUS_ERR;
+ return SOFTBUS_OK;
}
diff --git a/core/connection/common/src/softbus_thread_pool.c b/core/connection/common/src/softbus_thread_pool.c
index 854cfbb6e..71dad9311 100644
--- a/core/connection/common/src/softbus_thread_pool.c
+++ b/core/connection/common/src/softbus_thread_pool.c
@@ -24,7 +24,8 @@
#include "softbus_log.h"
#ifndef MIN_STACK_SIZE
-#define MIN_STACK_SIZE 0x8000
+// #define MIN_STACK_SIZE 0x8000
+#define MIN_STACK_SIZE 0x200000
#endif
#define THREAD_POOL_NAME "SoftBusConnect"
diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn
index ec37faeb9..ad2e1cc18 100644
--- a/core/frame/BUILD.gn
+++ b/core/frame/BUILD.gn
@@ -173,7 +173,7 @@ if (defined(ohos_lite)) {
sources = dsoftbus_server_common_src
sources += [
"$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp",
- "$os_type/client_manager/src/permission_status_change_cb.cpp",
+ # "$os_type/client_manager/src/permission_status_change_cb.cpp",
"$os_type/client_manager/src/softbus_client_info_manager.cpp",
"$os_type/init/src/if_softbus_server.cpp",
"$os_type/init/src/softbus_server.cpp",
@@ -195,8 +195,8 @@ if (defined(ohos_lite)) {
if (is_standard_system) {
external_deps = dsoftbus_server_common_external_deps
external_deps += [
- "access_token:libaccesstoken_sdk",
- "access_token:libprivacy_sdk",
+ # "access_token:libaccesstoken_sdk",
+ # "access_token:libprivacy_sdk",
"device_auth:deviceauth_sdk",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
diff --git a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
index 391f03f99..8d871c669 100644
--- a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
+++ b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
@@ -33,14 +33,14 @@ void PermissionStatusChangeCb::PermStateChangeCallback(PermStateChangeInfo& resu
void RegisterDataSyncPermission(const uint32_t callingTokenId,
const std::string permissionName, const std::string pkgName)
{
- PermStateChangeScope scopeInfo;
- scopeInfo.permList = {permissionName};
- scopeInfo.tokenIDs = {callingTokenId};
- std::shared_ptr<PermissionStatusChangeCb> callbackPtr_ =
- std::make_shared<PermissionStatusChangeCb>(scopeInfo, pkgName);
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId);
- if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed.");
- }
+ // PermStateChangeScope scopeInfo;
+ // scopeInfo.permList = {permissionName};
+ // scopeInfo.tokenIDs = {callingTokenId};
+ // std::shared_ptr<PermissionStatusChangeCb> callbackPtr_ =
+ // std::make_shared<PermissionStatusChangeCb>(scopeInfo, pkgName);
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId);
+ // if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed.");
+ // }
}
} // namespace OHOS
\ No newline at end of file
diff --git a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
index 6014d0ca8..2a6b07b1b 100644
--- a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
+++ b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
@@ -14,7 +14,8 @@
*/
#include "softbus_client_info_manager.h"
-#include "permission_status_change_cb.h"
+#include "ipc_skeleton.h"
+// #include "permission_status_change_cb.h"
#include "softbus_server.h"
#include "softbus_errcode.h"
#include "softbus_log.h"
@@ -36,9 +37,9 @@ int32_t SoftbusClientInfoManager::SoftbusAddService(const std::string &pkgName,
std::lock_guard<std::recursive_mutex> autoLock(clientObjectMapLock_);
std::pair<sptr<IRemoteObject>, sptr<IRemoteObject::DeathRecipient>> clientObject(object, abilityDeath);
clientObjectMap_.emplace(pkgName, clientObject);
- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
- std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
- RegisterDataSyncPermission(tokenCaller, permissionName, pkgName);
+ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
+ // std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
+ // RegisterDataSyncPermission(tokenCaller, permissionName, pkgName);
return SOFTBUS_OK;
}
diff --git a/core/frame/standard/init/src/softbus_server_stub.cpp b/core/frame/standard/init/src/softbus_server_stub.cpp
index dd8bf9469..fc0058ee9 100644
--- a/core/frame/standard/init/src/softbus_server_stub.cpp
+++ b/core/frame/standard/init/src/softbus_server_stub.cpp
@@ -30,80 +30,81 @@
#include "softbus_server_frame.h"
#include "trans_channel_manager.h"
#include "trans_session_manager.h"
-#include "accesstoken_kit.h"
-#include "access_token.h"
-#include "privacy_kit.h"
+// #include "accesstoken_kit.h"
+// #include "access_token.h"
+// #include "privacy_kit.h"
#include "softbus_hisysevt_transreporter.h"
-using namespace OHOS::Security::AccessToken;
+// using namespace OHOS::Security::AccessToken;
namespace OHOS {
int32_t SoftBusServerStub::CheckOpenSessionPermission(const SessionParam *param)
{
- char pkgName[PKG_NAME_SIZE_MAX] = {0};
- if ((param == NULL) ||
- (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed");
- return SOFTBUS_INVALID_PARAM;
- }
-
- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
- if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission");
- return SOFTBUS_PERMISSION_DENIED;
- }
-
- if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid");
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // char pkgName[PKG_NAME_SIZE_MAX] = {0};
+ // if ((param == NULL) ||
+ // (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed");
+ // return SOFTBUS_INVALID_PARAM;
+ // }
+
+ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
+ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
+ // if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission");
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+
+ // if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid");
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
int32_t SoftBusServerStub::CheckChannelPermission(int32_t channelId, int32_t channelType)
{
- char pkgName[PKG_NAME_SIZE_MAX] = {0};
- char sessionName[SESSION_NAME_SIZE_MAX] = {0};
- int32_t ret = SOFTBUS_OK;
- TransInfo info;
- info.channelId = channelId;
- info.channelType = channelType;
- ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX);
- if (ret != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info");
- return ret;
- }
-
- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
- if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) {
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // char pkgName[PKG_NAME_SIZE_MAX] = {0};
+ // char sessionName[SESSION_NAME_SIZE_MAX] = {0};
+ // int32_t ret = SOFTBUS_OK;
+ // TransInfo info;
+ // info.channelId = channelId;
+ // info.channelType = channelType;
+ // ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX);
+ // if (ret != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info");
+ // return ret;
+ // }
+
+ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
+ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
+ // if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
-static inline int32_t CheckAndRecordAccessToken(const char* permission)
-{
- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
- int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission);
-
- ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller);
- int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED);
- int32_t failCnt = 1 - successCnt;
- if (type == TOKEN_HAP) {
- PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt);
- }
+// static inline int32_t CheckAndRecordAccessToken(const char* permission)
+// {
+ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
+ // int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission);
+
+ // ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller);
+ // int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED);
+ // int32_t failCnt = 1 - successCnt;
+ // if (type == TOKEN_HAP) {
+ // PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt);
+ // }
- return ret;
-}
+ // return ret;
+ // return SOFTBUS_OK;
+// }
-static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode)
-{
- if (ipcCode == SERVER_OPEN_SESSION) {
- SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED);
- }
-}
+// static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode)
+// {
+// if (ipcCode == SERVER_OPEN_SESSION) {
+// SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED);
+// }
+// }
SoftBusServerStub::SoftBusServerStub()
{
@@ -205,16 +206,16 @@ int32_t SoftBusServerStub::OnRemoteRequest(uint32_t code,
return SOFTBUS_ERR;
}
- auto itPerm = memberPermissionMap_.find(code);
- if (itPerm != memberPermissionMap_.end()) {
- const char *permission = itPerm->second;
- if ((permission != nullptr) &&
- (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) {
- SoftbusReportPermissionFaultEvt(code);
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission);
- return SOFTBUS_ACCESS_TOKEN_DENIED;
- }
- }
+ // auto itPerm = memberPermissionMap_.find(code);
+ // if (itPerm != memberPermissionMap_.end()) {
+ // const char *permission = itPerm->second;
+ // if ((permission != nullptr) &&
+ // (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) {
+ // SoftbusReportPermissionFaultEvt(code);
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission);
+ // return SOFTBUS_ACCESS_TOKEN_DENIED;
+ // }
+ // }
auto itFunc = memberFuncMap_.find(code);
if (itFunc != memberFuncMap_.end()) {
--
2.33.0

View File

@ -1,37 +0,0 @@
From 4a7242c3bb1360510094ee099780e5237f8f0d53 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Fri, 2 Sep 2022 22:36:29 +0800
Subject: [PATCH 2/2] support hichian for openeuler
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
config/BUILDCONFIG.gn | 3 +++
core/gn/BUILD.gn | 1 +
2 files changed, 4 insertions(+)
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 9e016df..4cc5b41 100755
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -517,3 +517,6 @@ foreach(_target_type, target_type_list) {
}
}
}
+
+support_jsapi = false
+os_level = "standard"
diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn
index 9784cda..9c38fe4 100755
--- a/core/gn/BUILD.gn
+++ b/core/gn/BUILD.gn
@@ -90,6 +90,7 @@ if (product_name == "ohos-sdk") {
deps = [
"//foundation/communication/dsoftbus/core/frame:softbus_server_main",
"//foundation/communication/dsoftbus/sdk:softbus_client",
+ "//base/security/deviceauth/services:deviceauth_sdk",
]
}
}
--
2.25.1

View File

@ -1,82 +0,0 @@
From 1fb10c696cdde31c5fe30097cc38bbc0d054c812 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Thu, 10 Nov 2022 10:50:33 +0800
Subject: [PATCH] remove build_configs to simplify third-party tools
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
config/ohos/musl.gni | 2 +-
core/build_scripts/make_main.sh | 2 +-
core/gn/BUILD.gn | 12 ------------
ohos/notice/notice.gni | 1 -
4 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/config/ohos/musl.gni b/config/ohos/musl.gni
index f9cead9..628e93c 100644
--- a/config/ohos/musl.gni
+++ b/config/ohos/musl.gni
@@ -17,5 +17,5 @@ if (use_musl){
musl_sysroot = get_label_info(musl_target, "target_out_dir")
import("//third_party/musl/musl_config.gni")
} else {
- musl_sysroot = ""
+ musl_sysroot = getenv("STAGING_DIR_TARGET")
}
diff --git a/core/build_scripts/make_main.sh b/core/build_scripts/make_main.sh
index 770145c..e1168d8 100755
--- a/core/build_scripts/make_main.sh
+++ b/core/build_scripts/make_main.sh
@@ -78,7 +78,7 @@ do_make()
if [ "${TARGET_PLATFORM}" != "" ];then
ninja_build_args="$ninja_build_args --target-platform ${TARGET_PLATFORM}"
fi
- real_build_target=$(python ${BASE_HOME}/build/scripts/build_target_handler.py $ninja_build_args)
+ real_build_target="images"
echo "build_target: "$real_build_target
if [ "${USE_NARUTO}"x = "truex" ];then
diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn
index 9c38fe4..0dc0260 100755
--- a/core/gn/BUILD.gn
+++ b/core/gn/BUILD.gn
@@ -20,9 +20,6 @@ print("root_gen_dir=$root_gen_dir")
print("current_toolchain=$current_toolchain")
print("host_toolchain=$host_toolchain")
-# load build configs and write load result to out_build_dir/build_configs
-build_loader_script = rebase_path("//build/loader/load.py")
-
_platforms_config_file = "//out/build_configs/standard_system/platforms.build"
build_platform = ""
@@ -71,15 +68,6 @@ arguments += [
"subsystem_examples",
]
-load_result = exec_script(build_loader_script, arguments, "string")
-
-if (load_result != "") {
- print()
- print(load_result)
-}
-
-print("build configs generation is complete.")
-
# gn target defined
if (product_name == "ohos-sdk") {
group("build_ohos_sdk") {
diff --git a/ohos/notice/notice.gni b/ohos/notice/notice.gni
index db49684..566aeb4 100755
--- a/ohos/notice/notice.gni
+++ b/ohos/notice/notice.gni
@@ -14,7 +14,6 @@
import("//build/config/python.gni")
import("//build/ohos/build_var.gni")
import("//build/ohos_var.gni")
-import("${build_configs_path}/platforms_list.gni")
declare_args() {
sdk_notice_dir = "$root_build_dir/NOTICE_FILES/sdk"
--
2.25.1

View File

@ -0,0 +1,47 @@
From f22b729a9ea46420fc31fd630e7182120decd721 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 27 Jun 2023 17:11:34 +0800
Subject: [PATCH] increase the pthread stack size of x86 and other env
---
adapter/common/kernel/posix/softbus_adapter_thread.c | 3 ++-
core/common/message_handler/message_handler.c | 8 --------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/adapter/common/kernel/posix/softbus_adapter_thread.c b/adapter/common/kernel/posix/softbus_adapter_thread.c
index f6c65e856..33eeaa922 100644
--- a/adapter/common/kernel/posix/softbus_adapter_thread.c
+++ b/adapter/common/kernel/posix/softbus_adapter_thread.c
@@ -273,7 +273,8 @@ static int32_t SoftBusConfTransPthreadAttr(SoftBusThreadAttr *threadAttr, pthrea
if (stackSize != 0) {
ret = pthread_attr_setstacksize(attr, stackSize);
if (ret != 0) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, ret[%{public}d]", ret);
+ HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, stacksize[%{public}lu], ret[%{public}d]",
+ stackSize, ret);
return SOFTBUS_ERR;
}
}
diff --git a/core/common/message_handler/message_handler.c b/core/common/message_handler/message_handler.c
index d83ca3e89..12a2be117 100644
--- a/core/common/message_handler/message_handler.c
+++ b/core/common/message_handler/message_handler.c
@@ -196,15 +196,7 @@ static void *LoopTask(void *arg)
static int StartNewLooperThread(SoftBusLooper *looper)
{
-#ifdef __aarch64__
#define MAINLOOP_STACK_SIZE (2 * 1024 * 1024)
-#else
-#ifdef ASAN_BUILD
-#define MAINLOOP_STACK_SIZE 10240
-#else
-#define MAINLOOP_STACK_SIZE 8192
-#endif
-#endif
int ret;
SoftBusThreadAttr threadAttr;
SoftBusThread tid;
--
2.33.0

View File

@ -1,99 +0,0 @@
From 1e7842b01138c2313b2d8d8e736f461a9690c027 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Wed, 21 Sep 2022 11:57:27 +0800
Subject: [PATCH] Adaptation for dsoftbus
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
base/BUILD.gn | 37 ++++---------------------------------
base/src/parcel.cpp | 1 +
2 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 883b1ec..723627b 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -38,24 +38,8 @@ config("static_utils_config") {
}
sources_utils = [
- "src/string_ex.cpp",
- "src/unicode_ex.cpp",
- "src/directory_ex.cpp",
- "src/datetime_ex.cpp",
"src/refbase.cpp",
"src/parcel.cpp",
- "src/semaphore_ex.cpp",
- "src/thread_pool.cpp",
- "src/file_ex.cpp",
- "src/observer.cpp",
- "src/thread_ex.cpp",
- "src/event_demultiplexer.cpp",
- "src/event_handler.cpp",
- "src/event_reactor.cpp",
- "src/timer.cpp",
- "src/timer_event_handler.cpp",
- "src/ashmem.cpp",
- "src/rwlock.cpp",
]
securec_sources = [
@@ -110,21 +94,18 @@ ohos_static_library("utilsbase") {
]
public_configs = [ ":static_utils_config" ]
defines = [ "CONFIG_HILOG" ]
- external_deps = [ "hilog_native:libhilog_base" ]
}
ohos_shared_library("utils") {
sources = sources_utils
- sources += securec_sources
configs = [
":utils_config",
":private_securec_config",
]
public_configs = [ ":static_utils_config" ]
- subsystem_name = "utils"
defines = [ "CONFIG_HILOG" ]
- external_deps = [ "hilog_native:libhilog_base" ]
- part_name = "utils_base"
+ deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
+ deps += [ "//depend:libhilog" ]
install_images = [
"system",
"updater",
@@ -159,17 +140,7 @@ ohos_static_library("utilsecurec_ace_allplatforms") {
public_configs = [ ":static_utils_config" ]
}
-ohos_shared_library("utilsecurec_shared") {
- sources = securec_sources
- configs = [
- ":utils_config",
- ":private_securec_config",
- ]
- public_configs = [ ":utils_config" ]
- part_name = "utils_base"
- install_images = [
- "system",
- "updater",
- ]
+group("utilsecurec_shared") {
}
+
###############################################################################
diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp
index 855f7cf..1abaec5 100755
--- a/base/src/parcel.cpp
+++ b/base/src/parcel.cpp
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+#include <climits>
#include "parcel.h"
#include "securec.h"
#include "utils_log.h"
--
2.25.1

View File

@ -0,0 +1,60 @@
From 1473de8149a7e3b9921f8bb0b5067fc3f6128ba7 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Mon, 4 Sep 2023 11:16:32 +0800
Subject: [PATCH] open udp stream switch
---
adapter/default_config/feature_config/standard/config.gni | 2 +-
.../trans_channel/tcp_direct/src/trans_tcp_direct_manager.c | 2 +-
.../trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/adapter/default_config/feature_config/standard/config.gni b/adapter/default_config/feature_config/standard/config.gni
index 6602d7ed7..c9bb34f20 100644
--- a/adapter/default_config/feature_config/standard/config.gni
+++ b/adapter/default_config/feature_config/standard/config.gni
@@ -23,7 +23,7 @@ declare_args() {
dsoftbus_feature_protocol_newip = false
dsoftbus_feature_trans_udp = true
- dsoftbus_feature_trans_udp_stream = false
+ dsoftbus_feature_trans_udp_stream = true
dsoftbus_feature_trans_udp_file = true
dsoftbus_feature_ip_auth = true
diff --git a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c
index 9b73c13ae..5a9ba5e60 100644
--- a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c
+++ b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c
@@ -248,7 +248,7 @@ static int32_t TransUpdAppInfo(AppInfo *appInfo, const ConnectOption *connInfo)
int32_t TransOpenDirectChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId)
{
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "TransOpenDirectChannel");
+ SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "TransOpenDirectChannel");
if (appInfo == NULL || connInfo == NULL || channelId == NULL) {
return SOFTBUS_INVALID_PARAM;
}
diff --git a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c
index 868dfc503..89d0db256 100644
--- a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c
+++ b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c
@@ -28,7 +28,7 @@
int32_t OpenTcpDirectChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId)
{
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "OpenTcpDirectChannel");
+ SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "OpenTcpDirectChannel");
if (appInfo == NULL || connInfo == NULL || channelId == NULL) {
return SOFTBUS_INVALID_PARAM;
}
@@ -78,4 +78,4 @@ int32_t OpenTcpDirectChannel(const AppInfo *appInfo, const ConnectOption *connIn
*channelId = newchannelId;
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "OpenTcpDirectChannel end: channelId=%d", newchannelId);
return SOFTBUS_OK;
-}
\ No newline at end of file
+}
--
2.33.0

View File

@ -1,17 +0,0 @@
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -117,12 +117,13 @@ if (defined(ohos_lite)) {
ohos_shared_library("mbedtls_shared") {
public_configs = [ ":mbedtls_config" ]
output_name = "mbedtls"
- subsystem_name = "common"
+ subsystem_name = "communication"
part_name = "dsoftbus_standard"
sources = MBEDTLS_SOURCES
}
group("mbedtls") {
+ public_configs = [ ":mbedtls_config" ]
public_deps = [ ":mbedtls_shared" ]
}
}

View File

@ -1,409 +0,0 @@
From: maoyufeng <maoyufeng3@huawei.com>
Date: Mon, 23 May 2022 14:57:48 +0800
Subject: [PATCH] Fix issue CVE-2021-43666
Signed-off-by: maoyufeng <maoyufeng3@huawei.com>
---
ChangeLog.d/fix-pkcs12-null-password.txt | 5 ++
include/mbedtls/pkcs12.h | 34 ++++++----
library/pkcs12.c | 82 ++++++++++++++++++------
tests/CMakeLists.txt | 1 +
tests/scripts/all.sh | 30 +++++++++
tests/suites/test_suite_pkcs12.data | 35 ++++++++++
tests/suites/test_suite_pkcs12.function | 68 ++++++++++++++++++++
7 files changed, 223 insertions(+), 32 deletions(-)
create mode 100644 ChangeLog.d/fix-pkcs12-null-password.txt
mode change 100755 => 100644 library/pkcs12.c
create mode 100644 tests/suites/test_suite_pkcs12.data
create mode 100644 tests/suites/test_suite_pkcs12.function
diff --git a/ChangeLog.d/fix-pkcs12-null-password.txt b/ChangeLog.d/fix-pkcs12-null-password.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a6ce140fdc3479cfac671542692ab646f7c8b5f3
--- /dev/null
+++ b/ChangeLog.d/fix-pkcs12-null-password.txt
@@ -0,0 +1,5 @@
+Bugfix
+ * Fix a potential invalid pointer dereference and infinite loop bugs in
+ pkcs12 functions when the password is empty. Fix the documentation to
+ better describe the inputs to these functions and their possible values.
+ Fixes #5136.
\ No newline at end of file
diff --git a/include/mbedtls/pkcs12.h b/include/mbedtls/pkcs12.h
index 9cbcb1730559bb7d3a22a378467b9f6aa1b1c3fa..9e11e24a8d07b9e377fd49d9206fd300330bcdbf 100755
--- a/include/mbedtls/pkcs12.h
+++ b/include/mbedtls/pkcs12.h
@@ -83,8 +83,9 @@ extern "C" {
* \brief PKCS12 Password Based function (encryption / decryption)
* for pbeWithSHAAnd128BitRC4
*
- * \param pbe_params an ASN1 buffer containing the pkcs-12PbeParams structure
- * \param mode either MBEDTLS_PKCS12_PBE_ENCRYPT or MBEDTLS_PKCS12_PBE_DECRYPT
+ * \param pbe_params an ASN1 buffer containing the pkcs-12 PbeParams structure
+ * \param mode either #MBEDTLS_PKCS12_PBE_ENCRYPT or
+ * #MBEDTLS_PKCS12_PBE_DECRYPT
* \param pwd the password used (may be NULL if no password is used)
* \param pwdlen length of the password (may be 0)
* \param input the input data
@@ -105,8 +106,9 @@ int mbedtls_pkcs12_pbe_sha1_rc4_128( mbedtls_asn1_buf *pbe_params, int mode,
* \param pbe_params an ASN1 buffer containing the pkcs-12PbeParams structure
* \param mode either MBEDTLS_PKCS12_PBE_ENCRYPT or MBEDTLS_PKCS12_PBE_DECRYPT
* \param cipher_type the cipher used
- * \param md_type the mbedtls_md used
- * \param pwd the password used (may be NULL if no password is used)
+ * \param md_type the mbedtls_md used
+ * \param pwd Latin1-encoded password used. This may only be \c NULL when
+ * \p pwdlen is 0. No null terminator should be used.
* \param pwdlen length of the password (may be 0)
* \param input the input data
* \param len data length
@@ -127,18 +129,24 @@ int mbedtls_pkcs12_pbe( mbedtls_asn1_buf *pbe_params, int mode,
* to produce pseudo-random bits for a particular "purpose".
*
* Depending on the given id, this function can produce an
- * encryption/decryption key, an nitialization vector or an
+ * encryption/decryption key, an initialization vector or an
* integrity key.
*
* \param data buffer to store the derived data in
- * \param datalen length to fill
- * \param pwd password to use (may be NULL if no password is used)
- * \param pwdlen length of the password (may be 0)
- * \param salt salt buffer to use
- * \param saltlen length of the salt
- * \param mbedtls_md mbedtls_md type to use during the derivation
- * \param id id that describes the purpose (can be MBEDTLS_PKCS12_DERIVE_KEY,
- * MBEDTLS_PKCS12_DERIVE_IV or MBEDTLS_PKCS12_DERIVE_MAC_KEY)
+ * \param datalen length of buffer to fill
+ * \param pwd The password to use. For compliance with PKCS#12 §B.1, this
+ * should be a BMPString, i.e. a Unicode string where each
+ * character is encoded as 2 bytes in big-endian order, with
+ * no byte order mark and with a null terminator (i.e. the
+ * last two bytes should be 0x00 0x00).
+ * \param pwdlen length of the password (may be 0).
+ * \param salt Salt buffer to use This may only be \c NULL when
+ * \p saltlen is 0.
+ * \param saltlen length of the salt (may be zero)
+ * \param mbedtls_md mbedtls_md type to use during the derivation
+ * \param id id that describes the purpose (can be
+ * #MBEDTLS_PKCS12_DERIVE_KEY, #MBEDTLS_PKCS12_DERIVE_IV or
+ * #MBEDTLS_PKCS12_DERIVE_MAC_KEY)
* \param iterations number of iterations
*
* \return 0 if successful, or a MD, BIGNUM type error.
diff --git a/library/pkcs12.c b/library/pkcs12.c
old mode 100755
new mode 100644
index 3d23d5e354923cd01d69a479fcf572d80af540a6..05ade49e93b3d2cb8e03f7915f0ead4b79e919c4
--- a/library/pkcs12.c
+++ b/library/pkcs12.c
@@ -209,6 +209,9 @@ int mbedtls_pkcs12_pbe( mbedtls_asn1_buf *pbe_params, int mode,
mbedtls_cipher_context_t cipher_ctx;
size_t olen = 0;
+ if( pwd == NULL && pwdlen != 0 )
+ return( MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA );
+
cipher_info = mbedtls_cipher_info_from_type( cipher_type );
if( cipher_info == NULL )
return( MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE );
@@ -261,12 +264,23 @@ static void pkcs12_fill_buffer( unsigned char *data, size_t data_len,
unsigned char *p = data;
size_t use_len;
- while( data_len > 0 )
+ if( filler != NULL && fill_len != 0 )
{
- use_len = ( data_len > fill_len ) ? fill_len : data_len;
- memcpy( p, filler, use_len );
- p += use_len;
- data_len -= use_len;
+ while( data_len > 0 )
+ {
+ use_len = ( data_len > fill_len ) ? fill_len : data_len;
+ memcpy( p, filler, use_len );
+ p += use_len;
+ data_len -= use_len;
+ }
+ }
+ else
+ {
+ /* If either of the above are not true then clearly there is nothing
+ * that this function can do. The function should *not* be called
+ * under either of those circumstances, as you could end up with an
+ * incorrect output but for safety's sake, leaving the check in as
+ * otherwise we could end up with memory corruption.*/
}
}
@@ -283,6 +297,8 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
unsigned char hash_output[MBEDTLS_MD_MAX_SIZE];
unsigned char *p;
unsigned char c;
+ int use_password = 0;
+ int use_salt = 0;
size_t hlen, use_len, v, i;
@@ -293,6 +309,15 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
if( datalen > 128 || pwdlen > 64 || saltlen > 64 )
return( MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA );
+ if( pwd == NULL && pwdlen != 0 )
+ return( MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA );
+
+ if( salt == NULL && saltlen != 0 )
+ return( MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA );
+
+ use_password = ( pwd && pwdlen != 0 );
+ use_salt = ( salt && saltlen != 0 );
+
md_info = mbedtls_md_info_from_type( md_type );
if( md_info == NULL )
return( MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE );
@@ -310,8 +335,15 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
memset( diversifier, (unsigned char) id, v );
- pkcs12_fill_buffer( salt_block, v, salt, saltlen );
- pkcs12_fill_buffer( pwd_block, v, pwd, pwdlen );
+ if( use_salt != 0 )
+ {
+ pkcs12_fill_buffer( salt_block, v, salt, saltlen );
+ }
+
+ if( use_password != 0 )
+ {
+ pkcs12_fill_buffer( pwd_block, v, pwd, pwdlen );
+ }
p = data;
while( datalen > 0 )
@@ -323,11 +355,17 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
if( ( ret = mbedtls_md_update( &md_ctx, diversifier, v ) ) != 0 )
goto exit;
- if( ( ret = mbedtls_md_update( &md_ctx, salt_block, v ) ) != 0 )
- goto exit;
+ if( use_salt != 0 )
+ {
+ if( ( ret = mbedtls_md_update( &md_ctx, salt_block, v )) != 0 )
+ goto exit;
+ }
- if( ( ret = mbedtls_md_update( &md_ctx, pwd_block, v ) ) != 0 )
- goto exit;
+ if( use_password != 0)
+ {
+ if( ( ret = mbedtls_md_update( &md_ctx, pwd_block, v )) != 0 )
+ goto exit;
+ }
if( ( ret = mbedtls_md_finish( &md_ctx, hash_output ) ) != 0 )
goto exit;
@@ -355,22 +393,28 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
if( ++hash_block[i - 1] != 0 )
break;
- // salt_block += B
- c = 0;
- for( i = v; i > 0; i-- )
+ if( use_salt != 0 )
{
- j = salt_block[i - 1] + hash_block[i - 1] + c;
+ // salt_block += B
+ c = 0;
+ for( i = v; i > 0; i-- )
+ {
+ j = salt_block[i - 1] + hash_block[i - 1] + c;
c = (unsigned char) (j >> 8);
salt_block[i - 1] = j & 0xFF;
+ }
}
- // pwd_block += B
- c = 0;
- for( i = v; i > 0; i-- )
+ if( use_password != 0 )
{
- j = pwd_block[i - 1] + hash_block[i - 1] + c;
+ // pwd_block += B
+ c = 0;
+ for( i = v; i > 0; i-- )
+ {
+ j = pwd_block[i - 1] + hash_block[i - 1] + c;
c = (unsigned char) (j >> 8);
pwd_block[i - 1] = j & 0xFF;
+ }
}
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a8e7523e504bc5cff9925648dd1b3bd7fb55f0cf..c5d484f924328bde2d2525b6f89e125974c3b770 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -120,6 +120,7 @@ add_test_suite(pem)
add_test_suite(pkcs1_v15)
add_test_suite(pkcs1_v21)
add_test_suite(pkcs5)
+add_test_suite(pkcs12)
add_test_suite(pk)
add_test_suite(pkparse)
add_test_suite(pkwrite)
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index 1a4de44b665f8df822adbd83bece912119bca98f..00222f379e808d8662967fdf200e18739cbabe61 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -1683,6 +1683,36 @@ component_test_valgrind () {
fi
}
+support_test_cmake_out_of_source () {
+ distrib_id=""
+ distrib_ver=""
+ distrib_ver_minor=""
+ distrib_ver_major=""
+
+ # Attempt to parse lsb-release to find out distribution and version. If not
+ # found this should fail safe (test is supported).
+ if [[ -f /etc/lsb-release ]]; then
+
+ while read -r lsb_line; do
+ case "$lsb_line" in
+ "DISTRIB_ID"*) distrib_id=${lsb_line/#DISTRIB_ID=};;
+ "DISTRIB_RELEASE"*) distrib_ver=${lsb_line/#DISTRIB_RELEASE=};;
+ esac
+ done < /etc/lsb-release
+
+ distrib_ver_major="${distrib_ver%%.*}"
+ distrib_ver="${distrib_ver#*.}"
+ distrib_ver_minor="${distrib_ver%%.*}"
+ fi
+
+ # Running the out of source CMake test on Ubuntu 16.04 using more than one
+ # processor (as the CI does) can create a race condition whereby the build
+ # fails to see a generated file, despite that file actually having been
+ # generated. This problem appears to go away with 18.04 or newer, so make
+ # the out of source tests unsupported on Ubuntu 16.04.
+ [ "$distrib_id" != "Ubuntu" ] || [ "$distrib_ver_major" -gt 16 ]
+}
+
component_test_cmake_out_of_source () {
msg "build: cmake 'out-of-source' build"
MBEDTLS_ROOT_DIR="$PWD"
diff --git a/tests/suites/test_suite_pkcs12.data b/tests/suites/test_suite_pkcs12.data
new file mode 100644
index 0000000000000000000000000000000000000000..bda7d9921caad35c1835e0093df8a9644d4bd9cb
--- /dev/null
+++ b/tests/suites/test_suite_pkcs12.data
@@ -0,0 +1,35 @@
+PKCS#12 derive key : MD5: Zero length password and hash
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_GIVEN_INPUT:"":USE_GIVEN_INPUT:3:"6afdcbd5ebf943272134f1c3de2dc11b6afdcbd5ebf943272134f1c3de2dc11b6afdcbd5ebf943272134f1c3de2dc11b":0
+
+PKCS#12 derive key: MD5: NULL password and hash
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_NULL_INPUT:"":USE_NULL_INPUT:3:"6afdcbd5ebf943272134f1c3de2dc11b6afdcbd5ebf943272134f1c3de2dc11b6afdcbd5ebf943272134f1c3de2dc11b":0
+
+PKCS#12 derive key: MD5: Zero length password
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_GIVEN_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:"832d8502114fcccfd3de0c2b2863b1c45fb92a8db2ed1e704727b324adc267bdd66ae4918a81fa2d1ba15febfb9e6c4e":0
+
+PKCS#12 derive key: MD5: NULL password
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_NULL_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:"832d8502114fcccfd3de0c2b2863b1c45fb92a8db2ed1e704727b324adc267bdd66ae4918a81fa2d1ba15febfb9e6c4e":0
+
+PKCS#12 derive key: MD5: Invalid length NULL password
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_NULL_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:"":MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
+
+PKCS#12 derive key: MD5: Zero length salt
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"":USE_GIVEN_INPUT:3:"832d8502114fcccfd3de0c2b2863b1c45fb92a8db2ed1e704727b324adc267bdd66ae4918a81fa2d1ba15febfb9e6c4e":0
+
+PKCS#12 derive key: MD5: NULL salt
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"":USE_NULL_INPUT:3:"832d8502114fcccfd3de0c2b2863b1c45fb92a8db2ed1e704727b324adc267bdd66ae4918a81fa2d1ba15febfb9e6c4e":0
+
+PKCS#12 derive key: MD5: Invalid length NULL salt
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"0123456789abcdef":USE_NULL_INPUT:3:"":MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
+
+PKCS#12 derive key: MD5: Valid password and salt
+depends_on:MBEDTLS_MD5_C
+pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:"46559deeee036836ab1b633ec620178d4c70eacf42f72a2ad7360c812efa09ca3d7567b489a109050345c2dc6a262995":0
diff --git a/tests/suites/test_suite_pkcs12.function b/tests/suites/test_suite_pkcs12.function
new file mode 100644
index 0000000000000000000000000000000000000000..56b896c8253b5d9734d27b0bd7cd315b3cbc7ee7
--- /dev/null
+++ b/tests/suites/test_suite_pkcs12.function
@@ -0,0 +1,68 @@
+/* BEGIN_HEADER */
+#include "mbedtls/pkcs12.h"
+
+typedef enum
+{
+ USE_NULL_INPUT = 0,
+ USE_GIVEN_INPUT = 1,
+} input_usage_method_t;
+
+/* END_HEADER */
+
+/* BEGIN_DEPENDENCIES
+ * depends_on:MBEDTLS_PKCS12_C
+ * END_DEPENDENCIES
+ */
+
+/* BEGIN_CASE */
+void pkcs12_derive_key( int md_type, int key_size_arg,
+ data_t *password_arg, int password_usage,
+ data_t *salt_arg, int salt_usage,
+ int iterations,
+ data_t* expected_output, int expected_status )
+
+{
+ int ret = 0;
+ unsigned char *output_data = NULL;
+
+ unsigned char *password = NULL;
+ size_t password_len = 0;
+ unsigned char *salt = NULL;
+ size_t salt_len = 0;
+ size_t key_size = key_size_arg;
+
+ if( password_usage == USE_GIVEN_INPUT )
+ password = password_arg->x;
+
+ password_len = password_arg->len;
+
+ if( salt_usage == USE_GIVEN_INPUT )
+ salt = salt_arg->x;
+
+ salt_len = salt_arg->len;
+
+ ASSERT_ALLOC( output_data, key_size );
+
+ ret = mbedtls_pkcs12_derivation( output_data,
+ key_size,
+ password,
+ password_len,
+ salt,
+ salt_len,
+ md_type,
+ MBEDTLS_PKCS12_DERIVE_KEY,
+ iterations );
+
+ TEST_EQUAL( ret, expected_status );
+
+ if( expected_status == 0 )
+ {
+ ASSERT_COMPARE( expected_output->x, expected_output->len,
+ output_data, key_size );
+ }
+
+exit:
+ mbedtls_free( output_data );
+
+}
+/* END_CASE */
\ No newline at end of file

View File

@ -1,24 +0,0 @@
From: =?UTF-8?q?=E6=AF=9B=E5=AE=87=E9=94=8B?= <maoyufeng3@huawei.com>
Date: Mon, 18 Jul 2022 02:20:45 +0000
Subject: [PATCH] [session] fix a session copy bug fix a possible double
reference on 'ticket' when peer_cert/peer_cert_digest calloc failed.
Cherry-pick from
https://github.com/Mbed-TLS/mbedtls/commit/eb490aabf6a9f47c074ec476d0d4997c2362cdbc
Signed-off-by: maoyufeng <maoyufeng3@huawei.com>
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 3c1e9175981c4c0d175af94914e4c8ebb4558fc9..962d6254353e92b8422842362f603228850184b7 100755
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -301,6 +301,10 @@ static int ssl_session_copy( mbedtls_ssl_session *dst, const mbedtls_ssl_session
mbedtls_ssl_session_free( dst );
memcpy( dst, src, sizeof( mbedtls_ssl_session ) );
+#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
+ dst->ticket = NULL;
+#endif
+
#if defined(MBEDTLS_X509_CRT_PARSE_C)
if( src->peer_cert != NULL )
{

View File

@ -1,236 +0,0 @@
From c7fe7e1422af2a0b4fdbd7e514f8b8c6054170e8 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxunn@huawei.com>
Date: Tue, 19 Jul 2022 21:01:41 +0800
Subject: [PATCH] support huks for openeuler
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
frameworks/huks_standard/main/BUILD.gn | 1 +
.../huks_standard/main/core/src/hks_verifier.c | 10 ++++++----
.../crypto_engine/openssl/src/hks_openssl_kdf.c | 4 +++-
.../huks_standard/main/os_dependency/BUILD.gn | 15 ++++++++++-----
.../main/os_dependency/log/hks_log.c | 14 +++++++-------
interfaces/innerkits/huks_standard/main/BUILD.gn | 1 +
.../huks_service/main/os_dependency/BUILD.gn | 2 +-
.../huks_service/main/os_dependency/idl/BUILD.gn | 6 +++---
utils/file_operator/hks_file_operator.c | 6 +++---
9 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/frameworks/huks_standard/main/BUILD.gn b/frameworks/huks_standard/main/BUILD.gn
index 83d7750..cd899cd 100755
--- a/frameworks/huks_standard/main/BUILD.gn
+++ b/frameworks/huks_standard/main/BUILD.gn
@@ -20,6 +20,7 @@ group("huks_standard_frameworks") {
"//base/security/huks/frameworks/huks_standard/main/core:libhuks_core_standard_static",
"//base/security/huks/frameworks/huks_standard/main/crypto_engine:libhuks_crypto_engine_standard_static",
"//base/security/huks/frameworks/huks_standard/main/os_dependency:libhuks_os_dependency_standard_static",
+ "//base/security/huks/services/huks_standard/huks_service/main/os_dependency:libhuks_service_os_dependency_standard_static",
]
}
}
diff --git a/frameworks/huks_standard/main/core/src/hks_verifier.c b/frameworks/huks_standard/main/core/src/hks_verifier.c
index 149137d..a65f27e 100755
--- a/frameworks/huks_standard/main/core/src/hks_verifier.c
+++ b/frameworks/huks_standard/main/core/src/hks_verifier.c
@@ -250,8 +250,9 @@ static int32_t ExtractTlvLength(const uint8_t *in, uint32_t inLen, uint32_t *hea
uint8_t *buf = (uint8_t *)in;
uint32_t length = 0; /* length of the payload */
- uint32_t tmp;
- HKS_ASN1_DECODE_BYTE(buf, tmp); /* get type */
+// uint32_t tmp;
+// HKS_ASN1_DECODE_BYTE(buf, tmp); /* get type */
+ buf++;
if (buf[0] < ASN_1_MIN_VAL_1_EXTRA_LEN_BYTE) {
/* Current byte tells the length */
HKS_ASN1_DECODE_BYTE(buf, length);
@@ -301,8 +302,9 @@ static int32_t ExtractTlvData(const uint8_t *in, uint32_t inLen, uint8_t *out, u
uint8_t *buf = (uint8_t *)in;
uint32_t length = 0; /* length of the payload */
- uint32_t tmp;
- HKS_ASN1_DECODE_BYTE(buf, tmp); /* get type */
+// uint32_t tmp;
+// HKS_ASN1_DECODE_BYTE(buf, tmp); /* get type */
+ buf++;
if (buf[0] < ASN_1_MIN_VAL_1_EXTRA_LEN_BYTE) {
/* Current byte tells the length */
HKS_ASN1_DECODE_BYTE(buf, length);
diff --git a/frameworks/huks_standard/main/crypto_engine/openssl/src/hks_openssl_kdf.c b/frameworks/huks_standard/main/crypto_engine/openssl/src/hks_openssl_kdf.c
index 258b206..5db3e4d 100755
--- a/frameworks/huks_standard/main/crypto_engine/openssl/src/hks_openssl_kdf.c
+++ b/frameworks/huks_standard/main/crypto_engine/openssl/src/hks_openssl_kdf.c
@@ -57,6 +57,7 @@ int32_t HksOpensslHkdf(const struct HksBlob *mainKey, const struct HksKeySpec *d
EVP_PKEY_CTX *pctx;
pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
int32_t ret = HKS_FAILURE;
+
do {
if (EVP_PKEY_derive_init(pctx) <= 0) {
HksLogOpensslError();
@@ -78,7 +79,8 @@ int32_t HksOpensslHkdf(const struct HksBlob *mainKey, const struct HksKeySpec *d
HksLogOpensslError();
break;
}
- if (EVP_PKEY_derive(pctx, derivedKey->data, (size_t *)&derivedKey->size) <= 0) {
+ size_t new = derivedKey->size;
+ if (EVP_PKEY_derive(pctx, derivedKey->data, &new) <= 0) {
HksLogOpensslError();
break;
}
diff --git a/frameworks/huks_standard/main/os_dependency/BUILD.gn b/frameworks/huks_standard/main/os_dependency/BUILD.gn
index 7d03e55..6da94a5 100755
--- a/frameworks/huks_standard/main/os_dependency/BUILD.gn
+++ b/frameworks/huks_standard/main/os_dependency/BUILD.gn
@@ -26,6 +26,8 @@ ohos_static_library("libhuks_os_dependency_standard_static") {
public_configs = [ ":huks_config" ]
include_dirs = [
"log",
+ "sysinfo/include",
+ "../../../../services/huks_standard/huks_service/main/core/include/",
"//utils/native/base/include",
"//utils/system/safwk/native/include",
]
@@ -35,17 +37,20 @@ ohos_static_library("libhuks_os_dependency_standard_static") {
"_HUKS_LOG_ENABLE_",
]
sources = [
- "./ipc/src/hks_client_service_ipc.c",
- "./ipc/src/hks_ipc_check.c",
- "./ipc/src/hks_ipc_serialization.c",
- "./ipc/src/hks_ipc_slice.c",
- "./ipc/src/hks_request.cpp",
+# "./ipc/src/hks_client_service_ipc.c",
+# "./ipc/src/hks_ipc_check.c",
+# "./ipc/src/hks_ipc_serialization.c",
+# "./ipc/src/hks_ipc_slice.c",
+# "./ipc/src/hks_request.cpp",
+ "./ipc/src/hks_client_service_passthrough.c",
+ "./sysinfo/src/hks_get_process_info_passthrough.c",
"./log/hks_log.c",
"./posix/hks_mem.c",
]
deps = [
"//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static",
"//utils/native/base:utils",
+ "//third_party/bounds_checking_function:libsec_shared",
]
external_deps = [
"hiviewdfx_hilog_native:libhilog",
diff --git a/frameworks/huks_standard/main/os_dependency/log/hks_log.c b/frameworks/huks_standard/main/os_dependency/log/hks_log.c
index ef7d264..5beadab 100755
--- a/frameworks/huks_standard/main/os_dependency/log/hks_log.c
+++ b/frameworks/huks_standard/main/os_dependency/log/hks_log.c
@@ -22,8 +22,8 @@
#undef LOG_DOMAIN
#undef LOG_TAG
-static const unsigned int LOG_DOMAIN = 0xD002F01;
-static const char* LOG_TAG = "HUKS";
+//static const unsigned int LOG_DOMAIN = 0xD002F01;
+//static const char* LOG_TAG = "HUKS";
#define MAX_LOG_BUFF_LEN 512
@@ -48,16 +48,16 @@ void HksLog(uint32_t logLevel, const char *funcName, uint32_t lineNo, const char
switch (logLevel) {
case HKS_LOG_LEVEL_I:
- HILOG_INFO(LOG_CORE, "%{public}s[%{public}u]: %{public}s\n", funcName, lineNo, buf);
+ HILOG_INFO(LOG_CORE, "%s[%u]: %s\n", funcName, lineNo, buf);
break;
case HKS_LOG_LEVEL_E:
- HILOG_ERROR(LOG_CORE, "%{public}s[%{public}u]: %{public}s\n", funcName, lineNo, buf);
+ HILOG_ERROR(LOG_CORE, "%s[%u]: %s\n", funcName, lineNo, buf);
break;
case HKS_LOG_LEVEL_W:
- HILOG_WARN(LOG_CORE, "%{public}s[%{public}u]: %{public}s\n", funcName, lineNo, buf);
+ HILOG_WARN(LOG_CORE, "%s[%u]: %s\n", funcName, lineNo, buf);
break;
case HKS_LOG_LEVEL_D:
- HILOG_DEBUG(LOG_CORE, "%{public}s[%{public}u]: %{private}s\n", funcName, lineNo, buf);
+ HILOG_DEBUG(LOG_CORE, "%s[%u]: %s\n", funcName, lineNo, buf);
break;
default:
HKS_FREE_PTR(buf);
@@ -65,4 +65,4 @@ void HksLog(uint32_t logLevel, const char *funcName, uint32_t lineNo, const char
}
HKS_FREE_PTR(buf);
-}
\ No newline at end of file
+}
diff --git a/interfaces/innerkits/huks_standard/main/BUILD.gn b/interfaces/innerkits/huks_standard/main/BUILD.gn
index 1ca1e02..88e620d 100755
--- a/interfaces/innerkits/huks_standard/main/BUILD.gn
+++ b/interfaces/innerkits/huks_standard/main/BUILD.gn
@@ -41,6 +41,7 @@ if (os_level == "standard") {
deps = [
"//base/security/huks/frameworks/huks_standard/main:huks_standard_frameworks",
"//base/security/huks/utils/crypto_adapter:libhuks_utils_client_service_adapter_static",
+ "//base/security/huks/services/huks_standard/huks_engine/main/core:huks_engine_core_standard",
]
}
}
diff --git a/services/huks_standard/huks_service/main/os_dependency/BUILD.gn b/services/huks_standard/huks_service/main/os_dependency/BUILD.gn
index 931d20c..01078b7 100755
--- a/services/huks_standard/huks_service/main/os_dependency/BUILD.gn
+++ b/services/huks_standard/huks_service/main/os_dependency/BUILD.gn
@@ -34,7 +34,7 @@ ohos_static_library("libhuks_service_os_dependency_standard_static") {
]
sources = [
"posix/hks_rwlock.c",
- "sa/hks_sa.cpp",
+# "sa/hks_sa.cpp",
]
deps = [
"//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static",
diff --git a/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn b/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn
index e86a491..3ffcfa1 100755
--- a/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn
+++ b/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn
@@ -32,9 +32,9 @@ ohos_static_library("libhuks_service_idl_standard_static") {
"_HUKS_LOG_ENABLE_",
]
sources = [
- "ipc/hks_ipc_serialization.c",
- "ipc/hks_ipc_service.c",
- "ipc/hks_response.cpp",
+# "ipc/hks_ipc_serialization.c",
+# "ipc/hks_ipc_service.c",
+# "ipc/hks_response.cpp",
"passthrough/huks_access.c",
"passthrough/huks_core_dynamic_hal.c",
]
diff --git a/utils/file_operator/hks_file_operator.c b/utils/file_operator/hks_file_operator.c
index 5543c38..5c2e704 100755
--- a/utils/file_operator/hks_file_operator.c
+++ b/utils/file_operator/hks_file_operator.c
@@ -93,7 +93,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui
}
char filePath[PATH_MAX + 1] = {0};
- (void)realpath(fileName, filePath);
+ char *path __attribute__((unused)) = realpath(fileName, filePath);
if (strstr(filePath, "../") != NULL) {
HKS_LOG_E("invalid filePath, path %s", filePath);
return 0;
@@ -137,7 +137,7 @@ static int32_t FileWrite(const char *fileName, uint32_t offset, const uint8_t *b
if (memcpy_s(filePath, sizeof(filePath) - 1, fileName, strlen(fileName)) != EOK) {
return HKS_ERROR_BAD_STATE;
}
- (void)realpath(fileName, filePath);
+ char *path __attribute__((unused)) = realpath(fileName, filePath);
if (strstr(filePath, "../") != NULL) {
HKS_LOG_E("invalid filePath, path %s", filePath);
return HKS_ERROR_INVALID_KEY_FILE;
@@ -519,4 +519,4 @@ uint32_t HksFileSize(const char *path, const char *fileName)
int32_t HksGetFileName(const char *path, const char *fileName, char *fullFileName, uint32_t fullFileNameLen)
{
return GetFileName(path, fileName, fullFileName, fullFileNameLen);
-}
\ No newline at end of file
+}
--
2.25.1

View File

@ -1,103 +0,0 @@
From 6a4234339518e8be293aacee4aeef6aaa38d7e69 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Wed, 14 Sep 2022 00:12:20 +0800
Subject: [PATCH] support deviceauth for openeuler
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
deps_adapter/BUILD.gn | 3 ++-
deps_adapter/os_adapter/interfaces/linux/hc_log.h | 8 ++++----
services/BUILD.gn | 2 +-
.../src/permission_adapter/permission_adapter.cpp | 11 +++++++----
4 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/deps_adapter/BUILD.gn b/deps_adapter/BUILD.gn
index 28df2d9..906b8ca 100644
--- a/deps_adapter/BUILD.gn
+++ b/deps_adapter/BUILD.gn
@@ -118,10 +118,11 @@ if (defined(ohos_lite)) {
cflags = [ "-DHILOG_ENABLE" ]
deps = [
"//base/security/huks/interfaces/innerkits/huks_standard/main:libhukssdk",
- "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara",
+ "//depend:syspara",
"//third_party/cJSON:cjson_static",
"//third_party/openssl:libcrypto_static",
"//utils/native/base:utils",
+ "//third_party/bounds_checking_function:libsec_shared",
]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
}
diff --git a/deps_adapter/os_adapter/interfaces/linux/hc_log.h b/deps_adapter/os_adapter/interfaces/linux/hc_log.h
index 7cfd649..f881d1e 100644
--- a/deps_adapter/os_adapter/interfaces/linux/hc_log.h
+++ b/deps_adapter/os_adapter/interfaces/linux/hc_log.h
@@ -44,10 +44,10 @@ void DevAuthLogPrint(DevAuthLogLevel level, const char *funName, const char *fmt
#define LOGW(fmt, ...) (DevAuthLogPrint(DEV_AUTH_LOG_LEVEL_WARN, __FUNCTION__, fmt, ##__VA_ARGS__))
#define LOGE(fmt, ...) (DevAuthLogPrint(DEV_AUTH_LOG_LEVEL_ERROR, __FUNCTION__, fmt, ##__VA_ARGS__))
-#define DEV_AUTH_LOG_DEBUG(buf) HiLogPrint(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
-#define DEV_AUTH_LOG_INFO(buf) HiLogPrint(LOG_CORE, LOG_INFO, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
-#define DEV_AUTH_LOG_WARN(buf) HiLogPrint(LOG_CORE, LOG_WARN, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
-#define DEV_AUTH_LOG_ERROR(buf) HiLogPrint(LOG_CORE, LOG_ERROR, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
+#define DEV_AUTH_LOG_DEBUG(buf) HiLogPrint(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
+#define DEV_AUTH_LOG_INFO(buf) HiLogPrint(LOG_CORE, LOG_INFO, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
+#define DEV_AUTH_LOG_WARN(buf) HiLogPrint(LOG_CORE, LOG_WARN, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
+#define DEV_AUTH_LOG_ERROR(buf) HiLogPrint(LOG_CORE, LOG_ERROR, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
#else
diff --git a/services/BUILD.gn b/services/BUILD.gn
index bb15b89..b2cdb17 100644
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -159,10 +159,10 @@ if (defined(ohos_lite)) {
"${deps_adapter_path}:${hal_module_name}",
"//third_party/cJSON:cjson_static",
"//utils/native/base:utils",
+ "//foundation/communication/dsoftbus/sdk:softbus_client"
]
external_deps = [
- "dsoftbus_standard:softbus_client",
"hiviewdfx_hilog_native:libhilog",
]
if (support_jsapi) {
diff --git a/services/frameworks/src/permission_adapter/permission_adapter.cpp b/services/frameworks/src/permission_adapter/permission_adapter.cpp
index dcdb912..6f4f8a3 100644
--- a/services/frameworks/src/permission_adapter/permission_adapter.cpp
+++ b/services/frameworks/src/permission_adapter/permission_adapter.cpp
@@ -15,17 +15,18 @@
#include "permission_adapter.h"
-#include "accesstoken_kit.h"
+//#include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "device_auth_defines.h"
#include "hc_log.h"
-using namespace OHOS;
-using namespace OHOS::Security::AccessToken;
+//using namespace OHOS;
+//using namespace OHOS::Security::AccessToken;
int32_t CheckPermission(void)
{
+#if 0
AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID();
ATokenTypeEnum tokenType = AccessTokenKit::GetTokenType(tokenId);
if (tokenType == TOKEN_NATIVE) {
@@ -45,4 +46,6 @@ int32_t CheckPermission(void)
LOGE("Invalid token type: %d", tokenType);
return HC_ERROR;
}
-}
\ No newline at end of file
+#endif
+ return HC_SUCCESS;
+}
--
2.25.1

View File

@ -1,276 +0,0 @@
From 31f1a71fee10a1248de00ea1f36eeaf80e683673 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Fri, 16 Sep 2022 01:11:40 +0800
Subject: [PATCH] adapter deviceauth ipc service
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
frameworks/inc/ipc_service.h | 2 ++
frameworks/src/ipc_service.c | 16 +-----------
frameworks/src/standard/ipc_adapt.cpp | 18 +++++++------
.../src/standard/ipc_dev_auth_proxy.cpp | 25 ++++---------------
frameworks/src/standard/ipc_dev_auth_stub.cpp | 7 +-----
services/BUILD.gn | 15 ++++++++++-
services/device_auth.c | 6 +++++
7 files changed, 39 insertions(+), 50 deletions(-)
diff --git a/frameworks/inc/ipc_service.h b/frameworks/inc/ipc_service.h
index e3eb11b..ed73555 100755
--- a/frameworks/inc/ipc_service.h
+++ b/frameworks/inc/ipc_service.h
@@ -20,6 +20,8 @@
extern "C" {
#endif
+int DeviceAuthIpcInit();
+
#ifdef __cplusplus
}
#endif
diff --git a/frameworks/src/ipc_service.c b/frameworks/src/ipc_service.c
index afc21fc..3db6bb5 100644
--- a/frameworks/src/ipc_service.c
+++ b/frameworks/src/ipc_service.c
@@ -1038,20 +1038,10 @@ int32_t MainRescInit(void)
return HC_SUCCESS;
}
-int32_t main(int32_t argc, char const *argv[])
+int DeviceAuthIpcInit()
{
uintptr_t serviceCtx = 0x0;
int32_t ret;
- HcCondition cond;
-
- (void)argc;
- (void)argv;
- LOGI("device authentication service starting ...");
- ret = InitDeviceAuthService();
- if (ret != HC_SUCCESS) {
- LOGE("device auth service main, InitDeviceAuthService failed, ret %d", ret);
- return 1;
- }
ret = MainRescInit();
if (ret != HC_SUCCESS) {
@@ -1070,10 +1060,6 @@ int32_t main(int32_t argc, char const *argv[])
}
(void)AddMethodMap(serviceCtx);
LOGI("device authentication service register to IPC manager done, service running...");
- (void)memset_s(&cond, sizeof(cond), 0, sizeof(cond));
- InitHcCond(&cond, NULL);
- cond.wait(&cond);
- DestroyHcCond(&cond);
return 0;
}
diff --git a/frameworks/src/standard/ipc_adapt.cpp b/frameworks/src/standard/ipc_adapt.cpp
index 3dd4ec8..3910726 100644
--- a/frameworks/src/standard/ipc_adapt.cpp
+++ b/frameworks/src/standard/ipc_adapt.cpp
@@ -23,12 +23,14 @@
#include "ipc_dev_auth_stub.h"
#include "ipc_sdk.h"
#include "ipc_service.h"
-#include "iservice_registry.h"
#include "securec.h"
#include "system_ability_definition.h"
+#include "ipc_center.h"
+
using namespace std;
using namespace OHOS;
+static IpcCenter *g_deviceIpc = nullptr;
namespace {
static const int32_t BUFF_MAX_SZ = 128;
static const int32_t IPC_CALL_BACK_MAX_NODES = 64;
@@ -1335,19 +1337,19 @@ void DestroyServiceInstance(uintptr_t *ipcInstance)
int32_t AddDevAuthServiceToManager(uintptr_t *serviceCtx)
{
- int32_t ret = ERR_OK;
+ int32_t ret = HC_SUCCESS;
ServiceDevAuth *sPtr = nullptr;
- sptr<ISystemAbilityManager> sysMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
- if (sysMgr == nullptr) {
- return HC_ERR_IPC_GET_SERVICE;
- }
sPtr = new(std::nothrow) ServiceDevAuth();
if (sPtr == nullptr) {
return HC_ERR_ALLOC_MEMORY;
}
- ret = sysMgr->AddSystemAbility(DEVICE_AUTH_SERVICE_ID, sPtr);
- if (ret != ERR_OK) {
+ sPtr->isDSoftBusObj = false;
+ if (!g_deviceIpc->Init(true, static_cast<IPCObjectStub*>(sPtr))) {
+ LOGE("deviceIpc init failed");
+ }
+ ret = IPCSkeleton::SetDeviceAuthObj(sPtr);
+ if (ret != true) {
LOGE("add service failed");
delete sPtr;
return HC_ERROR;
diff --git a/frameworks/src/standard/ipc_dev_auth_proxy.cpp b/frameworks/src/standard/ipc_dev_auth_proxy.cpp
index bc3abeb..c493f7a 100644
--- a/frameworks/src/standard/ipc_dev_auth_proxy.cpp
+++ b/frameworks/src/standard/ipc_dev_auth_proxy.cpp
@@ -19,9 +19,9 @@
#include "hc_log.h"
#include "ipc_adapt.h"
#include "ipc_sdk.h"
-#include "iservice_registry.h"
#include "system_ability_definition.h"
+
namespace OHOS {
ProxyDevAuth::ProxyDevAuth(const sptr<IRemoteObject> &impl) : IRemoteProxy<IMethodsIpcCall>(impl)
{}
@@ -33,7 +33,7 @@ int32_t ProxyDevAuth::DoCallRequest(MessageParcel &dataParcel, MessageParcel &re
{
int32_t ret;
sptr<IRemoteObject> remote = nullptr;
- MessageOption option = { MessageOption::TF_SYNC };
+ MessageOption option;
LOGI("ProxyDevAuth, SendRequest...");
remote = Remote();
@@ -42,9 +42,6 @@ int32_t ProxyDevAuth::DoCallRequest(MessageParcel &dataParcel, MessageParcel &re
return HC_ERR_IPC_INTERNAL_FAILED;
}
- if (withSync == false) {
- option = { MessageOption::TF_ASYNC };
- }
ret = remote->SendRequest(DEV_AUTH_CALL_REQUEST, dataParcel, replyParcel, option);
LOGI("SendRequest done, ret %d", ret);
(ret == ERR_NONE) ? replyParcel.ReadInt32(ret) : (ret = HC_ERR_IPC_INTERNAL_FAILED);
@@ -53,15 +50,8 @@ int32_t ProxyDevAuth::DoCallRequest(MessageParcel &dataParcel, MessageParcel &re
bool ProxyDevAuth::ServiceRunning(void)
{
- auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
- if (saMgr == nullptr) {
- return false;
- }
- auto daSa = saMgr->GetSystemAbility(DEVICE_AUTH_SERVICE_ID);
- if (daSa == nullptr) {
- return false;
- }
- return true;
+ auto daSa = IPCSkeleton::GetDeviceAuthObj();
+ return daSa != nullptr;
}
int32_t ProxyDevAuthData::EncodeCallRequest(int32_t type, const uint8_t *param, int32_t paramSz)
@@ -117,12 +107,7 @@ int32_t ProxyDevAuthData::FinalCallRequest(int32_t methodId)
sptr<ProxyDevAuth> ProxyDevAuthData::GetProxy() const
{
- auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
- if (saMgr == nullptr) {
- LOGE("GetSystemAbilityManager failed");
- return nullptr;
- }
- auto daSa = saMgr->GetSystemAbility(DEVICE_AUTH_SERVICE_ID);
+ auto daSa = IPCSkeleton::GetDeviceAuthObj();
if (daSa == nullptr) {
LOGE("GetSystemAbility failed");
return nullptr;
diff --git a/frameworks/src/standard/ipc_dev_auth_stub.cpp b/frameworks/src/standard/ipc_dev_auth_stub.cpp
index e33b770..648bc3b 100644
--- a/frameworks/src/standard/ipc_dev_auth_stub.cpp
+++ b/frameworks/src/standard/ipc_dev_auth_stub.cpp
@@ -286,12 +286,7 @@ void ServiceDevAuth::ActCallback(int32_t objIdx, int32_t callbackId, bool sync,
LOGW("nothing to do, callback id %d, remote object id %d", callbackId, objIdx);
return;
}
- MessageOption option(MessageOption::TF_SYNC);
- option.SetWaitTime(DEV_AUTH_CALL_WAIT_TIME);
- if (!sync) {
- option.SetFlags(MessageOption::TF_ASYNC);
- option.SetWaitTime(0);
- }
+ MessageOption option;
std::lock_guard<std::mutex> autoLock(g_cBMutex);
sptr<ICommIpcCallback> proxy = iface_cast<ICommIpcCallback>(g_cbStub[objIdx].cbStub);
proxy->DoCallBack(callbackId, cbHook, dataParcel, reply, option);
diff --git a/services/BUILD.gn b/services/BUILD.gn
index b2cdb17..ce6e24b 100644
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -142,9 +142,14 @@ if (defined(ohos_lite)) {
"//foundation/communication/dsoftbus/interfaces/kits/transport",
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
"//third_party/json/include",
+ "${frameworks_path}/inc",
+ "${dev_frameworks_path}/inc/permission_adapter",
]
sources = deviceauth_files
+ sources += deviceauth_ipc_files
+ sources += permission_adapter_files
+ sources += [ "${frameworks_path}/src/ipc_service.c" ]
cflags = [ "-DHILOG_ENABLE" ]
defines = deviceauth_defines
cflags += build_flags
@@ -164,6 +169,7 @@ if (defined(ohos_lite)) {
external_deps = [
"hiviewdfx_hilog_native:libhilog",
+ "ipc:ipc_core",
]
if (support_jsapi) {
external_deps += [ "os_account_standard:os_account_innerkits" ]
@@ -238,6 +244,12 @@ if (defined(ohos_lite)) {
sources = deviceauth_ipc_files
sources += permission_adapter_files
sources += [ "${frameworks_path}/src/ipc_sdk.c" ]
+ sources += [ "${os_adapter_path}/impl/src/hc_log.c" ]
+ sources += [ "${os_adapter_path}/impl/src/linux/hc_types.c" ]
+ sources += [ "${os_adapter_path}/impl/src/hc_mutex.c" ]
+ sources += [ "${common_lib_path}/impl/src/json_utils.c" ]
+ sources += [ "${common_lib_path}/impl/src/string_util.c" ]
+ sources += [ "${common_lib_path}/impl/src/clib_types.c" ]
defines = [
"__LINUX__",
@@ -250,9 +262,10 @@ if (defined(ohos_lite)) {
}
deps = [
- "${deps_adapter_path}:${hal_module_name}",
"//third_party/cJSON:cjson_static",
"//utils/native/base:utils",
+ "//third_party/bounds_checking_function:libsec_shared",
+ "//third_party/cJSON:cjson_static",
]
external_deps = [
diff --git a/services/device_auth.c b/services/device_auth.c
index e09dce4..16f6200 100644
--- a/services/device_auth.c
+++ b/services/device_auth.c
@@ -14,6 +14,7 @@
*/
#include "device_auth.h"
+#include "ipc_service.h"
#include "alg_loader.h"
#include "callback_manager.h"
@@ -241,6 +242,11 @@ DEVICE_AUTH_API_PUBLIC int InitDeviceAuthService(void)
DestroyGmAndGa();
return res;
}
+ res = DeviceAuthIpcInit();
+ if (res != HC_SUCCESS) {
+ DestroyGmAndGa();
+ return res;
+ }
SetInitStatus();
LOGI("[End]: [Service]: Init device auth service successfully!");
return HC_SUCCESS;
--
2.25.1

View File

@ -1,79 +0,0 @@
From 382ff16702df5f06b96a76abd2b542ab00650487 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Thu, 10 Nov 2022 14:34:05 +0800
Subject: [PATCH] simplify dependency on third-party packages
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
deps_adapter/BUILD.gn | 4 ++--
services/BUILD.gn | 23 +++++++++--------------
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/deps_adapter/BUILD.gn b/deps_adapter/BUILD.gn
index 906b8ca..722d974 100644
--- a/deps_adapter/BUILD.gn
+++ b/deps_adapter/BUILD.gn
@@ -120,10 +120,10 @@ if (defined(ohos_lite)) {
"//base/security/huks/interfaces/innerkits/huks_standard/main:libhukssdk",
"//depend:syspara",
"//third_party/cJSON:cjson_static",
- "//third_party/openssl:libcrypto_static",
"//utils/native/base:utils",
"//third_party/bounds_checking_function:libsec_shared",
]
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ deps += [ "//depend:libhilog" ]
+ libs = [ "crypto" ]
}
}
diff --git a/services/BUILD.gn b/services/BUILD.gn
index ce6e24b..0c37820 100644
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -167,9 +167,9 @@ if (defined(ohos_lite)) {
"//foundation/communication/dsoftbus/sdk:softbus_client"
]
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
if (support_jsapi) {
external_deps += [ "os_account_standard:os_account_innerkits" ]
@@ -217,12 +217,9 @@ if (defined(ohos_lite)) {
"//utils/native/base:utils",
]
- external_deps = [
- "access_token:libaccesstoken_sdk",
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr_standard:samgr_proxy",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
}
@@ -268,11 +265,9 @@ if (defined(ohos_lite)) {
"//third_party/cJSON:cjson_static",
]
- external_deps = [
- "access_token:libaccesstoken_sdk",
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "samgr_standard:samgr_proxy",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
}
}
--
2.25.1

View File

@ -1,73 +0,0 @@
diff -Naur build-OpenHarmony-v3.0.2-LTS/config/sanitizers/BUILD.gn build-OpenHarmony-v3.0.2-LTS-path2/config/sanitizers/BUILD.gn
--- build-OpenHarmony-v3.0.2-LTS/config/sanitizers/BUILD.gn 2022-02-26 17:17:05.000000000 +0800
+++ build-OpenHarmony-v3.0.2-LTS-path2/config/sanitizers/BUILD.gn 2022-07-14 11:50:09.927655500 +0800
@@ -678,6 +678,8 @@
}
}
+ print(_clang_rt_libs_dir)
+
foreach(rt_lib, _dso_names) {
_clang_rt_dso_paths += [ "$_clang_rt_libs_dir/${rt_lib}" ]
}
diff -Naur build-OpenHarmony-v3.0.2-LTS/loader/preloader/platforms.template build-OpenHarmony-v3.0.2-LTS-path2/loader/preloader/platforms.template
--- build-OpenHarmony-v3.0.2-LTS/loader/preloader/platforms.template 2022-07-14 11:49:08.352875000 +0800
+++ build-OpenHarmony-v3.0.2-LTS-path2/loader/preloader/platforms.template 2022-07-14 11:06:07.951920300 +0800
@@ -12,6 +12,12 @@
"target_cpu": "arm",
"toolchain": "//build/toolchain/linux:arm",
"parts_config": "./parts.json"
+ },
+ {
+ "target_os": "ohos",
+ "target_cpu": "x86_64",
+ "toolchain": "//build/toolchain/linux:x86_64",
+ "parts_config": "./parts.json"
}
]
}
diff -Naur build-OpenHarmony-v3.0.2-LTS/toolchain/linux/BUILD.gn build-OpenHarmony-v3.0.2-LTS-path2/toolchain/linux/BUILD.gn
--- build-OpenHarmony-v3.0.2-LTS/toolchain/linux/BUILD.gn 2022-07-14 11:49:08.511178900 +0800
+++ build-OpenHarmony-v3.0.2-LTS-path2/toolchain/linux/BUILD.gn 2022-07-14 11:10:51.681272300 +0800
@@ -25,6 +25,8 @@
tool_path = rebase_path("//toolchain/bin", root_build_dir)
toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-"
+ toolprefix = ""
+
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
@@ -45,6 +47,8 @@
tool_path = rebase_path("//toolchain/bin", root_build_dir)
toolprefix = "${tool_path}/arm-openeuler-linux-gnu-"
+ toolprefix = ""
+
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
@@ -120,4 +124,23 @@
current_os = "linux"
is_clang = false
}
+}
+
+gcc_toolchain("x86_64") {
+ cc = "gcc"
+ cxx = "g++"
+
+ readelf = "readelf"
+ nm = "nm"
+ ar = "ar"
+ ld = cxx
+
+ # Output linker map files for binary size analysis.
+ enable_linker_map = true
+
+ toolchain_args = {
+ current_cpu = "x86_64"
+ current_os = "linux"
+ is_clang = false
+ }
}

View File

@ -1,44 +0,0 @@
From f3054acbbb67d6e4889f3a7c2641dc1d74ee1984 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Tue, 20 Sep 2022 09:45:38 +0800
Subject: [PATCH] Adaptation for dsoftbus
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
BUILD.gn | 24 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 BUILD.gn
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..9bec199
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,24 @@
+# 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.
+
+config("libsec_public_config") {
+ libs = [ "/usr/lib64/libboundscheck.so" ]
+}
+
+group("libsec_static") {
+ public_configs = [ ":libsec_public_config" ]
+}
+
+group("libsec_shared") {
+ public_configs = [ ":libsec_public_config" ]
+}
--
2.25.1

View File

@ -1,49 +0,0 @@
From: "liheavy" <lihaiwei8@huawei.com>
Date: Fir, 26 Nov 2022 09:45:38 +0800
Subject: [PATCH] Adaptation for productdefine of dsoftbus
---
diff -Nur a/common/base/standard_system.json b/common/base/standard_system.json
--- a/common/base/standard_system.json 1970-01-01 08:00:00.000000000 +0800
+++ b/common/base/standard_system.json 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1 @@
+{}
diff -Nur a/common/device/openEuler.json b/common/device/openEuler.json
--- a/common/device/openEuler.json 1970-01-01 08:00:00.000000000 +0800
+++ b/common/device/openEuler.json 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,8 @@
+{
+ "device_name": "openEuler",
+ "device_company": "hisilicon",
+ "target_os": "ohos",
+ "target_cpu": "arm64",
+ "kernel_version": "",
+ "device_build_path": "device/hisilicon/build"
+}
diff -Nur a/common/products/openEuler.json b/common/products/openEuler.json
--- a/common/products/openEuler.json 1970-01-01 08:00:00.000000000 +0800
+++ b/common/products/openEuler.json 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,23 @@
+{
+ "product_name": "openEuler",
+ "product_company": "hisilicon",
+ "product_device": "openEuler",
+ "version": "2.0",
+ "type": "standard",
+ "product_build_path": "device/hisilicon/build",
+ "parts": {
+ "communication:dsoftbus_standard": {},
+ "security:huks_standard": {},
+ "security:deviceauth_standard": {},
+ "depend:hiviewdfx_hilog_native": {},
+ "depend:ipc": {},
+ "depend:ces_standard": {},
+ "depend:aafwk_standard": {},
+ "depend:appexecfwk_standard": {},
+ "depend:permission_standard": {},
+ "depend:safwk": {},
+ "depend:samgr_L2": {},
+ "depend:samgr_standard": {},
+ "depend:access_token": {}
+ }
+}

View File

@ -1,389 +0,0 @@
From: "liheavy" <lihaiwei8@huawei.com>
Date: Fir, 26 Nov 2022 09:45:38 +0800
Subject: [PATCH] Adaptation for depend of dsoftbus
---
diff -Nur a/BUILD.gn b/BUILD.gn
--- a/BUILD.gn 1970-01-01 08:00:00.000000000 +0800
+++ b/BUILD.gn 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,59 @@
+import("//build/ohos.gni")
+
+config("hilog_config") {
+ include_dirs = [
+ "hilog/include",
+ "//third_party/bounds_checking_function/include",
+ ]
+}
+
+ohos_shared_library("libhilog") {
+ public_configs = [ ":hilog_config" ]
+ sources = [
+ "hilog/hilog.c",
+ ]
+ deps = [
+ "//third_party/bounds_checking_function:libsec_shared",
+ ]
+}
+
+group("system_ability_fwk") {
+}
+
+group("samgr_proxy") {
+}
+
+group("libpermissionsdk_standard") {
+}
+
+group("cesfwk_innerkits") {
+}
+
+group("want") {
+}
+
+group("appexecfwk_core") {
+}
+
+group("libaccesstoken_sdk") {
+}
+
+config("syspara_config") {
+ include_dirs = [
+ "syspara/include",
+ ]
+}
+
+ohos_shared_library("syspara") {
+ include_dirs = [
+ "syspara/include",
+ ]
+ sources = [
+ "syspara/syspara.c",
+ ]
+ public_configs = [ ":syspara_config" ]
+ deps = [
+ "//third_party/bounds_checking_function:libsec_shared",
+ "//third_party/mbedtls:mbedtls_shared",
+ ]
+}
diff -Nur a/hilog/hilog.c b/hilog/hilog.c
--- a/hilog/hilog.c 1970-01-01 08:00:00.000000000 +0800
+++ b/hilog/hilog.c 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "securec.h"
+#include "hilog_base/log_base.h"
+
+#ifndef LOG_PRINT_MAX_LEN
+#define LOG_PRINT_MAX_LEN 256
+#endif
+
+char *adapterStrForPrintfFormat(const char *fmt) {
+ char *left, *right;
+ char *buffer = (char *)malloc(LOG_PRINT_MAX_LEN * sizeof(char));
+ (void)memset_s(buffer, LOG_PRINT_MAX_LEN * sizeof(char), 0, LOG_PRINT_MAX_LEN * sizeof(char));
+ strcpy_s(buffer, LOG_PRINT_MAX_LEN * sizeof(char), fmt);
+ while (strstr(buffer, "{")) {
+ left = strstr(buffer, "{");
+ right = strstr(buffer, "}");
+ right++;
+ while (*right != '\0') {
+ *left = *right;
+ left++;
+ right++;
+ }
+ *left = '\0';
+ }
+ return buffer;
+}
+
+void printfAdapter(const char *fmt, ...) {
+ char *buffer;
+ buffer = adapterStrForPrintfFormat(fmt);
+ va_list ap;
+ va_start(ap, fmt);
+ vprintf(buffer, ap);
+ va_end(ap);
+ free(buffer);
+}
diff -Nur a/hilog/include/hilog/log.h b/hilog/include/hilog/log.h
--- a/hilog/include/hilog/log.h 1970-01-01 08:00:00.000000000 +0800
+++ b/hilog/include/hilog/log.h 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,37 @@
+#ifndef _HILOG_H
+#define _HILOG_H
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C" {
+#endif
+#endif
+
+// Log type
+typedef enum {
+ LOG_TYPE_MIN = 0,
+ LOG_APP = 0,
+ // Log to kmsg, only used by init phase.
+ LOG_INIT = 1,
+ // Used by core service, framework.
+ LOG_CORE = 3,
+ LOG_TYPE_MAX
+} LogType;
+
+char *adapterStrForPrintfFormat(const char *fmt);
+void printfAdapter(const char *fmt, ...);
+
+#define HILOG_DEBUG(type, fmt, ...) printfAdapter(fmt"\n", ##__VA_ARGS__)
+#define HILOG_INFO(type, fmt, ...) printfAdapter(fmt"\n", ##__VA_ARGS__)
+#define HILOG_WARN(type, fmt, ...) printfAdapter(fmt"\n", ##__VA_ARGS__)
+#define HILOG_ERROR(type, fmt, ...) printfAdapter(fmt"\n", ##__VA_ARGS__)
+#define HiLogPrint(type, level, domain, tag, fmt, ...) printf(fmt"\n", ##__VA_ARGS__)
+#define HiLogBasePrint(type, level, domain, tag, fmt, ...) printfAdapter(fmt"\n", ##__VA_ARGS__)
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif
+
+#endif
diff -Nur a/hilog/include/hilog_base/log_base.h b/hilog/include/hilog_base/log_base.h
--- a/hilog/include/hilog_base/log_base.h 1970-01-01 08:00:00.000000000 +0800
+++ b/hilog/include/hilog_base/log_base.h 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1 @@
+#include <hilog/log.h>
diff -Nur a/ohos.build b/ohos.build
--- a/ohos.build 1970-01-01 08:00:00.000000000 +0800
+++ b/ohos.build 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,114 @@
+{
+ "subsystem": "depend",
+ "parts": {
+ "hiviewdfx_hilog_native": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:libhilog",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "ces_standard": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:cesfwk_innerkits",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "aafwk_standard": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:want",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "appexecfwk_standard": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:appexecfwk_core",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "permission_standard": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:libpermissionsdk_standard",
+ "header": {
+ "header_files": [ ],
+ "header_base":"//depend"
+ }
+ }
+ ]
+ },
+ "safwk": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:system_ability_fwk",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "samgr_L2": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:samgr_proxy",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "samgr_standard": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:samgr_proxy",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ },
+ "access_token": {
+ "module_list": [ ],
+ "inner_kits": [
+ {
+ "name": "//depend:libaccesstoken_sdk",
+ "header": {
+ "header_files": [ ],
+ "header_base": "//depend"
+ }
+ }
+ ]
+ }
+ }
+}
+
diff -Nur a/syspara/include/parameter.h b/syspara/include/parameter.h
--- a/syspara/include/parameter.h 1970-01-01 08:00:00.000000000 +0800
+++ b/syspara/include/parameter.h 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,20 @@
+#ifndef SYSPARA_PARAMETER_H
+#define SYSPARA_PARAMETER_H
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C" {
+#endif
+#endif /* __cplusplus */
+
+int GetDevUdid(char *udid, int size);
+
+char * GetDeviceType(void);
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif /* __cplusplus */
+
+#endif /* SYSPARA_PARAMETER_H */
diff -Nur a/syspara/syspara.c b/syspara/syspara.c
--- a/syspara/syspara.c 1970-01-01 08:00:00.000000000 +0800
+++ b/syspara/syspara.c 2022-09-28 10:28:40.000000000 +0800
@@ -0,0 +1,86 @@
+#include <string.h>
+#include "securec.h"
+#include "parameter.h"
+#include "sha256.h"
+
+#define SN_FILE "/etc/SN"
+#define SN_LEN 65
+#define UDID_LEN 65
+#define DEV_BUF_LENGTH 3
+#define HASH_LENGTH 32
+static char *deviceType = "UNKNOWN";
+
+static int GetHash(const char *input, char *output, int size)
+{
+ char buf[DEV_BUF_LENGTH] = { 0 };
+ unsigned char hash[HASH_LENGTH] = { 0 };
+ mbedtls_sha256_context context;
+
+ mbedtls_sha256_init(&context);
+ mbedtls_sha256_starts_ret(&context, 0);
+ mbedtls_sha256_update_ret(&context, (const unsigned char*)input, strlen(input));
+ mbedtls_sha256_finish_ret(&context, hash);
+
+ for (size_t i = 0; i < HASH_LENGTH; i++) {
+ unsigned char value = hash[i];
+ memset_s(buf, DEV_BUF_LENGTH, 0, DEV_BUF_LENGTH);
+ sprintf_s(buf, sizeof(buf), "%02X", value);
+ if (strcat_s(output, size, buf) != 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int GetDevUdid(char *udid, int size)
+{
+ FILE *fp;
+ char *realPath = NULL;
+ char sn[SN_LEN] = {0};
+ char out[UDID_LEN] = {0};
+ int ret;
+
+ realPath = realpath(SN_FILE, NULL);
+ if (realPath == NULL) {
+ printf("realpath fail.\n");
+ goto err_realpath;
+ }
+
+ fp = fopen(realPath, "r");
+ if (fp == NULL) {
+ printf("open SN fail.\n");
+ goto err_fopen;
+ }
+
+ ret = fscanf_s(fp, "%s", sn, SN_LEN);
+ if (ret < 1) {
+ printf("get sn fail.\n");
+ goto err_out;
+ }
+
+ ret = GetHash(sn, out, UDID_LEN);
+ if (ret < 0) {
+ printf("get hash fail.\n");
+ goto err_out;
+ }
+
+ ret = sprintf_s(udid, size, "%s", out);
+ if (ret <= 0) {
+ printf("sprintf_s error.\n");
+ goto err_out;
+ }
+
+ fclose(fp);
+ return 0;
+err_out:
+ fclose(fp);
+err_fopen:
+ free(realPath);
+err_realpath:
+ return -1;
+}
+
+char * GetDeviceType(void)
+{
+ return deviceType;
+}

View File

@ -1,114 +0,0 @@
From bda2efdae0c4df2c2d64796dd3469bc53f53604f Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Thu, 10 Nov 2022 14:37:25 +0800
Subject: [PATCH] simplify dependency on third-party packages
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
frameworks/huks_standard/main/core/BUILD.gn | 3 ++-
.../huks_standard/main/crypto_engine/openssl/BUILD.gn | 4 +++-
frameworks/huks_standard/main/os_dependency/BUILD.gn | 7 +++----
.../huks_service/main/os_dependency/BUILD.gn | 8 +++-----
.../huks_service/main/os_dependency/idl/BUILD.gn | 2 +-
utils/crypto_adapter/BUILD.gn | 3 ++-
6 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/frameworks/huks_standard/main/core/BUILD.gn b/frameworks/huks_standard/main/core/BUILD.gn
index b601eda..6ac01d4 100755
--- a/frameworks/huks_standard/main/core/BUILD.gn
+++ b/frameworks/huks_standard/main/core/BUILD.gn
@@ -40,7 +40,8 @@ ohos_static_library("libhuks_core_standard_static") {
]
deps = [
"//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static",
- "//third_party/openssl:libcrypto_static",
]
+
+ libs = [ "crypto" ]
complete_static_lib = true
}
diff --git a/frameworks/huks_standard/main/crypto_engine/openssl/BUILD.gn b/frameworks/huks_standard/main/crypto_engine/openssl/BUILD.gn
index ab4d1a2..f02b701 100755
--- a/frameworks/huks_standard/main/crypto_engine/openssl/BUILD.gn
+++ b/frameworks/huks_standard/main/crypto_engine/openssl/BUILD.gn
@@ -51,8 +51,10 @@ ohos_static_library("libhuks_openssl_standard_static") {
deps = [
"//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static",
- "//third_party/openssl:libcrypto_static",
]
+
+ libs = [ "crypto" ]
+
cflags = [
"-DHILOG_ENABLE",
"-Wall",
diff --git a/frameworks/huks_standard/main/os_dependency/BUILD.gn b/frameworks/huks_standard/main/os_dependency/BUILD.gn
index 6da94a5..bfe2941 100755
--- a/frameworks/huks_standard/main/os_dependency/BUILD.gn
+++ b/frameworks/huks_standard/main/os_dependency/BUILD.gn
@@ -52,10 +52,9 @@ ohos_static_library("libhuks_os_dependency_standard_static") {
"//utils/native/base:utils",
"//third_party/bounds_checking_function:libsec_shared",
]
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "samgr_standard:samgr_proxy",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
cflags_cc = [
"-DHILOG_ENABLE",
diff --git a/services/huks_standard/huks_service/main/os_dependency/BUILD.gn b/services/huks_standard/huks_service/main/os_dependency/BUILD.gn
index 01078b7..dfa2c4f 100755
--- a/services/huks_standard/huks_service/main/os_dependency/BUILD.gn
+++ b/services/huks_standard/huks_service/main/os_dependency/BUILD.gn
@@ -43,11 +43,9 @@ ohos_static_library("libhuks_service_os_dependency_standard_static") {
]
public_deps = [ "//base/security/huks/services/huks_standard/huks_service/main/os_dependency/idl:libhuks_service_idl_standard_static" ]
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr_standard:samgr_proxy",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
if (support_jsapi) {
sources += [ "sa/hks_event_observer.cpp" ]
diff --git a/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn b/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn
index 3ffcfa1..0650b2c 100755
--- a/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn
+++ b/services/huks_standard/huks_service/main/os_dependency/idl/BUILD.gn
@@ -43,7 +43,7 @@ ohos_static_library("libhuks_service_idl_standard_static") {
"//base/security/huks/services/huks_standard/huks_service/main/core:libhuks_service_core_standard_static",
"//utils/native/base:utils",
]
- external_deps = [ "ipc:ipc_core" ]
+ deps += [ "//depend/ipc:ipc_core" ]
if (support_jsapi) {
external_deps += [
"access_token:libaccesstoken_sdk",
diff --git a/utils/crypto_adapter/BUILD.gn b/utils/crypto_adapter/BUILD.gn
index 0ca8f61..7d28eea 100755
--- a/utils/crypto_adapter/BUILD.gn
+++ b/utils/crypto_adapter/BUILD.gn
@@ -39,9 +39,10 @@ ohos_static_library("libhuks_utils_client_service_adapter_static") {
deps = [
"//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static",
"//base/security/huks/frameworks/huks_standard/main/os_dependency:libhuks_os_dependency_standard_static",
- "//third_party/openssl:libcrypto_static",
"//utils/native/base:utils",
]
+ libs = [ "crypto" ]
+
complete_static_lib = true
}
--
2.25.1

View File

@ -1,45 +0,0 @@
From 7100861f832c43ef9b272666989f3ffd5107bc7a Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Thu, 10 Nov 2022 11:04:23 +0800
Subject: [PATCH] adapter cjson in openEuler for softbus
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
BUILD.gn | 25 ++++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100755 BUILD.gn
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100755
index 0000000..b15e1db
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,25 @@
+#Copyright (c) 2019-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("//build/ohos.gni")
+config("cJSON_config") {
+ include_dirs = [ "/usr/include/cjson" ]
+ libs = [ "/usr/lib64/libcjson.so.1" ]
+}
+ohos_static_library("cjson_static") {
+ public_configs = [ ":cJSON_config" ]
+}
+ohos_shared_library("cjson") {
+ public_configs = [ ":cJSON_config" ]
+ subsystem_name = "hiviewdfx"
+}
--
2.25.1

View File

@ -1,89 +0,0 @@
From 26d71c4574464eb92b506ba7be48a2980500bee7 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Thu, 10 Nov 2022 10:26:14 +0800
Subject: [PATCH] simplify dependency on third-party packages
Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
adapter/BUILD.gn | 2 +-
core/common/BUILD.gn | 2 +-
core/frame/BUILD.gn | 13 ++++++-------
sdk/BUILD.gn | 6 +++---
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn
index fe6cb79b..e59c2965 100644
--- a/adapter/BUILD.gn
+++ b/adapter/BUILD.gn
@@ -137,7 +137,7 @@ if (defined(ohos_lite)) {
]
public_configs = [ ":config_adapter_common" ]
if (is_standard_system) {
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ deps += [ "//depend:libhilog" ]
}
part_name = "dsoftbus_standard"
subsystem_name = "communication"
diff --git a/core/common/BUILD.gn b/core/common/BUILD.gn
index fdb4134d..4c305d7f 100644
--- a/core/common/BUILD.gn
+++ b/core/common/BUILD.gn
@@ -114,7 +114,7 @@ if (defined(ohos_lite)) {
"//utils/native/base:utilsecurec_shared",
]
if (is_standard_system) {
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ deps = [ "//depend:libhilog" ]
}
part_name = "dsoftbus_standard"
subsystem_name = "communication"
diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn
index 5109f201..3948ef68 100644
--- a/core/frame/BUILD.gn
+++ b/core/frame/BUILD.gn
@@ -163,10 +163,9 @@ if (defined(ohos_lite)) {
"//base/security/deviceauth/services:deviceauth",
]
if (is_standard_system) {
- external_deps = bus_center_server_external_deps
- external_deps += [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
}
@@ -192,9 +191,9 @@ if (defined(ohos_lite)) {
"//base/security/huks/services/huks_standard/huks_engine/main/core:huks_engine_core_standard",
"//depend:syspara",
]
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_core",
]
part_name = "dsoftbus_standard"
subsystem_name = "communication"
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index f322ce5c..73771588 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -85,9 +85,9 @@ target(build_type, "softbus_client") {
cflags = [ "-fPIC" ]
cflags_cc = [ "-std=c++14" ]
if (is_standard_system) {
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_single",
+ deps += [
+ "//depend:libhilog",
+ "//depend/ipc:ipc_single",
]
}
part_name = "dsoftbus_standard"
--
Gitee

View File

@ -1,94 +0,0 @@
From 271b7e334ec0514952a5532cad572d5ec87b0725 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Wed, 20 Sep 2023 16:00:14 +0800
Subject: [PATCH] open udp stream and file feature
---
.../feature_config/standard/config.gni | 4 ++--
components/nstackx/fillp/BUILD.gn | 2 +-
core/frame/BUILD.gn | 3 +++
.../udp/stream/libsoftbus_stream/vtp_instance.cpp | 13 ++++++++++++-
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/adapter/default_config/feature_config/standard/config.gni b/adapter/default_config/feature_config/standard/config.gni
index 15951d1..75d27a7 100644
--- a/adapter/default_config/feature_config/standard/config.gni
+++ b/adapter/default_config/feature_config/standard/config.gni
@@ -21,8 +21,8 @@ declare_args() {
dsoftbus_standard_feature_conn_p2p = false
dsoftbus_standard_feature_trans_udp = true
- dsoftbus_standard_feature_trans_udp_stream = false
- dsoftbus_standard_feature_trans_udp_file = false
+ dsoftbus_standard_feature_trans_udp_stream = true
+ dsoftbus_standard_feature_trans_udp_file = true
dsoftbus_standard_feature_ip_auth = true
dsoftbus_standard_feature_auth_account = false
diff --git a/components/nstackx/fillp/BUILD.gn b/components/nstackx/fillp/BUILD.gn
index f5c5443..d56fd05 100644
--- a/components/nstackx/fillp/BUILD.gn
+++ b/components/nstackx/fillp/BUILD.gn
@@ -105,7 +105,7 @@ if (defined(ohos_lite)) {
include_dirs = fillp_include
include_dirs += [ "//utils/native/base/include/" ]
sources = fillp_source
- deps = [ "//utils/native/base:utilsecurec_shared" ]
+ deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
part_name = "dsoftbus_standard"
subsystem_name = "communication"
diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn
index 3948ef6..5936a3a 100644
--- a/core/frame/BUILD.gn
+++ b/core/frame/BUILD.gn
@@ -180,6 +180,9 @@ if (defined(ohos_lite)) {
":softbus_server",
"$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl",
"$dsoftbus_root_path/components/nstackx/nstackx_util:nstackx_util.open",
+ "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile:nstackx_dfile.open",
+ "$dsoftbus_root_path/components/nstackx/nstackx_congestion:nstackx_congestion.open",
+ "$dsoftbus_root_path/components/nstackx/fillp:FillpSo.open",
"$dsoftbus_root_path/core/common:softbus_utils",
"$dsoftbus_root_path/adapter:softbus_adapter",
"$dsoftbus_root_path/sdk:softbus_client",
diff --git a/sdk/transmission/trans_channel/udp/stream/libsoftbus_stream/vtp_instance.cpp b/sdk/transmission/trans_channel/udp/stream/libsoftbus_stream/vtp_instance.cpp
index 13a1cff..064b5bf 100644
--- a/sdk/transmission/trans_channel/udp/stream/libsoftbus_stream/vtp_instance.cpp
+++ b/sdk/transmission/trans_channel/udp/stream/libsoftbus_stream/vtp_instance.cpp
@@ -62,9 +62,16 @@ FILLP_UINT32 VtpInstance::CryptoRand()
if (fd < 0) {
return 0;
}
-
FILLP_UINT32 value = 0;
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-result"
+#endif
read(fd, &value, sizeof(FILLP_UINT32));
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
close(fd);
return value;
}
@@ -82,10 +89,14 @@ void VtpInstance::PrintFillpLog(FILLP_UINT32 debugType, FILLP_UINT32 debugLevel,
va_list vaList;
va_start(vaList, format);
+#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
int result = vsprintf_s(debugInfo, DEBUG_BUFFER_LEN, static_cast<const char *>(format), vaList);
+#ifdef __clang__
#pragma clang diagnostic pop
+#endif
if (result < 0) {
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "**********fillDebugSend Fail!************");
va_end(vaList);
--
2.33.0

View File

@ -1,55 +0,0 @@
From 905c17b5c116b039c1083290679be3f6c27fe401 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Thu, 14 Sep 2023 18:59:15 +0800
Subject: [PATCH] bugfix cve-2023-30362
---
src/net.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/net.c b/src/net.c
index 7154628..a432ddd 100644
--- a/src/net.c
+++ b/src/net.c
@@ -1217,19 +1217,25 @@ coap_send_internal(coap_session_t *session, coap_pdu_t *pdu) {
/* Need to check that we are not seeing this proxy in the return loop */
if (pdu->data && opt == NULL) {
- if (pdu->used_size + 1 <= pdu->max_size) {
- char *a_match;
- size_t data_len = pdu->used_size - (pdu->data - pdu->token);
- pdu->data[data_len] = '\000';
- a_match = strstr((char*)pdu->data, cp);
- if (a_match && (a_match == (char*)pdu->data || a_match[-1] == ' ') &&
- ((size_t)(a_match - (char*)pdu->data + len) == data_len ||
- a_match[len] == ' ')) {
- coap_log(LOG_WARNING, "Proxy loop detected '%s'\n",
- (char*)pdu->data);
- coap_delete_pdu(pdu);
- return (coap_mid_t)COAP_DROPPED_RESPONSE;
- }
+ char *a_match;
+ size_t data_len;
+
+ if (pdu->used_size + 1 > pdu->max_size) {
+ /* No space */
+ return (coap_mid_t)COAP_DROPPED_RESPONSE;
+ }
+ if (!coap_pdu_resize(pdu, pdu->used_size + 1)) {
+ /* Internal error */
+ return (coap_mid_t)COAP_DROPPED_RESPONSE;
+ }
+ data_len = pdu->used_size - (pdu->data - pdu->token);
+ pdu->data[data_len] = '\000';
+ a_match = strstr((char*)pdu->data, cp);
+ if (a_match && (a_match == (char*)pdu->data || a_match[-1] == ' ') &&
+ ((size_t)(a_match - (char*)pdu->data + len) == data_len ||
+ a_match[len] == ' ')) {
+ coap_delete_pdu(pdu);
+ return (coap_mid_t)COAP_DROPPED_RESPONSE;
}
}
if (pdu->used_size + len + 1 <= pdu->max_size) {
--
2.33.0

View File

@ -1,8 +1,12 @@
# dsoftbus
# communication_dsoftbus
#### 介绍
OpenEuler supports distributed softbus capability, which is part of openEuler embedded capability
现实中多设备间通信方式多种多样(WIFI、蓝牙等),不同的通信方式使用差异大,导致通信问题多;同时还面临设备间通信链路的融合共享和冲突无法处理等挑战。分布式软总线实现近场设备间统一的分布式通信管理能力,提供不区分链路的设备间发现连接、组网和传输能力,主要功能如下:
- 发现连接提供基于Wifi、蓝牙等通信方式的设备发现连接能力。
- 设备组网:提供统一的设备组网和拓扑管理能力,为数据传输提供已组网设备信息。
- 数据传输:提供数据传输通道,支持消息、字节数据传输等能力。
业务方通过使用分布式软总线提供的API实现设备间的高速通信不用关心通信细节进而实现业务平台的高效部署与运行能力。
#### 软件架构
软件架构说明
@ -27,11 +31,12 @@ OpenEuler supports distributed softbus capability, which is part of openEuler em
4. 新建 Pull Request
#### 码云特技
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

Binary file not shown.

Binary file not shown.

View File

@ -1,222 +1,120 @@
%define debug_package %{nil}
%global source_dsoftbus_standard dsoftbus_standard
%global release_dsoftbus_standard v3.1.2-release
%global source_embedded_ipc embedded-ipc
%global release_embedded_ipc v1.0.0-release
%global source_commonlibrary_c_utils commonlibrary_c_utils
%global source_security_device_auth security_device_auth
%global source_security_huks security_huks
%global source_third_party_libcoap third_party_libcoap
%global source_third_party_mbedtls third_party_mbedtls
%global source_build build
%global release_build OpenHarmony-v3.0.2-LTS
%global openHarmony_source_release OpenHarmony-v3.1.2-Release
%global build_opt /opt/distributed-middleware-build
%global oh_version OpenHarmony-v3.2-Release
%global third_party_path %{_builddir}/third_party
%global communication_path %{_builddir}/foundation/communication
Name: dsoftbus
Version: 1.0.0
Release: 5
Summary: openEuler embedded softbus capability support
License: Apache License 2.0
Url: https://openeuler.gitee.io/yocto-meta-openeuler/features/distributed_softbus.html
Source0: https://gitee.com/openeuler/%{source_dsoftbus_standard}/repository/archive/%{release_dsoftbus_standard}.tar.gz #/%{source_dsoftbus_standard}-%{release_dsoftbus_standard}.tar.gz
Source1: https://gitee.com/openeuler/%{source_embedded_ipc}/repository/archive/%{release_embedded_ipc}.tar.gz #/%{source_embedded_ipc}-%{release_embedded_ipc}.tar.gz
Source2: https://gitee.com/openharmony/%{source_commonlibrary_c_utils}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_commonlibrary_c_utils}-%{openHarmony_source_release}.tar.gz
Source3: https://gitee.com/openharmony/%{source_security_device_auth}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_security_device_auth}-%{openHarmony_source_release}.tar.gz
Source4: https://gitee.com/openharmony/%{source_security_huks}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_security_huks}-%{openHarmony_source_release}.tar.gz
Source5: https://gitee.com/openharmony/%{source_third_party_libcoap}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_third_party_libcoap}-%{openHarmony_source_release}.tar.gz
Source6: https://gitee.com/openharmony/%{source_third_party_mbedtls}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_third_party_mbedtls}-%{openHarmony_source_release}.tar.gz
Source7: https://gitee.com/openharmony/%{source_build}/repository/archive/%{release_build}.tar.gz #/%{source_build}-%{release_build}.tar.gz
Name: communication_dsoftbus
Version: 1.0.0
Release: 1
Summary: Inter-process Remote Procedure Call (RPC)
License: Apache License 2.0
Url: https://gitee.com/openharmony/communication_dsoftbus
Source1: https://gitee.com/openharmony/communication_dsoftbus/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/communication_dsoftbus-OpenHarmony-v3.2-Release.tar.gz
Source2: https://gitee.com/openharmony/third_party_sqlite/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/third_party_sqlite-OpenHarmony-v3.2-Release.tar.gz
Source3: https://gitee.com/openharmony/third_party_libcoap/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/third_party_libcoap-OpenHarmony-v3.2-Release.tar.gz
Source4: sqlite.BUILD.gn
Patch0000: 0000-add-dsoftbus-build-support-for-embedded-env.patch
Patch0001: 0001-support-hichian-for-openeuler.patch
Patch0002: 0002-add-deviceauth-ipc-sdk-compile.patch
Patch0003: 0003-Adaptation-for-dsoftbus.patch
Patch0004: 0004-Adaptation-for-dsoftbus-v3.1.2.patch
Patch0005: 0005-fix-CVE-2021-43666.patch
Patch0006: 0006-fix-CVE-2021-45451.patch
Patch0007: 0007-support-huks-for-openeuler.patch
Patch0008: 0008-support-deviceauth-for-openeuler.patch
Patch0009: 0009-adapter-deviceauth-ipc-service.patch
Patch0010: 0010-simplify-dependency-on-third-party-packages.patch
Patch0011: 0011-change-set-for-obs-build.patch
Patch0012: 0012-Adaptation-for-dsoftbus.patch
Patch0013: 0013-add-productdefine-for-openeuler.patch
Patch0014: 0014-add-depend-for-openeuler.patch
Patch0015: 0015-simplify-dependency-on-third-party-packages.patch
Patch0016: 0016-adapter-cjson-in-openEuler-for-softbus.patch
Patch0017: 0017-simplify-dependency-for-dsoftbus-standard.patch
Patch0018: 0018-open-udp-stream-and-file-feature-for-dsoftbus.patch
Patch0019: 0019-third-party-libcoap-fix-CVE-2023-30364.patch
Patch1: 0001-remove-dependency-and-adapt-for-openeuler-dsoftbus.patch
Patch2: 0002-increase-the-pthread-stack-size-of-x86-and-other-env-dsoftbus.patch
Patch3: 0003-open-udp-stream-switch-dsoftbus.patch
BuildRequires: gcc, g++, cmake, python, zip, unzip, ninja-build, git, libboundscheck, cjson-devel, openssl-devel, gn
BuildRequires: gcc, make, hilog, kernel-devel, uname-build-checks
BuildRequires: distributed-build, distributed-beget
BuildRequires: commonlibrary_c_utils
BuildRequires: notification_eventhandler
BuildRequires: communication_ipc
BuildRequires: security_device_auth, security_huks
BuildRequires: systemabilitymgr_safwk, systemabilitymgr_samgr
BuildRequires: cjson-devel, openssl-devel
Requires: distributed-beget
Requires: commonlibrary_c_utils
Requires: notification_eventhandler
Requires: communication_ipc
Requires: security_device_auth, security_huks
Requires: systemabilitymgr_safwk, systemabilitymgr_samgr
Requires: cjson-devel, openssl-devel
%description
OpenEuler supports distributed softbus capability, which is part of openEuler's embedded capability
The inter-process remote procedure call (RPC) mechanisms are used to implement cross-process communication.
# Decompress source code package, make patches to the source code.
%prep
rm -rf %{_builddir}/*
# Create the directories needed for the build
dsoftbus_build_dir="%{_builddir}/dsoftbus_build"
dsoftbus_prebuilts_build_tools="${dsoftbus_build_dir}/prebuilts/build-tools/linux-x86/bin"
dsoftbus_thirdparty="${dsoftbus_build_dir}/third_party"
dsoftbus_utils="${dsoftbus_build_dir}/utils"
dsoftbus_src="${dsoftbus_build_dir}/foundation/communication"
dsoftbus_hichain="${dsoftbus_build_dir}/base/security"
dsoftbus_bounds_checking="${dsoftbus_thirdparty}/bounds_checking_function"
dsoftbus_productdefine="${dsoftbus_build_dir}/productdefine"
dsoftbus_depend="${dsoftbus_build_dir}/depend"
cp -rf %{build_opt} %{_builddir}/build
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}
mkdir -p ${dsoftbus_prebuilts_build_tools}
mkdir -p ${dsoftbus_thirdparty}
mkdir -p ${dsoftbus_utils}
mkdir -p ${dsoftbus_src}
mkdir -p ${dsoftbus_hichain}
mkdir -p ${dsoftbus_bounds_checking}
mkdir -p ${dsoftbus_productdefine}
mkdir -p ${dsoftbus_depend}
# Decompressing the compressed package
%setup -q -T -D -b 0 -n %{source_dsoftbus_standard}-%{release_dsoftbus_standard}
%setup -q -T -D -b 1 -n %{source_embedded_ipc}-%{release_embedded_ipc}
%setup -q -T -D -b 2 -n %{source_commonlibrary_c_utils}-%{openHarmony_source_release}
%setup -q -T -D -b 3 -n %{source_security_device_auth}-%{openHarmony_source_release}
%setup -q -T -D -b 4 -n %{source_security_huks}-%{openHarmony_source_release}
%setup -q -T -D -b 5 -n %{source_third_party_libcoap}-%{openHarmony_source_release}
%setup -q -T -D -b 6 -n %{source_third_party_mbedtls}-%{openHarmony_source_release}
%setup -q -T -D -b 7 -n %{source_build}-%{release_build}
%setup -q -D -T -a 1 -c -n %{communication_path}
cd %{_builddir}
mv %{source_dsoftbus_standard}-%{release_dsoftbus_standard} %{source_dsoftbus_standard}
mv %{source_embedded_ipc}-%{release_embedded_ipc} %{source_embedded_ipc}
%patch -P1 -p1 -d %{communication_path}/dsoftbus
%patch -P2 -p1 -d %{communication_path}/dsoftbus
%patch -P3 -p1 -d %{communication_path}/dsoftbus
#copy gn
gn_dir=$(which gn)
cp ${gn_dir[0]} ${dsoftbus_prebuilts_build_tools}
# copy ninja
ninja_dir=$(which ninja)
cp ${ninja_dir[0]} ${dsoftbus_prebuilts_build_tools}
%setup -q -D -T -a 2 -c -n %{third_party_path}
mv %{third_party_path}/third_party_sqlite-%{oh_version} %{third_party_path}/sqlite
# unpack third_party
mv %{_builddir}/%{source_build}-%{release_build} ${dsoftbus_build_dir}/build
mkdir %{_builddir}/%{source_build}-%{release_build}
mv %{_builddir}/%{source_third_party_libcoap}-%{openHarmony_source_release} ${dsoftbus_thirdparty}/libcoap
mv %{_builddir}/%{source_third_party_mbedtls}-%{openHarmony_source_release} ${dsoftbus_thirdparty}/mbedtls
mkdir -p ${dsoftbus_thirdparty}/cJSON
# unpack hichain
mv %{_builddir}/%{source_security_huks}-%{openHarmony_source_release} ${dsoftbus_hichain}/huks
mv %{_builddir}/%{source_security_device_auth}-%{openHarmony_source_release} ${dsoftbus_hichain}/deviceauth
# unpack utils
mv %{_builddir}/%{source_commonlibrary_c_utils}-%{openHarmony_source_release} ${dsoftbus_utils}/native
# do patch
%patch -P0 -p1 -d ${dsoftbus_build_dir}/build
%patch -P1 -p1 -d ${dsoftbus_build_dir}/build
%patch -P2 -p1 -d ${dsoftbus_build_dir}/build
%patch -P3 -p1 -d ${dsoftbus_utils}/native
%patch -P4 -p1 -d ${dsoftbus_thirdparty}/mbedtls
%patch -P5 -p1 -d ${dsoftbus_thirdparty}/mbedtls
%patch -P6 -p1 -d ${dsoftbus_thirdparty}/mbedtls
%patch -P7 -p1 -d ${dsoftbus_hichain}/huks
%patch -P8 -p1 -d ${dsoftbus_hichain}/deviceauth
%patch -P9 -p1 -d ${dsoftbus_hichain}/deviceauth
%patch -P10 -p1 -d ${dsoftbus_hichain}/deviceauth
%patch -P11 -p1 -d ${dsoftbus_build_dir}/build
%patch -P12 -p1 -d ${dsoftbus_thirdparty}/bounds_checking_function
%patch -P13 -p1 -d ${dsoftbus_productdefine}
%patch -P14 -p1 -d ${dsoftbus_depend}
%patch -P15 -p1 -d ${dsoftbus_hichain}/huks
%patch -P16 -p1 -d ${dsoftbus_thirdparty}/cJSON
%patch -P17 -p1 -d %{_builddir}/%{source_dsoftbus_standard}
%patch -P18 -p1 -d %{_builddir}/%{source_dsoftbus_standard}
%patch -P19 -p1 -d ${dsoftbus_thirdparty}/libcoap
# init gn root
ln -s ${dsoftbus_build_dir}/build/build_scripts/build.sh ${dsoftbus_build_dir}/build.sh
ln -s ${dsoftbus_build_dir}/build/core/gn/dotfile.gn ${dsoftbus_build_dir}/.gn
# link selfcode
ln -s %{_builddir}/embedded-ipc ${dsoftbus_build_dir}/depend/ipc
ln -s %{_builddir}/dsoftbus_standard ${dsoftbus_src}/dsoftbus
# link toolchain
toolchain_path="/usr1/openeuler/gcc/openeuler_gcc_arm64le"
ln -s ${toolchain_path} ${dsoftbus_build_dir}/toolchain
# copy libboundscheck file
mkdir ${dsoftbus_thirdparty}/bounds_checking_function/include
cp /usr/include/securec*.h ${dsoftbus_thirdparty}/bounds_checking_function/include/
# link cjson
cjson_devel_include="/usr/include/cjson/cJSON.h"
ln -s ${cjson_devel_include} ${dsoftbus_thirdparty}/cJSON/cJSON.h
%ifarch x86_64
sed -i 's/"target_cpu": "arm64"/"target_cpu": "x86_64"/' ${dsoftbus_productdefine}/common/device/openEuler.json
%endif
%setup -q -D -T -a 3 -c -n %{third_party_path}
mv %{third_party_path}/third_party_libcoap-%{oh_version} %{third_party_path}/libcoap
%build
rm -rf %{_builddir}/dsoftbus_build/out
cd %{_builddir}/dsoftbus_build
./build.sh --product-name openEuler
%ifarch x86_64
%{_builddir}/build.sh --product-name openeuler --target-cpu x86_64
%endif
%ifarch aarch64
%{_builddir}/build.sh --product-name openeuler --target-cpu arm64
%endif
%install
dsoftbus_build_dir="%{_builddir}/dsoftbus_build"
%ifarch x86_64
dsoftbus_release_dir_name="ohos-x86_64-release"
%endif
install -d -m 0755 %{buildroot}/%{_includedir}/dsoftbus
install -d -m 0755 %{buildroot}/%{_includedir}/sqlite
install -d -m 0755 %{buildroot}/%{_libdir}
install -d -m 0755 %{buildroot}/system/lib64
install -d -m 0755 %{buildroot}/%{build_opt}/openeuler/compiler_gn/third_party/sqlite/
%ifarch aarch64
dsoftbus_release_dir_name="ohos-arm64-release"
%define header_out_path out/openeuler/innerkits/linux-arm64/dsoftbus
%define module_out_path out/openeuler/linux_clang_arm64
%endif
%ifarch x86_64
%define header_out_path out/openeuler/innerkits/linux-x86_64/dsoftbus
%define module_out_path out/openeuler/linux_clang_x86_64
%endif
install -d %{buildroot}/%{_includedir}/dsoftbus
install -d %{buildroot}/%{_libdir}
install -d %{buildroot}/%{_bindir}
install -d %{buildroot}/data/data/deviceauth/
# install libs and headers from dsoftbus
rm -rf %{_builddir}/%{header_out_path}/softbus_client/inner_kits/transport/inner_session.h
find %{_builddir}/%{header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}/%{_includedir}/dsoftbus/
# prepare so
install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/common/common/*.so %{buildroot}/%{_libdir}
install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/*.so %{buildroot}/%{_libdir}
install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/huks/*.so %{buildroot}/%{_libdir}
install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/deviceauth_standard/*.so %{buildroot}/%{_libdir}
# prepare bin
install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/softbus_server_main %{buildroot}/%{_bindir}
# install libs and headers from dsoftbus
%define dsoftbus_module_path %{module_out_path}/communication/dsoftbus
install -m 0755 %{_builddir}/%{dsoftbus_module_path}/libsoftbus_server.z.so %{buildroot}/%{_libdir}
install -m 0755 %{_builddir}/%{dsoftbus_module_path}/libsoftbus_server.z.so %{buildroot}/system/lib64
# prepare head files
install -m 554 \
${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/discovery/*.h \
${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/common/*.h \
${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/bus_center/*.h \
${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/transport/*.h \
${dsoftbus_build_dir}/foundation/communication/dsoftbus/core/common/include/softbus_errcode.h \
${dsoftbus_build_dir}/base/security/deviceauth/interfaces/innerkits/*.h \
${dsoftbus_build_dir}/third_party/cJSON/*.h \
${dsoftbus_build_dir}/third_party/bounds_checking_function/include/*.h \
%{buildroot}/%{_includedir}/dsoftbus
# install headers and BUILD.gn from third party sqlite
install -m 0755 %{_builddir}/third_party/sqlite/include/*.h %{buildroot}/%{_includedir}/sqlite
install -m 0755 %{_builddir}/%{module_out_path}/common/common/libsqlite.z.so %{buildroot}/%{_libdir}
install -m 0755 %{_builddir}/%{module_out_path}/common/common/libsqlite.z.so %{buildroot}/system/lib64
install -m 0755 %{SOURCE4} %{buildroot}/%{build_opt}/openeuler/compiler_gn/third_party/sqlite/BUILD.gn
%files
%{_includedir}/dsoftbus/*
%{_bindir}/softbus_server_main
%{_libdir}/*.so
/data/data
%{_includedir}/dsoftbus/*
%{_includedir}/sqlite/*
/system/*
%{build_opt}
%changelog
* Mon Sep 25 2023 heppen <hepeng68@huawei.com> - 1.0.0-5
- fix CVE-2023-30364 for libcoap
* Tue Oct 19 2023 Yuying Mu <muyuying1@huawei.com> - 1.0.0-1
* Tue Nov 20 2023 Jiaqi Zhao <zhaojiaqi18@huawei.com> - 1.0.0-1
- Init package
* Wed Sep 20 2023 heppen <hepeng68@huawei.com> - 1.0.0-4
- open udp stream and file feature for dsoftbus
* Wed Nov 30 2022 liheavy <lihaiwei8@huawei.com> - 1.0.0-3
- Disassemble yocto-embedded-tools and replace cjson, ninja, gn, openssl, libboundscheck
- with openEuler software package
* Wed Nov 23 2022 xuchongyu <xuchongyu@huawei.com> - 1.0.0-2
- add URL,change branch of libboundscheck to 22.03-LTS-SP1
* Tue Nov 22 2022 xuchongyu <xuchongyu@huawei.com> - 1.0.0-1
- init dsoftbus

Binary file not shown.

13
sqlite.BUILD.gn Normal file
View File

@ -0,0 +1,13 @@
import("//build/ohos.gni")
config("sqlite_config") {
include_dirs = [
"/usr/include/sqlite",
"sqlite.BUILD.gn",
]
libs = ["sqlite.z"]
}
group("sqlite") {
public_configs = [":sqlite_config"]
}

Binary file not shown.

Binary file not shown.