1 From da7d6fe0e1b162eac6cc048153ff7f201975b6c4 Mon Sep 17 00:00:00 2001
2 From: Seo Suchan <tjtncks@gmail.com>
3 Date: Thu, 2 May 2024 03:34:12 +0900
4 Subject: [PATCH] fix compile with mbedtls 3.x
6 Signed-off-by: Seo Suchan <tjtncks@gmail.com>
8 libtransmission/crypto-utils-mbedtls.cc | 14 +++++++-------
9 1 file changed, 7 insertions(+), 7 deletions(-)
11 --- a/libtransmission/crypto-utils-mbedtls.cc
12 +++ b/libtransmission/crypto-utils-mbedtls.cc
13 @@ -117,7 +117,7 @@ public:
15 mbedtls_sha1_init(&handle_);
17 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
18 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
19 mbedtls_sha1_starts_ret(&handle_);
21 mbedtls_sha1_starts(&handle_);
22 @@ -128,7 +128,7 @@ public:
26 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
27 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
28 mbedtls_sha1_update_ret(&handle_, static_cast<unsigned char const*>(data), data_length);
30 mbedtls_sha1_update(&handle_, static_cast<unsigned char const*>(data), data_length);
31 @@ -140,7 +140,7 @@ public:
33 auto digest = tr_sha1_digest_t{};
34 auto* const digest_as_uchar = reinterpret_cast<unsigned char*>(std::data(digest));
35 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
36 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
37 mbedtls_sha1_finish_ret(&handle_, digest_as_uchar);
39 mbedtls_sha1_finish(&handle_, digest_as_uchar);
40 @@ -168,10 +168,10 @@ public:
42 mbedtls_sha256_init(&handle_);
44 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
45 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
46 mbedtls_sha256_starts_ret(&handle_, 0);
48 - mbedtls_sha256_starts(&handle_);
49 + mbedtls_sha256_starts(&handle_, 0);
53 @@ -179,7 +179,7 @@ public:
57 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
58 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
59 mbedtls_sha256_update_ret(&handle_, static_cast<unsigned char const*>(data), data_length);
61 mbedtls_sha256_update(&handle_, static_cast<unsigned char const*>(data), data_length);
62 @@ -191,7 +191,7 @@ public:
64 auto digest = tr_sha256_digest_t{};
65 auto* const digest_as_uchar = reinterpret_cast<unsigned char*>(std::data(digest));
66 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
67 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
68 mbedtls_sha256_finish_ret(&handle_, digest_as_uchar);
70 mbedtls_sha256_finish(&handle_, digest_as_uchar);