Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions libglusterfs/src/common-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@
#define AI_ADDRCONFIG 0
#endif /* AI_ADDRCONFIG */

#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
#include <openssl/evp.h>
#endif

char *vol_type_str[] = {
"Distribute",
Expand Down Expand Up @@ -4187,18 +4185,10 @@ int
glusterfs_compute_sha256(const unsigned char *content, size_t size,
char *sha256_hash)
{
#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0

EVP_Digest((const unsigned char *)(content), size,
(unsigned char *)sha256_hash, NULL, EVP_sha256(), NULL);
#else
SHA256_CTX sha256;

SHA256_Init(&sha256);
SHA256_Update(&sha256, (const unsigned char *)(content), size);
SHA256_Final((unsigned char *)sha256_hash, &sha256);
if (EVP_Digest(content, size, (unsigned char *)sha256_hash, NULL,
EVP_sha256(), NULL) != 1)
return -1;

#endif
return 0;
}

Expand Down