Unverified Commit e35205a0 authored by Johannes Schindelin's avatar Johannes Schindelin Committed by Daniel Stenberg
Browse files

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: default avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent 52e8237b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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;
+7 −5
Original line number Diff line number Diff line
@@ -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 */
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;
+0 −5
Original line number Diff line number Diff line
@@ -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 */
+2 −1
Original line number Diff line number Diff line
@@ -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;
Loading