externalized checksum from build module for verify module consumption to constrain dependency tree to build module

master
Chris Punches 2025-03-31 23:32:19 -04:00
parent 81645c6d09
commit d41c9a65e3
2 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@
* *
* @return String containing the name of the hash algorithm to use * @return String containing the name of the hash algorithm to use
*/ */
std::string get_configured_hash_algorithm(); extern "C" std::string get_configured_hash_algorithm();
/** /**
* @brief Gets a list of available digest algorithms from OpenSSL * @brief Gets a list of available digest algorithms from OpenSSL
@ -42,7 +42,7 @@ std::string get_configured_hash_algorithm();
* *
* @return String containing comma-separated list of available algorithms * @return String containing comma-separated list of available algorithms
*/ */
std::string get_available_algorithms(); extern "C" std::string get_available_algorithms();
/** /**
* @brief Generates a file checksum using the configured hashing algorithm * @brief Generates a file checksum using the configured hashing algorithm
@ -54,7 +54,7 @@ std::string get_available_algorithms();
* @param file_path Path to the file to be hashed * @param file_path Path to the file to be hashed
* @return String containing the hexadecimal representation of the checksum, or empty string on error * @return String containing the hexadecimal representation of the checksum, or empty string on error
*/ */
std::string generate_file_checksum(const std::filesystem::path& file_path); extern "C" std::string generate_file_checksum(const std::filesystem::path& file_path);
/** /**
* @brief Generates a checksum of a string using the configured hashing algorithm * @brief Generates a checksum of a string using the configured hashing algorithm
@ -65,4 +65,4 @@ std::string generate_file_checksum(const std::filesystem::path& file_path);
* @param input_string The string to be hashed * @param input_string The string to be hashed
* @return String containing the hexadecimal representation of the checksum, or empty string on error * @return String containing the hexadecimal representation of the checksum, or empty string on error
*/ */
std::string generate_string_checksum(const std::string& input_string); extern "C" std::string generate_string_checksum(const std::string& input_string);

View File

@ -13,7 +13,7 @@
#include "checksums.hpp" #include "checksums.hpp"
std::string get_configured_hash_algorithm() extern "C" std::string get_configured_hash_algorithm()
{ {
const char* algorithm = dpm_get_config("cryptography", "checksum_algorithm"); const char* algorithm = dpm_get_config("cryptography", "checksum_algorithm");
if (algorithm && strlen(algorithm) > 0) { if (algorithm && strlen(algorithm) > 0) {
@ -24,7 +24,7 @@ std::string get_configured_hash_algorithm()
return "sha256"; return "sha256";
} }
std::string get_available_algorithms() extern "C" std::string get_available_algorithms()
{ {
std::vector<std::string> algorithms; std::vector<std::string> algorithms;
std::vector<std::string> working_algorithms; std::vector<std::string> working_algorithms;
@ -83,7 +83,7 @@ std::string get_available_algorithms()
return result.str(); return result.str();
} }
std::string generate_file_checksum(const std::filesystem::path& file_path) extern "C" std::string generate_file_checksum(const std::filesystem::path& file_path)
{ {
// Get configured algorithm // Get configured algorithm
std::string algorithm_name = get_configured_hash_algorithm(); std::string algorithm_name = get_configured_hash_algorithm();
@ -170,7 +170,7 @@ std::string generate_file_checksum(const std::filesystem::path& file_path)
return ss.str(); return ss.str();
} }
std::string generate_string_checksum(const std::string& input_string) extern "C" std::string generate_string_checksum(const std::string& input_string)
{ {
// Get configured algorithm // Get configured algorithm
std::string algorithm_name = get_configured_hash_algorithm(); std::string algorithm_name = get_configured_hash_algorithm();