aboutsummaryrefslogtreecommitdiff
path: root/lib/vtls/vtls.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-06-23 01:04:56 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-08-28 14:56:56 +0200
commite35205a0c4f8d80dc9e878049a0fb0eb18f61dbf (patch)
tree1bca113b655e95ab19bd2f04d408d1e1ca7b2026 /lib/vtls/vtls.c
parent52e8237bfc66a2a8324dbb558c1f0704aa0f8c0e (diff)
vtls: move md5sum into the Curl_ssl struct
The MD5 summing is also an SSL backend-specific function. So let's include it, offering the previous fall-back code as a separate function now: Curl_none_md5sum(). To allow for that, the signature had to be changed so that an error could be returned from the implementation (Curl_none_md5sum() can run out of memory). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'lib/vtls/vtls.c')
-rw-r--r--lib/vtls/vtls.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
index 44faf1c33..88ee1a759 100644
--- a/lib/vtls/vtls.c
+++ b/lib/vtls/vtls.c
@@ -938,20 +938,7 @@ CURLcode Curl_ssl_md5sum(unsigned char *tmp, /* input */
unsigned char *md5sum, /* output */
size_t md5len)
{
-#ifdef curlssl_md5sum
- curlssl_md5sum(tmp, tmplen, md5sum, md5len);
-#else
- MD5_context *MD5pw;
-
- (void) md5len;
-
- MD5pw = Curl_MD5_init(Curl_DIGEST_MD5);
- if(!MD5pw)
- return CURLE_OUT_OF_MEMORY;
- Curl_MD5_update(MD5pw, tmp, curlx_uztoui(tmplen));
- Curl_MD5_final(MD5pw, md5sum);
-#endif
- return CURLE_OK;
+ return Curl_ssl->md5sum(tmp, tmplen, md5sum, md5len);
}
#endif
@@ -1055,4 +1042,19 @@ bool Curl_none_false_start(void)
return FALSE;
}
+CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
+ unsigned char *md5sum, size_t md5len UNUSED_PARAM)
+{
+ MD5_context *MD5pw;
+
+ (void)md5len;
+
+ MD5pw = Curl_MD5_init(Curl_DIGEST_MD5);
+ if(!MD5pw)
+ return CURLE_OUT_OF_MEMORY;
+ Curl_MD5_update(MD5pw, input, curlx_uztoui(inputlen));
+ Curl_MD5_final(MD5pw, md5sum);
+ return CURLE_OK;
+}
+
#endif /* USE_SSL */