mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
Support wolfSSL 4.6+ (#3398)
* Fix testing against reference crypto implementation
Build would fail on CI if using cyassl/wolfssl or polarssl/mbedtls as a
backend and testing it against reference openssl implementation due to
missing include directories, but only if bundled (non-system) b64 is
used.
* Iniitalize size arguments to `wc_DhGenerateKeyPair`
Despite it not being mentioned in the documentation [1] and v4.6 release
notes [2], the two size parameters became [3] not purely "out", but
"in/out", to avoid potential buffer overflows.
[1] https://www.wolfssl.com/documentation/manuals/wolfssl/group__Diffie-Hellman.html
[2] https://github.com/wolfSSL/wolfssl/releases/tag/v4.6.0-stable
[3] 4364700c01
This commit is contained in:
@@ -258,8 +258,8 @@ bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t /*private_key_length*/, uint8
|
||||
|
||||
auto const lock = std::lock_guard(rng_mutex_);
|
||||
|
||||
auto my_private_key_length = word32{};
|
||||
auto my_public_key_length = word32{};
|
||||
auto my_private_key_length = handle->key_length;
|
||||
auto my_public_key_length = static_cast<word32>(*public_key_length);
|
||||
if (!check_result(API(DhGenerateKeyPair)(
|
||||
&handle->dh,
|
||||
get_rng(),
|
||||
|
||||
@@ -41,7 +41,7 @@ static void ensureKeyExists(tr_crypto* crypto)
|
||||
{
|
||||
if (crypto->dh == nullptr)
|
||||
{
|
||||
size_t public_key_length = 0;
|
||||
size_t public_key_length = KEY_LEN;
|
||||
crypto->dh = tr_dh_new(dh_P, sizeof(dh_P), dh_G, sizeof(dh_G));
|
||||
tr_dh_make_key(crypto->dh, DhPrivkeyLen, crypto->myPublicKey, &public_key_length);
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ target_include_directories(libtransmission-test
|
||||
|
||||
target_include_directories(libtransmission-test SYSTEM
|
||||
PRIVATE
|
||||
${B64_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${EVENT2_INCLUDE_DIRS})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user