summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2020-02-22 18:17:12 +0000
committerSteve Holme <steve_holme@hotmail.com>2020-02-22 22:12:27 +0000
commit81c37124341e2c2f80a9c2f60cefaf61143c78b7 (patch)
treeaf934d6f5bb6cabf427ab32ce22a5c5e9ab036b1 /lib
parent84762ff815d946ea104b600598b32c3bb558ad06 (diff)
downloadcurl-81c37124341e2c2f80a9c2f60cefaf61143c78b7.tar.gz
tests: Added a unit test for SHA256 digest generation
Follow up to 2b5b37c. Closes #4968
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_sha256.h8
-rw-r--r--lib/sha256.c6
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/curl_sha256.h b/lib/curl_sha256.h
index 14b6414ea..922e501da 100644
--- a/lib/curl_sha256.h
+++ b/lib/curl_sha256.h
@@ -7,7 +7,8 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -24,8 +25,9 @@
#ifndef CURL_DISABLE_CRYPTO_AUTH
-void Curl_sha256it(unsigned char *outbuffer,
- const unsigned char *input);
+#define SHA256_DIGEST_LENGTH 32
+
+void Curl_sha256it(unsigned char *outbuffer, const unsigned char *input);
#endif
diff --git a/lib/sha256.c b/lib/sha256.c
index bcaaeae30..5127a9edd 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -5,7 +5,8 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -255,6 +256,9 @@ static int SHA256_Final(unsigned char *out,
#endif
+/*
+ * @unittest: 1610
+ */
void Curl_sha256it(unsigned char *outbuffer, /* 32 unsigned chars */
const unsigned char *input)
{