Migrate to openssl 3.0 20/296120/1 accepted/tizen_8.0_unified accepted/tizen_unified_riscv tizen_8.0 accepted/tizen/8.0/unified/20231005.093931 accepted/tizen/unified/20230725.012950 accepted/tizen/unified/riscv/20230724.093755 tizen_8.0_m2_release
authorWootak Jung <wootak.jung@samsung.com>
Thu, 20 Jul 2023 05:26:56 +0000 (14:26 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 20 Jul 2023 05:26:56 +0000 (14:26 +0900)
Change-Id: I124bc28d9208d5e54c06fffba85ce487c3ec84d0
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
CMakeLists.txt
packaging/tel-plugin-manager.spec
src/manager_sim.c

index 0f9c094f3df72850c657aa56bfc02f40baa7338e..4d97774598e1d598acdab0f4719c8152e4b1a62a 100644 (file)
@@ -18,7 +18,7 @@ pkg_check_modules(pkgs REQUIRED
        tcore
        libxml-2.0
        vconf
-       openssl1.1
+       openssl3
        tfeature
        capi-system-device
        capi-system-info
index 5c2d76dc1c820cce3bf2b0d08a63dacb0c5a0bd6..da0e82c8820e3d9c92d9540ff1c3104c143322d9 100644 (file)
@@ -16,7 +16,7 @@ BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(tcore)
 BuildRequires:  pkgconfig(vconf)
-BuildRequires:  pkgconfig(openssl1.1)
+BuildRequires:  pkgconfig(openssl3)
 BuildRequires:  pkgconfig(tfeature)
 BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-session)
index 0ac6cc7955aa3cff6b83a7281f642b39939fe34b..7d31fd85431b1c09e95b28dcccfcac8db0d1be0d 100644 (file)
@@ -31,7 +31,7 @@
 #include <manager.h>
 #include <core_object.h>
 #include <co_sim.h>
-#include <openssl/sha.h>
+#include <openssl/evp.h>
 
 #include "storage.h"
 #include "manager_core.h"
@@ -341,19 +341,27 @@ static gboolean __are_both_sims_ready_after_boot(Manager *manager)
 static gchar* __generate_hash(gchar *txt)
 {
        gchar *txt_hash = NULL;
-       SHA256_CTX ctx;
-       unsigned char md[SHA256_DIGEST_LENGTH];
-       int i;
+       EVP_MD_CTX *md_ctx;
+       const EVP_MD *sha256;
+       unsigned char md[EVP_MAX_MD_SIZE];
+       unsigned int md_len;
+       unsigned int i;
 
        if (g_strcmp0((const char *)txt, "") == 0) {
                return txt_hash;
        }
-       SHA256_Init(&ctx);
-       SHA256_Update(&ctx, txt, strlen(txt));
-       SHA256_Final(md, &ctx);
-       txt_hash = g_malloc0(SHA256_DIGEST_LENGTH * 2 + 1);
-       for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
+
+       md_ctx = EVP_MD_CTX_new();
+       sha256 = EVP_sha256();
+
+       EVP_DigestInit_ex(md_ctx, sha256, NULL);
+       EVP_DigestUpdate(md_ctx, txt, strlen(txt));
+       EVP_DigestFinal_ex(md_ctx, md, &md_len);
+
+       txt_hash = g_malloc0(md_len * 2 + 1);
+       for (i = 0; i < md_len; i++)
                snprintf(txt_hash + (i * 2), 3, "%02x", md[i]);
+       EVP_MD_CTX_free(md_ctx);
        return txt_hash;
 }