summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/curl_sha256.h3
-rw-r--r--lib/sha256.c20
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/curl_sha256.h b/lib/curl_sha256.h
index 0fceb6329..b4579d769 100644
--- a/lib/curl_sha256.h
+++ b/lib/curl_sha256.h
@@ -24,6 +24,9 @@
***************************************************************************/
#ifndef CURL_DISABLE_CRYPTO_AUTH
+#include "curl_hmac.h"
+
+extern const struct HMAC_params Curl_HMAC_SHA256[1];
#define SHA256_DIGEST_LENGTH 32
diff --git a/lib/sha256.c b/lib/sha256.c
index 910d7ae1e..c64ee0936 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -27,6 +27,7 @@
#include "warnless.h"
#include "curl_sha256.h"
+#include "curl_hmac.h"
#if defined(USE_OPENSSL)
@@ -491,4 +492,23 @@ void Curl_sha256it(unsigned char *output, const unsigned char *input,
SHA256_Final(output, &ctx);
}
+
+const struct HMAC_params Curl_HMAC_SHA256[] = {
+ {
+ /* Hash initialization function. */
+ CURLX_FUNCTION_CAST(HMAC_hinit_func, SHA256_Init),
+ /* Hash update function. */
+ CURLX_FUNCTION_CAST(HMAC_hupdate_func, SHA256_Update),
+ /* Hash computation end function. */
+ CURLX_FUNCTION_CAST(HMAC_hfinal_func, SHA256_Final),
+ /* Size of hash context structure. */
+ sizeof(SHA256_CTX),
+ /* Maximum key length. */
+ 64,
+ /* Result size. */
+ 32
+ }
+};
+
+
#endif /* CURL_DISABLE_CRYPTO_AUTH */