From e35205a0c4f8d80dc9e878049a0fb0eb18f61dbf Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Jun 2017 01:04:56 +0200 Subject: 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 --- lib/vtls/gtls.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/vtls/gtls.c') diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index 303afafba..ac5fe3321 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -1738,10 +1738,10 @@ CURLcode Curl_gtls_random(struct Curl_easy *data, return CURLE_OK; } -void Curl_gtls_md5sum(unsigned char *tmp, /* input */ - size_t tmplen, - unsigned char *md5sum, /* output */ - size_t md5len) +static CURLcode Curl_gtls_md5sum(unsigned char *tmp, /* input */ + size_t tmplen, + unsigned char *md5sum, /* output */ + size_t md5len) { #if defined(USE_GNUTLS_NETTLE) struct md5_ctx MD5pw; @@ -1755,6 +1755,7 @@ void Curl_gtls_md5sum(unsigned char *tmp, /* input */ memcpy(md5sum, gcry_md_read(MD5pw, 0), md5len); gcry_md_close(MD5pw); #endif + return CURLE_OK; } void Curl_gtls_sha256sum(const unsigned char *tmp, /* input */ @@ -1804,7 +1805,8 @@ const struct Curl_ssl Curl_ssl_gnutls = { Curl_none_set_engine, /* set_engine */ Curl_none_set_engine_default, /* set_engine_default */ Curl_none_engines_list, /* engines_list */ - Curl_none_false_start /* false_start */ + Curl_none_false_start, /* false_start */ + Curl_gtls_md5sum /* md5sum */ }; const struct Curl_ssl *Curl_ssl = &Curl_ssl_gnutls; -- cgit v1.2.3