From eced64df839a5dfcafbc7bcdf186c2fdd92b0753 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 24 Dec 2020 19:51:55 +0900 Subject: [PATCH] Use trusted message port for secure audio transmission Change-Id: I296a0d86cd8ba53ad7437738725893e172052c1a --- CMakeLists.txt | 2 ++ client/ma_ap_dbus.c | 8 ++++++++ packaging/multi-assistant.spec | 9 ++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1192d1b..d05707a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,8 @@ pkg_check_modules(pkgs REQUIRED capi-base-common ecore-wayland capi-system-info cynara-client cynara-session dbus-1 dlog ecore bundle capi-message-port glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 vconf ) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_TRUSTED_MESSAGE_PORT=${USE_TRUSTED_MESSAGE_PORT}") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_TRUSTED_MESSAGE_PORT=${USE_TRUSTED_MESSAGE_PORT}") ## API ## ADD_SUBDIRECTORY(include) diff --git a/client/ma_ap_dbus.c b/client/ma_ap_dbus.c index 4e13401..716484f 100644 --- a/client/ma_ap_dbus.c +++ b/client/ma_ap_dbus.c @@ -121,7 +121,11 @@ static void message_port_cb(int local_port_id, static int streaming_ipc_initialize() { +#if USE_TRUSTED_MESSAGE_PORT + int port_id = message_port_register_trusted_local_port(message_port, message_port_cb, NULL); +#else int port_id = message_port_register_local_port(message_port, message_port_cb, NULL); +#endif if (port_id < 0) { MA_SLOGD("Port register error: %d", port_id); } else { @@ -134,7 +138,11 @@ static int streaming_ipc_initialize() static int streaming_ipc_deinitialize() { +#if USE_TRUSTED_MESSAGE_PORT + if (-1 != g_local_port_id) message_port_unregister_trusted_local_port(g_local_port_id); +#else if (-1 != g_local_port_id) message_port_unregister_local_port(g_local_port_id); +#endif g_local_port_id = -1; return 0; } diff --git a/packaging/multi-assistant.spec b/packaging/multi-assistant.spec index f9d4df5..1cff0c9 100644 --- a/packaging/multi-assistant.spec +++ b/packaging/multi-assistant.spec @@ -74,8 +74,15 @@ export LDFLAGS+=" -lgcov" export CFLAGS+=" -Wno-stringop-overflow -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation" export CXXFLAGS+=" -Wno-stringop-overflow -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation" + %cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN \ +%if "%{?profile}" == "tv" + -DUSE_TRUSTED_MESSAGE_PORT="1" \ +%else + -DUSE_TRUSTED_MESSAGE_PORT="0" \ +%endif + make %{?jobs:-j%jobs} %if 0%{?gcov:1} -- 2.34.1