From 66355ab45c8054333dcefb5abd1c8cfc207054d2 Mon Sep 17 00:00:00 2001 From: luciferWei Date: Fri, 25 Jul 2025 10:24:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Feat=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=97=AE=E9=A2=98=E5=92=8C=E7=BC=96=E8=AF=91=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20=20\nSigned-off-by:=20LuciferWei=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luciferWei --- BUILD.gn | 10 +++++++++- credential/BUILD.gn | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index a8412e96..a3a450f6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -65,7 +65,10 @@ config("hdc_config") { "src/common", "${py_out_dir}", ] - cflags_cc = [ "-std=c++17" ] + cflags_cc = [ + "-std=c++17", + "-D_FORTIFY_SOURCE=2", + ] if (is_mingw) { cflags_cc += [ "-Wno-inconsistent-dllimport" ] # in mingw some sec api will # overwrite by utilsecurec @@ -252,6 +255,7 @@ template("build_hdc") { if (image_name == "system") { if (product_name != "ohos-sdk" || is_emulator) { ohos_executable("hdcd_${image_name}_exe") { + branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true @@ -313,6 +317,7 @@ template("build_hdc") { } } else { ohos_executable("hdcd_${image_name}_exe") { + branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true @@ -402,6 +407,9 @@ ohos_executable("hdc") { ] if (is_ohos) { + if (build_variant == "user") { + defines += [ "IS_RELEASE_VERSION" ] + } sources += [ "src/common/credential_message.cpp" ] sources += [ "src/common/hdc_huks.cpp" ] sources += [ "src/common/password.cpp" ] diff --git a/credential/BUILD.gn b/credential/BUILD.gn index 0e7ad211..38fed3e9 100644 --- a/credential/BUILD.gn +++ b/credential/BUILD.gn @@ -27,6 +27,9 @@ config("hdc_config") { ohos_executable("hdc_credential_exec") { if (hdc_feature_support_credential) { + if (build_variant == "user") { + defines += [ "IS_RELEASE_VERSION" ] + } use_exceptions = true ldflags = [ "-Wl,--whole-archive", -- Gitee From 2af7ac742ddbdb81ffeb74c4e89d3b27d015cac7 Mon Sep 17 00:00:00 2001 From: luciferWei Date: Fri, 25 Jul 2025 11:51:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Feat=EF=BC=9A=E4=BF=AE=E6=94=B9=20=20\nSign?= =?UTF-8?q?ed-off-by:=20LuciferWei=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luciferWei --- BUILD.gn | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index a3a450f6..794c6552 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -65,10 +65,7 @@ config("hdc_config") { "src/common", "${py_out_dir}", ] - cflags_cc = [ - "-std=c++17", - "-D_FORTIFY_SOURCE=2", - ] + cflags_cc = [ "-std=c++17" ] if (is_mingw) { cflags_cc += [ "-Wno-inconsistent-dllimport" ] # in mingw some sec api will # overwrite by utilsecurec -- Gitee