diff options
author | Wyatt O'Day <wyatt@wyday.com> | 2018-04-02 13:33:00 -0400 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-04-06 14:21:50 +0200 |
commit | 336b6a32c0c9bec6bf6ccfc5942a3ce62ff34281 (patch) | |
tree | dc5474d3b6baa88a077f95a7fd8ab1213356860b /lib/vtls/mbedtls.c | |
parent | 746479adcbd2bba06077642fefe0414ad6e1e0ea (diff) | |
download | curl-336b6a32c0c9bec6bf6ccfc5942a3ce62ff34281.tar.gz |
tls: fix mbedTLS 2.7.0 build + handle sha256 failures
(mbedtls 2.70 compiled with MBEDTLS_DEPRECATED_REMOVED)
Closes #2453
Diffstat (limited to 'lib/vtls/mbedtls.c')
-rw-r--r-- | lib/vtls/mbedtls.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index 28251a388..e76e19b09 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -1023,13 +1023,20 @@ static bool Curl_mbedtls_data_pending(const struct connectdata *conn, return mbedtls_ssl_get_bytes_avail(&BACKEND->ssl) != 0; } -static void Curl_mbedtls_sha256sum(const unsigned char *input, +static CURLcode Curl_mbedtls_sha256sum(const unsigned char *input, size_t inputlen, unsigned char *sha256sum, size_t sha256len UNUSED_PARAM) { (void)sha256len; +#if MBEDTLS_VERSION_NUMBER < 0x02070000 mbedtls_sha256(input, inputlen, sha256sum, 0); +#else + /* returns 0 on success, otherwise failure */ + if(mbedtls_sha256_ret(input, inputlen, sha256sum, 0) != 0) + return CURLE_BAD_FUNCTION_ARGUMENT; +#endif + return CURLE_OK; } static void *Curl_mbedtls_get_internals(struct ssl_connect_data *connssl, |