Tizen 5.x migration from OpenSSL 1.0.2 to OpenSSL 1.1.1 00/207900/1 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv accepted/tizen/5.5/unified/20191031.024920 accepted/tizen/5.5/unified/mobile/hotfix/20201027.084655 accepted/tizen/unified/20190614.051509 submit/tizen/20190614.020945 submit/tizen_5.5/20191031.000003 submit/tizen_5.5_mobile_hotfix/20201026.185103 tizen_5.5.m2_release
authorJihoon Jung <jh8801.jung@samsung.com>
Fri, 14 Jun 2019 02:06:07 +0000 (11:06 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Fri, 14 Jun 2019 02:06:07 +0000 (11:06 +0900)
Change-Id: If9016adc7e0bb552f8172991a5e996e29742754c
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
common/CMakeLists.txt
common/OpensslHelper.cpp
packaging/smartcard-service.spec

index 224e6bc..8677f14 100644 (file)
@@ -15,7 +15,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SRCS)
 #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs_common REQUIRED glib-2.0 gio-unix-2.0 dlog aul libssl libcrypto pkgmgr pkgmgr-info)
+pkg_check_modules(pkgs_common REQUIRED glib-2.0 gio-unix-2.0 dlog aul openssl1.1 pkgmgr pkgmgr-info)
 
 MESSAGE("${LIB_NAME} ld flag : ${pkgs_common_LDFLAGS}")
 
index d71ab25..c34d657 100644 (file)
@@ -144,20 +144,38 @@ namespace smartcard_service_api
 
                if ((md = EVP_get_digestbyname(algorithm)) != NULL) {
                        uint8_t temp[EVP_MAX_MD_SIZE] = { 0, };
+#if OPENSSL_VERSION_NUMBER < 0x10100000L // OpenSSL 1.0.2
                        EVP_MD_CTX mdCtx;
+#else // OpenSSL 1.1.1
+                       EVP_MD_CTX *mdCtx;
+                       mdCtx = EVP_MD_CTX_new();
+#endif
                        unsigned int resultLen = 0;
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L // OpenSSL 1.0.2
                        if (EVP_DigestInit(&mdCtx, md) > 0) {
                                if (EVP_DigestUpdate(&mdCtx, buffer.getBuffer(), buffer.size()) == 0) {
+#else // OpenSSL 1.1.1
+                       if (EVP_DigestInit(mdCtx, md) > 0) {
+                               if (EVP_DigestUpdate(mdCtx, buffer.getBuffer(), buffer.size()) == 0) {
+#endif
                                        _ERR("EVP_DigestUpdate failed");
                                }
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L // OpenSSL 1.0.2
                                if (EVP_DigestFinal(&mdCtx, temp, &resultLen) > 0 &&
                                        resultLen > 0) {
+#else // OpenSSL 1.1.1
+                               if (EVP_DigestFinal(mdCtx, temp, &resultLen) > 0 &&
+                                       resultLen > 0) {
+#endif
                                        result.assign(temp, resultLen);
                                        ret = true;
                                }
                        }
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L // OpenSSL 1.1.1
+                       EVP_MD_CTX_free(mdCtx);
+#endif
                } else {
                        _ERR("EVP_get_digestbyname(\"%s\") returns NULL", algorithm);
                }
index ec62fb9..ab1a2e2 100755 (executable)
@@ -10,8 +10,7 @@ BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-unix-2.0)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(libssl)
-BuildRequires: pkgconfig(libcrypto)
+BuildRequires: pkgconfig(openssl1.1)
 BuildRequires: pkgconfig(pkgmgr)
 BuildRequires: pkgconfig(pkgmgr-info)
 BuildRequires: pkgconfig(cynara-client)