Migrate to openssl 1.1 68/211068/3
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 29 Jul 2019 14:13:25 +0000 (16:13 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Wed, 28 Aug 2019 12:04:03 +0000 (14:04 +0200)
Locking mechanism is not needed anymore

Change-Id: I31397e23593ed99aa7d6cfb219a7eb3f818335d8

build/tizen/adaptor/Makefile.am
build/tizen/adaptor/configure.ac
dali/internal/imaging/common/file-download.cpp
dali/internal/imaging/common/file-download.h
dali/internal/imaging/windows/file-download-win.cpp
packaging/dali-adaptor.spec

index aec1ab8..1c11463 100644 (file)
@@ -460,7 +460,6 @@ LIBDALI_ADAPTOR_LA_CXXFLAGS = \
                       $(LIBDRM_CFLAGS) \
                       $(LIBEXIF_CFLAGS) \
                       $(LIBCURL_CFLAGS) \
-                      $(LIBCRYPTO_CFLAGS) \
                       $(TPKP_CURL_CFLAGS) \
                       $(UTILX_CFLAGS)
 
@@ -489,7 +488,6 @@ LIBDALI_ADAPTOR_LA_LIBADD = \
                       $(LIBDRM_LIBS) \
                       $(LIBEXIF_LIBS) \
                       $(LIBCURL_LIBS) \
-                      $(LIBCRYPTO_LIBS) \
                       $(HARFBUZZ_LIBS) \
                       $(AUTOFILL_LIBS) \
                       $(TPKP_CURL_LIBS) \
index b182ba7..531ba18 100644 (file)
@@ -44,7 +44,6 @@ PKG_CHECK_MODULES(PNG, libpng)
 PKG_CHECK_MODULES(LIBEXIF, libexif)
 PKG_CHECK_MODULES(LIBDRM, libdrm)
 PKG_CHECK_MODULES(LIBCURL, libcurl)
-PKG_CHECK_MODULES(LIBCRYPTO, libcrypto)
 PKG_CHECK_MODULES(HARFBUZZ, harfbuzz)
 PKG_CHECK_MODULES(FRIBIDI, fribidi)
 PKG_CHECK_MODULES(CAIRO, cairo)
index 402e3c0..3a5367e 100755 (executable)
@@ -214,75 +214,18 @@ bool DownloadFile( CURL* curlHandle,
 namespace Network
 {
 
-std::mutex* CurlEnvironment::mMutexs = NULL;
-
 CurlEnvironment::CurlEnvironment()
 {
   // Must be called before we attempt any loads. e.g. by using curl_easy_init()
   // and before we start any threads.
   curl_global_init(CURL_GLOBAL_ALL);
-
- // libcurl with openssl needs locking_function and thread id for threadsafe
- // https://curl.haxx.se/libcurl/c/threadsafe.html
- // https://www.openssl.org/docs/man1.0.2/crypto/threads.html#DESCRIPTION
- // SetLockingFunction sets locking_function and get thread id by the guide.
-  SetLockingFunction();
 }
 
 CurlEnvironment::~CurlEnvironment()
 {
-  UnsetLockingFunction();
-
   curl_global_cleanup();
 }
 
-// libcurl with openssl needs locking_function and thread id for threadsafe
-// https://curl.haxx.se/libcurl/c/threadsafe.html
-// https://www.openssl.org/docs/man1.0.2/crypto/threads.html#DESCRIPTION
-void CurlEnvironment::OnOpenSSLLocking( int mode, int n, const char* file, int line )
-{
-  if( mode & CRYPTO_LOCK )
-  {
-    mMutexs[n].lock();
-  }
-  else
-  {
-    mMutexs[n].unlock();
-  }
-}
-
-void CurlEnvironment::GetThreadId( CRYPTO_THREADID* tid )
-{
-  // If dali uses c++ thread, we may replace pthread_self() to this_thread::get_id()
-  CRYPTO_THREADID_set_numeric( tid, static_cast< unsigned long > ( pthread_self() ) );
-}
-
-void CurlEnvironment::SetLockingFunction()
-{
-  if( mMutexs != NULL )
-  {
-    return;
-  }
-
-  mMutexs = new std::mutex[ CRYPTO_num_locks() ];
-
-  CRYPTO_THREADID_set_callback( &CurlEnvironment::GetThreadId );
-  CRYPTO_set_locking_callback( &CurlEnvironment::OnOpenSSLLocking );
-}
-
-void CurlEnvironment::UnsetLockingFunction()
-{
-  if( mMutexs == NULL )
-  {
-    return;
-  }
-
-  CRYPTO_THREADID_set_callback( NULL );
-  CRYPTO_set_locking_callback( NULL );
-  delete [] mMutexs;
-  mMutexs = NULL;
-}
-
 bool DownloadRemoteFileIntoMemory( const std::string& url,
                                    Dali::Vector<uint8_t>& dataBuffer,
                                    size_t& dataSize,
index f807b22..d53438c 100755 (executable)
@@ -23,7 +23,6 @@
 #include <string>
 #include <mutex> //c++11
 #include <stdint.h> // uint8
-#include <openssl/crypto.h>
 
 namespace Dali
 {
@@ -59,24 +58,6 @@ public:
   CurlEnvironment& operator=( const CurlEnvironment& ) = delete;
   CurlEnvironment( CurlEnvironment&& ) = default;
   CurlEnvironment& operator=( CurlEnvironment&& ) = default;
-
-  /**
-   * Locking function for libcurl with openssl
-   */
-  static void OnOpenSSLLocking( int mode, int n, const char* file, int line );
-
-  /**
-   * Gets thread id for libcurl with openssl
-   */
-  static void GetThreadId( CRYPTO_THREADID* tid );
-
-private:
-
-  void SetLockingFunction();
-
-  void UnsetLockingFunction();
-
-  static std::mutex* mMutexs;
 };
 
 
index a6ab471..198e828 100755 (executable)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 #include <pthread.h>
-#include <openssl/crypto.h>
 #include <cstring>
 #include <curl/curl.h>
 #include <../ExInclude/InternalFileOperation.h>
@@ -224,70 +223,18 @@ bool DownloadFile( CURL* curlHandle,
 namespace Network
 {
 
-std::mutex* CurlEnvironment::mMutexs = NULL;
-
 CurlEnvironment::CurlEnvironment()
 {
   // Must be called before we attempt any loads. e.g. by using curl_easy_init()
   // and before we start any threads.
   curl_global_init(CURL_GLOBAL_ALL);
-
- // libcurl with openssl needs locking_function and thread id for threadsafe
- // https://curl.haxx.se/libcurl/c/threadsafe.html
- // https://www.openssl.org/docs/man1.0.2/crypto/threads.html#DESCRIPTION
- // SetLockingFunction sets locking_function and get thread id by the guide.
-  SetLockingFunction();
 }
 
 CurlEnvironment::~CurlEnvironment()
 {
-  UnsetLockingFunction();
-
   curl_global_cleanup();
 }
 
-// libcurl with openssl needs locking_function and thread id for threadsafe
-// https://curl.haxx.se/libcurl/c/threadsafe.html
-// https://www.openssl.org/docs/man1.0.2/crypto/threads.html#DESCRIPTION
-void CurlEnvironment::OnOpenSSLLocking( int mode, int n, const char* file, int line )
-{
-  if( mode & CRYPTO_LOCK )
-  {
-    mMutexs[n].lock();
-  }
-  else
-  {
-    mMutexs[n].unlock();
-  }
-}
-
-void CurlEnvironment::SetLockingFunction()
-{
-  if( mMutexs != NULL )
-  {
-    return;
-  }
-
-  mMutexs = new std::mutex[ CRYPTO_num_locks() ];
-
-  CRYPTO_set_id_callback( &CurlEnvironment::GetThreadId );
-  CRYPTO_set_locking_callback( &CurlEnvironment::OnOpenSSLLocking );
-}
-
-void CurlEnvironment::UnsetLockingFunction()
-{
-  if( mMutexs == NULL )
-  {
-    return;
-  }
-
-  CRYPTO_set_id_callback( NULL );
-  CRYPTO_set_locking_callback( NULL );
-
-  delete [] mMutexs;
-  mMutexs = NULL;
-}
-
 bool DownloadRemoteFileIntoMemory( const std::string& url,
                                    Dali::Vector<uint8_t>& dataBuffer,
                                    size_t& dataSize,
index fa75951..83073b2 100644 (file)
@@ -65,7 +65,6 @@ BuildRequires:  fribidi-devel
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-system-sensor)
 
-BuildRequires:  pkgconfig(libcrypto)
 BuildRequires:  pkgconfig(cairo)
 
 BuildRequires:  pkgconfig(wayland-egl)