Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix building with mbedtls 3.X #6822

Merged
merged 1 commit into from
May 25, 2024
Merged

fix building with mbedtls 3.X #6822

merged 1 commit into from
May 25, 2024

Conversation

orangepizza
Copy link
Contributor

per https://github.com/Mbed-TLS/mbedtls/blob/development/docs/3.0-migration-guide.md, functions with _ret prefixs replaced old without return and renamed without suffix.

@Coeur
Copy link
Collaborator

Coeur commented May 1, 2024

Thank you.
Note that we never actually use the return values, and in mbedtls 2, the implementation of non-suffixed version was just about calling the suffixed versions:
https://github.com/Mbed-TLS/mbedtls/blob/5a764e5555c64337ed17444410269ff21cb617b1/library/sha1.c#L77-L80

void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
{
    mbedtls_sha1_starts_ret(ctx);
}

So we could alternatively simplify our code here and do everything without _ret suffix, no matter the version of mbedtls?

@Coeur Coeur added this to the 4.0.x milestone May 1, 2024
@Coeur Coeur added the type:build Changes that affect the build system label May 1, 2024
libtransmission/crypto-utils-mbedtls.cc Outdated Show resolved Hide resolved
@orangepizza
Copy link
Contributor Author

orangepizza commented May 1, 2024

Thank you. Note that we never actually use the return values, and in mbedtls 2, the implementation of non-suffixed version was just about calling the suffixed versions: https://github.com/Mbed-TLS/mbedtls/blob/5a764e5555c64337ed17444410269ff21cb617b1/library/sha1.c#L77-L80

void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
{
    mbedtls_sha1_starts_ret(ctx);
}

So we could alternatively simplify our code here and do everything without _ret suffix, no matter the version of mbedtls?

well if not someone complied mbedtls 2.X with MBEDTLS_DEPRECATED_REMOVED, then line above it #if !defined(MBEDTLS_DEPRECATED_REMOVED) will remove that definition

libtransmission/crypto-utils-mbedtls.cc Outdated Show resolved Hide resolved
@orangepizza orangepizza force-pushed the mbd3 branch 2 times, most recently from 5b21da8 to 3e8b190 Compare May 1, 2024 18:06
@Coeur
Copy link
Collaborator

Coeur commented May 1, 2024

Good. And best if you could also prepare a second pull request for the same changes, but cherry-picked for the 4.0.x branch.

@neheb
Copy link
Contributor

neheb commented May 11, 2024

Could include compat-2.x.h instead

@orangepizza
Copy link
Contributor Author

Could include compat-2.x.h instead

Think this is better as that will be removed in mbedtls 4.x so it need to be fixed at later time anyway

uses renamed funtion name for mbedtls 3.x

Signed-off-by: Seo Suchan <tjtncks@gmail.com>
@ckerr
Copy link
Member

ckerr commented May 25, 2024

Sanity / macos-11 CI failure is a server issue unrelated to this PR, not a PR blocker

@ckerr ckerr merged commit 8bb49e3 into transmission:main May 25, 2024
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:build Changes that affect the build system
Development

Successfully merging this pull request may close these issues.

None yet

5 participants