transmission: fix compile with MbedTLS 3.X
[feed/packages.git] / net / transmission / patches / 010-temp-mbedtls3-compile.patch
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
5
6 Signed-off-by: Seo Suchan <tjtncks@gmail.com>
7 ---
8 libtransmission/crypto-utils-mbedtls.cc | 14 +++++++-------
9 1 file changed, 7 insertions(+), 7 deletions(-)
10
11 --- a/libtransmission/crypto-utils-mbedtls.cc
12 +++ b/libtransmission/crypto-utils-mbedtls.cc
13 @@ -117,7 +117,7 @@ public:
14 {
15 mbedtls_sha1_init(&handle_);
16
17 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
18 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
19 mbedtls_sha1_starts_ret(&handle_);
20 #else
21 mbedtls_sha1_starts(&handle_);
22 @@ -128,7 +128,7 @@ public:
23 {
24 if (data_length > 0U)
25 {
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);
29 #else
30 mbedtls_sha1_update(&handle_, static_cast<unsigned char const*>(data), data_length);
31 @@ -140,7 +140,7 @@ public:
32 {
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);
38 #else
39 mbedtls_sha1_finish(&handle_, digest_as_uchar);
40 @@ -168,10 +168,10 @@ public:
41 {
42 mbedtls_sha256_init(&handle_);
43
44 -#if MBEDTLS_VERSION_NUMBER >= 0x02070000
45 +#if MBEDTLS_VERSION_NUMBER < 0x03000000 && MBEDTLS_VERSION_NUMBER >= 0x02070000
46 mbedtls_sha256_starts_ret(&handle_, 0);
47 #else
48 - mbedtls_sha256_starts(&handle_);
49 + mbedtls_sha256_starts(&handle_, 0);
50 #endif
51 }
52
53 @@ -179,7 +179,7 @@ public:
54 {
55 if (data_length > 0U)
56 {
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);
60 #else
61 mbedtls_sha256_update(&handle_, static_cast<unsigned char const*>(data), data_length);
62 @@ -191,7 +191,7 @@ public:
63 {
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);
69 #else
70 mbedtls_sha256_finish(&handle_, digest_as_uchar);