summary refs log tree commit diff stats
path: root/src/common/util.c
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-12-18 13:43:01 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-12-18 13:43:01 -0300
commit014b242df803089c34084de3d806a7c4e4dad75e (patch)
tree12dd5534a445fedc63b8219e48951bff0b3d2283 /src/common/util.c
parentd049be950cfaca6311b575890e81521d62db68d7 (diff)
parentbb7a03e9f68a775ca93dd6ad8ea61e4f1d2ba81b (diff)
Merge remote-tracking branch 'upstream/master' into default
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index fa0783d4..f06074fc 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1375,11 +1375,16 @@ str_sha256hash (char *string)
 	int i;
 	unsigned char hash[SHA256_DIGEST_LENGTH];
 	char buf[SHA256_DIGEST_LENGTH * 2 + 1];		/* 64 digit hash + '\0' */
+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+	SHA256 (string, strlen (string), hash);
+#else
 	SHA256_CTX sha256;
 
 	SHA256_Init (&sha256);
 	SHA256_Update (&sha256, string, strlen (string));
 	SHA256_Final (hash, &sha256);
+#endif
 
 	for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
 	{