From 94ab063a35b67b9940effdcd55936246b46ee0e4 Mon Sep 17 00:00:00 2001 From: Jaroslav Rohel Date: Wed, 2 Feb 2022 18:00:39 +0100 Subject: [PATCH] Remove class `SHA1Hash`, which is no longer used, remove OpenSSL require The class was used by the `dnf_sack_get_rpmdb_version` function, which was removed. The `rpmdbCookie` function from librpm is used instead. --- CMakeLists.txt | 1 - libdnf.spec | 1 - libdnf/CMakeLists.txt | 1 - libdnf/utils/CMakeLists.txt | 1 - libdnf/utils/crypto/CMakeLists.txt | 5 ----- libdnf/utils/crypto/sha1.cpp | 36 ------------------------------ libdnf/utils/crypto/sha1.hpp | 25 --------------------- 7 files changed, 70 deletions(-) delete mode 100644 libdnf/utils/crypto/CMakeLists.txt delete mode 100644 libdnf/utils/crypto/sha1.cpp delete mode 100644 libdnf/utils/crypto/sha1.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3270c7aaad..9eb9d16c32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ endif() # build dependencies find_package(Gpgme REQUIRED) find_package(LibSolv 0.6.30 REQUIRED COMPONENTS ext) -find_package(OpenSSL REQUIRED) # build dependencies via pkg-config diff --git a/libdnf.spec b/libdnf.spec index b38b20753f..60db94d97c 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -83,7 +83,6 @@ BuildRequires: pkgconfig(zck) >= 0.9.11 BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(json-c) BuildRequires: pkgconfig(cppunit) -BuildRequires: pkgconfig(libcrypto) BuildRequires: pkgconfig(modulemd-2.0) >= %{libmodulemd_version} BuildRequires: pkgconfig(smartcols) BuildRequires: gettext diff --git a/libdnf/CMakeLists.txt b/libdnf/CMakeLists.txt index 998a6f94a3..9e71d139f1 100644 --- a/libdnf/CMakeLists.txt +++ b/libdnf/CMakeLists.txt @@ -75,7 +75,6 @@ target_link_libraries(libdnf ${GLIB_GIO_UNIX_LIBRARIES} ${LIBSOLV_LIBRARY} ${LIBSOLV_EXT_LIBRARY} - ${OPENSSL_CRYPTO_LIBRARY} ${RPM_LIBRARIES} ${SCOLS_LIBRARIES} ${SQLite3_LIBRARIES} diff --git a/libdnf/utils/CMakeLists.txt b/libdnf/utils/CMakeLists.txt index 71a1042cd4..4ec456ef81 100644 --- a/libdnf/utils/CMakeLists.txt +++ b/libdnf/utils/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(bgettext) -add_subdirectory(crypto) add_subdirectory(iniparser) add_subdirectory(regex) add_subdirectory(sqlite3) diff --git a/libdnf/utils/crypto/CMakeLists.txt b/libdnf/utils/crypto/CMakeLists.txt deleted file mode 100644 index 149d100cc3..0000000000 --- a/libdnf/utils/crypto/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(UTILS_SOURCES - ${UTILS_SOURCES} - ${CMAKE_CURRENT_SOURCE_DIR}/sha1.cpp - PARENT_SCOPE -) diff --git a/libdnf/utils/crypto/sha1.cpp b/libdnf/utils/crypto/sha1.cpp deleted file mode 100644 index 1533ee6b2b..0000000000 --- a/libdnf/utils/crypto/sha1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#include -#include - -#include "sha1.hpp" - - -SHA1Hash::SHA1Hash() -{ - md_ctx = EVP_MD_CTX_new(); - EVP_DigestInit_ex(md_ctx, EVP_sha1(), NULL); -} - - -void -SHA1Hash::update(const char * data) -{ - EVP_DigestUpdate(md_ctx, data, strlen(data)); -} - - -std::string -SHA1Hash::hexdigest() -{ - unsigned char md[digestLength]; - EVP_DigestFinal_ex(md_ctx, md, NULL); - - std::stringstream ss; - for(int i=0; i(md[i]); - } - - EVP_MD_CTX_free(md_ctx); - return ss.str(); -} diff --git a/libdnf/utils/crypto/sha1.hpp b/libdnf/utils/crypto/sha1.hpp deleted file mode 100644 index 9f1dfdebab..0000000000 --- a/libdnf/utils/crypto/sha1.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include - - -/* -USAGE: - -SHA1Hash h; -h.update("foo"); -h.update("bar"); -std::cout << h.hexdigest() << std::endl; -*/ - - -class SHA1Hash { -public: - SHA1Hash(); - void update(const char *data); - std::string hexdigest(); - static constexpr int digestLength = SHA_DIGEST_LENGTH; - -private: - EVP_MD_CTX *md_ctx; -};