Upgrade OpenSSL version 52/296152/3 accepted/tizen/unified/20230731.175255
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Thu, 20 Jul 2023 10:51:52 +0000 (12:51 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Thu, 20 Jul 2023 17:58:14 +0000 (19:58 +0200)
Change-Id: I2e1bec24859056fa4c64b096c748b85c592050c4

packaging/crash-worker.spec
src/crash-manager/CMakeLists.txt
src/crash-manager/so-info.c
src/crash-stack/CMakeLists.txt
src/crash-stack/crash-stack.c

index 6422b28..dabd8f3 100644 (file)
@@ -16,7 +16,7 @@
 
 Name:           crash-worker
 Summary:        Coredump handler and report generator for Tizen
-Version:        7.0.1
+Version:        8.0.0
 Release:        1
 Group:          Framework/system
 License:        MIT
@@ -34,7 +34,7 @@ BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(libunwind-generic)
 BuildRequires:  libcap-devel
 BuildRequires:  pkgconfig(json-c)
-BuildRequires:  pkgconfig(openssl1.1)
+BuildRequires:  pkgconfig(openssl3)
 BuildRequires:  pkgconfig(diagnostics)
 BuildRequires:  pkgconfig(bugreport)
 %if %{with dumpsystemstateservice}
index 17735bc..9cccbf8 100644 (file)
@@ -25,7 +25,7 @@ pkg_check_modules(crash-manager_pkgs REQUIRED
        iniparser
        pkgmgr-info
        rpm
-       libcrypto1.1
+       libcrypto3
        diagnostics
        )
 
index d667e68..af0c073 100644 (file)
@@ -25,6 +25,7 @@
 #include "shared/util.h"
 #include <tzplatform_config.h>
 #include <openssl/sha.h>
+#include <openssl/evp.h>
 
 #define BID_SNAME ".note.gnu.build-id"
 
@@ -48,8 +49,10 @@ static bool sha1sum(const char *filename, char *output)
                return false;
        }
 
-       SHA_CTX context;
-       if (SHA1_Init(&context) == 0) {
+       EVP_MD_CTX *ctx = EVP_MD_CTX_create();
+       const EVP_MD *md = EVP_sha1();
+
+       if (EVP_DigestInit_ex(ctx, md, NULL) == 0) {
                _E("Failed to initialize SHA1 context for: %s", filename);
                goto exit;
        }
@@ -66,14 +69,14 @@ static bool sha1sum(const char *filename, char *output)
                        goto exit;
                }
 
-               if (SHA1_Update(&context, buff, bytes) == 0) {
+               if (EVP_DigestUpdate(ctx, buff, bytes) == 0) {
                        _E("Failed to update SHA1 hash sum for: %s", filename);
                        goto exit;
                }
        } while (bytes > 0);
 
        unsigned char hash[SHA_DIGEST_LENGTH];
-       if (SHA1_Final(hash, &context) == 0) {
+       if (EVP_DigestFinal(ctx, hash, 0) == 0) {
                _E("Failed to compute the SHA1 hash sum for: %s", filename);
                goto exit;
        }
@@ -83,6 +86,7 @@ static bool sha1sum(const char *filename, char *output)
 
        result = true;
 exit:
+       EVP_MD_CTX_destroy(ctx);
        close(fd);
        return result;
 }
index 6e00e88..04716af 100644 (file)
@@ -32,7 +32,7 @@ include(FindPkgConfig)
 pkg_check_modules(LIBUNWIND REQUIRED libunwind-generic)
 pkg_check_modules(DLOG REQUIRED dlog)
 pkg_check_modules(JSON REQUIRED json-c)
-pkg_check_modules(LIBCRYPTO REQUIRED libcrypto1.1)
+pkg_check_modules(LIBCRYPTO REQUIRED libcrypto3)
 set_property(TARGET ${CRASH_STACK_BIN} APPEND_STRING PROPERTY COMPILE_FLAGS "${JSON_CFLAGS} ${LIBUNWIND_CFLAGS} ${DLOG_CFLAGS} ${LIBCRYPTO_CFLAGS}")
 
 # Linking
index 16b0e5b..64b9505 100644 (file)
@@ -34,6 +34,7 @@
 #include <limits.h>
 #include <linux/prctl.h>
 #include <openssl/sha.h>
+#include <openssl/evp.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -219,8 +220,9 @@ static void __print_hash(Callstack *callstack, json_object *jobj, struct addr_no
        assert(callstack);
        assert(maps);
 
-       SHA256_CTX hash_ctx;
-       SHA256_Init(&hash_ctx);
+       EVP_MD_CTX *ctx = EVP_MD_CTX_create();
+       const EVP_MD *md = EVP_sha256();
+       EVP_DigestInit_ex(ctx, md, NULL);
 
        for (size_t i = 0; i < callstack->elems; i++) {
                // We won't be able to substract the start address so we skip
@@ -243,11 +245,12 @@ static void __print_hash(Callstack *callstack, json_object *jobj, struct addr_no
                        continue;
                }
                uintptr_t addr = callstack->proc[i].addr + callstack->proc[i].module_offset - m_node->startaddr;
-               SHA256_Update(&hash_ctx, &addr, sizeof(addr));
+               EVP_DigestUpdate(ctx, &addr, sizeof(addr));
        }
 
        unsigned char hash[SHA256_DIGEST_LENGTH];
-       SHA256_Final(hash, &hash_ctx);
+       EVP_DigestFinal_ex(ctx, hash, 0);
+       EVP_MD_CTX_destroy(ctx);
 
        char hash_str[SHA256_DIGEST_LENGTH*2+1];