summaryrefslogtreecommitdiff
path: root/lib/sha256.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2018-05-15 16:43:56 +0200
committerBrad King <brad.king@kitware.com>2018-05-18 10:16:12 -0400
commitd431136e029c652f5913bcebeaab3b9236b114c4 (patch)
treec0838b4432a3786a323c94a680bb16f644198311 /lib/sha256.c
parentaf9e654045f11028e50dac4781e297834129a749 (diff)
downloadcmake-d431136e029c652f5913bcebeaab3b9236b114c4.tar.gz
curl 2018-05-15 (cb013830)
Code extracted from: https://github.com/curl/curl.git at commit cb013830383f1ccc9757aba36bc32df5ec281c02 (curl-7_60_0).
Diffstat (limited to 'lib/sha256.c')
-rw-r--r--lib/sha256.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/sha256.c b/lib/sha256.c
index cd81c02541..55716c63b0 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -29,9 +29,17 @@
#if defined(USE_OPENSSL)
+#include <openssl/opensslv.h>
+
+#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+#define USE_OPENSSL_SHA256
+#endif
+
+#endif
+
+#ifdef USE_OPENSSL_SHA256
/* When OpenSSL is available we use the SHA256-function from OpenSSL */
#include <openssl/sha.h>
-
#else
/* When no other crypto library is available we use this code segment */
@@ -234,7 +242,7 @@ static int SHA256_Final(unsigned char *out,
sha256_compress(md, md->buf);
md->curlen = 0;
}
- /* pad upto 56 bytes of zeroes */
+ /* pad up to 56 bytes of zeroes */
while(md->curlen < 56) {
md->buf[md->curlen++] = (unsigned char)0;
}