aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/vtls/axtls.c3
-rw-r--r--lib/vtls/cyassl.c3
-rw-r--r--lib/vtls/darwinssl.c12
-rw-r--r--lib/vtls/darwinssl.h5
-rw-r--r--lib/vtls/gskit.c3
-rw-r--r--lib/vtls/gtls.c12
-rw-r--r--lib/vtls/gtls.h5
-rw-r--r--lib/vtls/mbedtls.c3
-rw-r--r--lib/vtls/nss.c13
-rw-r--r--lib/vtls/nssg.h6
-rw-r--r--lib/vtls/openssl.c12
-rw-r--r--lib/vtls/openssl.h5
-rw-r--r--lib/vtls/polarssl.c3
-rw-r--r--lib/vtls/schannel.c3
-rw-r--r--lib/vtls/vtls.c30
-rw-r--r--lib/vtls/vtls.h5
16 files changed, 62 insertions, 61 deletions
diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c
index 8004e4ad7..138a80ade 100644
--- a/lib/vtls/axtls.c
+++ b/lib/vtls/axtls.c
@@ -721,7 +721,8 @@ const struct Curl_ssl Curl_ssl_axtls = {
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_none_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_axtls;
diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c
index 58c5d48b5..74052318f 100644
--- a/lib/vtls/cyassl.c
+++ b/lib/vtls/cyassl.c
@@ -970,7 +970,8 @@ const struct Curl_ssl Curl_ssl_cyassl = {
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_none_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_cyassl;
diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c
index cedd0e00e..71e5a9790 100644
--- a/lib/vtls/darwinssl.c
+++ b/lib/vtls/darwinssl.c
@@ -2723,13 +2723,14 @@ CURLcode Curl_darwinssl_random(struct Curl_easy *data UNUSED_PARAM,
return CURLE_OK;
}
-void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum, /* output */
- size_t md5len)
+static CURLcode Curl_darwinssl_md5sum(unsigned char *tmp, /* input */
+ size_t tmplen,
+ unsigned char *md5sum, /* output */
+ size_t md5len)
{
(void)md5len;
(void)CC_MD5(tmp, (CC_LONG)tmplen, md5sum);
+ return CURLE_OK;
}
void Curl_darwinssl_sha256sum(const unsigned char *tmp, /* input */
@@ -2875,7 +2876,8 @@ const struct Curl_ssl Curl_ssl_darwinssl = {
Curl_none_set_engine, /* set_engine */
Curl_none_set_engine_default, /* set_engine_default */
Curl_none_engines_list, /* engines_list */
- Curl_darwinssl_false_start /* false_start */
+ Curl_darwinssl_false_start, /* false_start */
+ Curl_darwinssl_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_darwinssl;
diff --git a/lib/vtls/darwinssl.h b/lib/vtls/darwinssl.h
index 967ba511f..4815cec1e 100644
--- a/lib/vtls/darwinssl.h
+++ b/lib/vtls/darwinssl.h
@@ -44,10 +44,6 @@ bool Curl_darwinssl_data_pending(const struct connectdata *conn,
CURLcode Curl_darwinssl_random(struct Curl_easy *data, unsigned char *entropy,
size_t length);
-void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum, /* output */
- size_t md5len);
void Curl_darwinssl_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum, /* output */
@@ -78,7 +74,6 @@ extern const struct Curl_ssl Curl_ssl_darwinssl;
#define have_curlssl_pinnedpubkey 1
#endif /* DARWIN_SSL_PINNEDPUBKEY */
-#define curlssl_md5sum(a,b,c,d) Curl_darwinssl_md5sum(a,b,c,d)
#define curlssl_sha256sum(a,b,c,d) Curl_darwinssl_sha256sum(a, b, c, d)
#endif /* USE_DARWINSSL */
diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c
index ee09f4d88..ed1e39dbc 100644
--- a/lib/vtls/gskit.c
+++ b/lib/vtls/gskit.c
@@ -1354,7 +1354,8 @@ const struct Curl_ssl Curl_ssl_gskit = {
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_none_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_gskit;
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;
diff --git a/lib/vtls/gtls.h b/lib/vtls/gtls.h
index 555759c60..626dbd33f 100644
--- a/lib/vtls/gtls.h
+++ b/lib/vtls/gtls.h
@@ -46,10 +46,6 @@ int Curl_gtls_shutdown(struct connectdata *conn, int sockindex);
CURLcode Curl_gtls_random(struct Curl_easy *data,
unsigned char *entropy,
size_t length);
-void Curl_gtls_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum, /* output */
- size_t md5len);
void Curl_gtls_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum, /* output */
@@ -74,7 +70,6 @@ extern const struct Curl_ssl Curl_ssl_gnutls;
/* this backend supports CURLOPT_PINNEDPUBLICKEY */
#define have_curlssl_pinnedpubkey 1
-#define curlssl_md5sum(a,b,c,d) Curl_gtls_md5sum(a,b,c,d)
#define curlssl_sha256sum(a,b,c,d) Curl_gtls_sha256sum(a,b,c,d)
#endif /* USE_GNUTLS */
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index 907077a6c..68ad9a499 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -1026,7 +1026,8 @@ const struct Curl_ssl Curl_ssl_mbedtls = {
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_none_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_mbedtls;
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index 17109b48d..9490549a9 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -2278,10 +2278,10 @@ CURLcode Curl_nss_random(struct Curl_easy *data,
return CURLE_OK;
}
-void Curl_nss_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum, /* output */
- size_t md5len)
+static CURLcode Curl_nss_md5sum(unsigned char *tmp, /* input */
+ size_t tmplen,
+ unsigned char *md5sum, /* output */
+ size_t md5len)
{
PK11Context *MD5pw = PK11_CreateDigestContext(SEC_OID_MD5);
unsigned int MD5out;
@@ -2289,6 +2289,8 @@ void Curl_nss_md5sum(unsigned char *tmp, /* input */
PK11_DigestOp(MD5pw, tmp, curlx_uztoui(tmplen));
PK11_DigestFinal(MD5pw, md5sum, &MD5out, curlx_uztoui(md5len));
PK11_DestroyContext(MD5pw, PR_TRUE);
+
+ return CURLE_OK;
}
void Curl_nss_sha256sum(const unsigned char *tmp, /* input */
@@ -2343,7 +2345,8 @@ const struct Curl_ssl Curl_ssl_nss = {
Curl_none_set_engine, /* set_engine */
Curl_none_set_engine_default, /* set_engine_default */
Curl_none_engines_list, /* engines_list */
- Curl_nss_false_start /* false_start */
+ Curl_nss_false_start, /* false_start */
+ Curl_nss_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_nss;
diff --git a/lib/vtls/nssg.h b/lib/vtls/nssg.h
index c5b3353cf..d5473bfb9 100644
--- a/lib/vtls/nssg.h
+++ b/lib/vtls/nssg.h
@@ -51,11 +51,6 @@ CURLcode Curl_nss_random(struct Curl_easy *data,
unsigned char *entropy,
size_t length);
-void Curl_nss_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum, /* output */
- size_t md5len);
-
void Curl_nss_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum, /* output */
@@ -82,7 +77,6 @@ extern const struct Curl_ssl Curl_ssl_nss;
/* this backends supports CURLOPT_PINNEDPUBLICKEY */
#define have_curlssl_pinnedpubkey 1
-#define curlssl_md5sum(a,b,c,d) Curl_nss_md5sum(a,b,c,d)
#define curlssl_sha256sum(a,b,c,d) Curl_nss_sha256sum(a,b,c,d)
#endif /* USE_NSS */
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 1484b9b1c..e24c79515 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -3350,16 +3350,17 @@ CURLcode Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
return (rc == 1 ? CURLE_OK : CURLE_FAILED_INIT);
}
-void Curl_ossl_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum /* output */,
- size_t unused)
+static CURLcode Curl_ossl_md5sum(unsigned char *tmp, /* input */
+ size_t tmplen,
+ unsigned char *md5sum /* output */,
+ size_t unused)
{
MD5_CTX MD5pw;
(void)unused;
MD5_Init(&MD5pw);
MD5_Update(&MD5pw, tmp, tmplen);
MD5_Final(md5sum, &MD5pw);
+ return CURLE_OK;
}
#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL) && !defined(OPENSSL_NO_SHA256)
@@ -3405,7 +3406,8 @@ const struct Curl_ssl Curl_ssl_openssl = {
Curl_ossl_set_engine, /* set_engine */
Curl_ossl_set_engine_default, /* set_engine_default */
Curl_ossl_engines_list, /* engines_list */
- Curl_none_false_start /* false_start */
+ Curl_none_false_start, /* false_start */
+ Curl_ossl_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_openssl;
diff --git a/lib/vtls/openssl.h b/lib/vtls/openssl.h
index a62a2e7ff..4abc6d4c4 100644
--- a/lib/vtls/openssl.h
+++ b/lib/vtls/openssl.h
@@ -68,10 +68,6 @@ bool Curl_ossl_data_pending(const struct connectdata *conn,
/* return 0 if a find random is filled in */
CURLcode Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
size_t length);
-void Curl_ossl_md5sum(unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *md5sum /* output */,
- size_t unused);
void Curl_ossl_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum /* output */,
@@ -99,7 +95,6 @@ extern const struct Curl_ssl Curl_ssl_openssl;
/* this backend supports CURLOPT_PINNEDPUBLICKEY */
#define have_curlssl_pinnedpubkey 1
-#define curlssl_md5sum(a,b,c,d) Curl_ossl_md5sum(a,b,c,d)
#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL) && !defined(OPENSSL_NO_SHA256)
#define curlssl_sha256sum(a,b,c,d) Curl_ossl_sha256sum(a,b,c,d)
#endif
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c
index 8feaa95af..f2a7c93b8 100644
--- a/lib/vtls/polarssl.c
+++ b/lib/vtls/polarssl.c
@@ -892,7 +892,8 @@ const struct Curl_ssl Curl_ssl_polarssl = {
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_none_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_polarssl;
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
index b8c11d5f8..ea3c221f3 100644
--- a/lib/vtls/schannel.c
+++ b/lib/vtls/schannel.c
@@ -1745,7 +1745,8 @@ const struct Curl_ssl Curl_ssl_schannel = {
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_none_md5sum /* md5sum */
};
const struct Curl_ssl *Curl_ssl = &Curl_ssl_schannel;
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 */
diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h
index a568999e8..f95b9236e 100644
--- a/lib/vtls/vtls.h
+++ b/lib/vtls/vtls.h
@@ -54,6 +54,9 @@ struct Curl_ssl {
struct curl_slist *(*engines_list)(struct Curl_easy *data);
bool (*false_start)(void);
+
+ CURLcode (*md5sum)(unsigned char *input, size_t inputlen,
+ unsigned char *md5sum, size_t md5sumlen);
};
#ifdef USE_SSL
@@ -74,6 +77,8 @@ CURLcode Curl_none_set_engine(struct Curl_easy *data, const char *engine);
CURLcode Curl_none_set_engine_default(struct Curl_easy *data);
struct curl_slist *Curl_none_engines_list(struct Curl_easy *data);
bool Curl_none_false_start(void);
+CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
+ unsigned char *md5sum, size_t md5len);
#include "openssl.h" /* OpenSSL versions */
#include "gtls.h" /* GnuTLS versions */