Enable ssl thread locking function on TV profile only 57/217257/1 submit/tizen_5.5/20191107.131452
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 8 Nov 2019 04:21:47 +0000 (13:21 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 8 Nov 2019 04:30:14 +0000 (13:30 +0900)
TV profile doesn't use openssl 1.1 yet.
So, this patch defines thread locking function for TV profile temporaly.
It will be removed or disabled after openssl 1.1 is applied to TV.

Change-Id: I60860df9cd656bab49cb244e7439ae9c227702d4

agent/CMakeLists.txt
agent/download-agent-dl-info.c
agent/download-agent-interface.c
agent/include/download-agent-dl-info.h
packaging/download-provider.spec

index 4b0db83..718f080 100755 (executable)
@@ -96,6 +96,11 @@ IF (SUPPORT_OMA_DRM)
        ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
 ENDIF (SUPPORT_OMA_DRM)
 
+IF (USE_SSL_THREAD_LOCKING)
+       MESSAGE("USE_SSL_THREAD_LOCKING(openssl<=1.0):On")
+       ADD_DEFINITIONS("-DUSE_SSL_THREAD_LOCKING")
+ENDIF (USE_SSL_THREAD_LOCKING)
+
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -Wall -Werror -Werror-implicit-function-declaration")
 IF (BUILD_GTESTS)
        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=default")
index b1d42a7..fbb0233 100644 (file)
 #include <curl/curl.h>
 #include <openssl/crypto.h>
 
+#ifdef USE_SSL_THREAD_LOCKING
+#include <openssl/crypto.h>
+#endif
+
 #include "download-agent-dl-info.h"
 #include "download-agent-http-mgr.h"
 #include "download-agent-http-msg-handler.h"
 
 static pthread_mutex_t mutex_da_info_list = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t *g_openssl_locks_list;
 da_info_t *da_info_list[DA_MAX_ID];
 
+#ifdef USE_SSL_THREAD_LOCKING
+static pthread_mutex_t *g_openssl_locks_list;
+
 /* locking mechnism for safe use of openssl context */
 static void openssl_lock_callback(int mode, int type, char *file, int line)
 {
@@ -80,6 +86,7 @@ da_ret_t deinit_openssl_locks(void)
 
        return DA_RESULT_OK;
 }
+#endif
 
 static void __init_da_info(int id)
 {
index 9b16308..58f865b 100755 (executable)
@@ -21,8 +21,10 @@ int da_init()
 {
        DA_LOGV("");
        da_ret_t ret = DA_RESULT_OK;
+#ifdef USE_SSL_THREAD_LOCKING
        ret = init_openssl_locks();
        DA_LOGI("Return ret = %d", ret);
+#endif
        return ret;
 }
 
@@ -32,7 +34,9 @@ int da_deinit()
 
        DA_LOGV("");
        destroy_da_info_list();
+#ifdef USE_SSL_THREAD_LOCKING
        deinit_openssl_locks();
+#endif
        DA_LOGI("====== da_deint EXIT =====");
        return ret;
 }
index 50192e9..44ebe25 100644 (file)
@@ -181,8 +181,11 @@ extern da_info_t *da_info_list[DA_MAX_ID];
        DA_MUTEX_UNLOCK(&GET_STATE_MUTEX(INFO));\
        }
 
+#ifdef USE_SSL_THREAD_LOCKING
 da_ret_t init_openssl_locks(void);
 da_ret_t deinit_openssl_locks(void);
+#endif
+
 da_ret_t get_available_da_id(int *available_id);
 da_ret_t copy_user_input_data(da_info_t *da_info, const char *url,
                req_data_t *ext_data, da_cb_t *da_cb_data);
index 197f060..762736a 100755 (executable)
@@ -120,6 +120,9 @@ export LDFLAGS+=" -lgcov"
        -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
        -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
        -DSUPPORT_LARGE_FILE:BOOL=ON \
+%if "%{?tizen_profile_name}" == "tv"
+       -DUSE_SSL_THREAD_LOCKING:BOOL=ON \
+%endif
        .
 
 make %{?jobs:-j%jobs}