Skip to content

Conversation

@aslze
Copy link

@aslze aslze commented Jun 1, 2025

Description

This fixes Bug #7087 in the 3.6 branch (unable to build C++ apps that use mbedTLS on MSVC 2019 Windows).

Ports the main commit in TF-PSA-Crypto#258, changing crypto_extra.h.
Also fixes building a couple test programs inside mbedtls due to a warning in winbase.h in C11 mode.

PR checklist

Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.

@aslze
Copy link
Author

aslze commented Jun 1, 2025

Oops. I missed the signing-off part. That means commits must be done by actual team members and not external contributors? How can this proceed?

@gilles-peskine-arm
Copy link
Contributor

@aslze Thanks for the contribution. You need to add a sign-off line to every commit message, to convey that you are allowed to make this contribution and that you allow us to use it as described in dco.txt.

Practically, you can run git rebase -i --signoff mbedtls-3.6 to add a signoff line to the new commits since mbedtls-3.6, or e.g. git rebase -i --signoff HEAD~3 to sign off the last 3 commits.

@gilles-peskine-arm gilles-peskine-arm added bug needs-ci Needs to pass CI tests size-xs Estimated task size: extra small (a few hours at most) priority-medium Medium priority - this can be reviewed as time permits labels Jun 1, 2025
@aslze aslze force-pushed the mbedtls-3.6 branch 2 times, most recently from e6b9b9f to 11ded46 Compare June 1, 2025 23:16
In crypto_extra.h, move PAKE size calculation macros,
the definition of psa_pake_cipher_suite_s and
psa_pake_operation_s just after PAKE type and values
definitions.

This aligns with the order of crypto header inclusions
in crypto.h: crypto_types.h, then crypto_values.h,
then crypto_sizes.h, and then crypto_struct.h.

Take care of keeping them outside of the pake Doxygen
group as they used to be.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
As the definition of psa_pake_operation_s has
been moved the "xyt_t" structure types can not
be used anymore (defined later).

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
@ronald-cron-arm
Copy link
Contributor

@aslze thanks for this pull request. Revisiting the changes in crypto_extra.h in this LTS context, I think we should do better actually in terms of not changing the Doxygen documentation and aligning with the re-organization done in crypto.h (#10196).
Instead of 101b0e9 I propose the two last commits of https://github.com/ronald-cron-arm/mbedtls/tree/fix-crypto-extra-for-msvc-3.6. I've tested the changes against our CI and I believe they should fix the issue MSVC as well. Would you be able to check that it is actually the case?

@aslze
Copy link
Author

aslze commented Jun 3, 2025

@aslze thanks for this pull request. Revisiting the changes in crypto_extra.h in this LTS context, I think we should do better actually in terms of not changing the Doxygen documentation and aligning with the re-organization done in crypto.h (#10196). Instead of 101b0e9 I propose the two last commits of https://github.com/ronald-cron-arm/mbedtls/tree/fix-crypto-extra-for-msvc-3.6. I've tested the changes against our CI and I believe they should fix the issue MSVC as well. Would you be able to check that it is actually the case?

I'll check later today. I don't understand the reference to Doxygen. IIRC, the idea of the commit was to move the definition of some structs up in the file. Struct names are the same, I think.

@aslze
Copy link
Author

aslze commented Jun 3, 2025

@ronald-cron-arm yes, those two commits fix the issue, thanks.

Would you add this commit from my PR? It's a tiny change. Fixes compilation of two test programs due to an apparent bug in a Windows header in C11 mode (as the compilation sets warnings as errors).

@ronald-cron-arm
Copy link
Contributor

ronald-cron-arm commented Jun 4, 2025

@ronald-cron-arm yes, those two commits fix the issue, thanks.

Would you add this commit from my PR? It's a tiny change. Fixes compilation of two test programs due to an apparent bug in a Windows header in C11 mode (as the compilation sets warnings as errors).

Yes sure. Actually, would you mind updating this PR with the two last commits of https://github.com/ronald-cron-arm/mbedtls/tree/fix-crypto-extra-for-msvc-3.6 instead of 101b0e9 and address #10200 (comment)?

Otherwise, if you prefer I can create a new PR based on https://github.com/ronald-cron-arm/mbedtls/tree/fix-crypto-extra-for-msvc-3.6 including your commit.

@aslze aslze force-pushed the mbedtls-3.6 branch 2 times, most recently from f9e0b5a to 6b08688 Compare June 4, 2025 21:49
aslze added 2 commits June 5, 2025 09:09
… winbase.h)

Signed-off-by: Alvaro Segura <alvaro.segura@gmail.com>
Signed-off-by: Alvaro Segura <alvaro.segura@gmail.com>
@ronald-cron-arm
Copy link
Contributor

ronald-cron-arm commented Jun 5, 2025

@aslze Thanks for the update. I've just undone the squash in the last commit to three commits. That's better for the git history and that should help for the reviews. And I've started a run of CI.

@ronald-cron-arm ronald-cron-arm removed the needs-ci Needs to pass CI tests label Jun 5, 2025
@davidhorstmann-arm davidhorstmann-arm self-requested a review June 5, 2025 11:16
Copy link
Contributor

@davidhorstmann-arm davidhorstmann-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aslze
Copy link
Author

aslze commented Jun 9, 2025

Can someone please take a look. The system is complaining about API changes in the naming of some structs:

psa_crypto_driver_pake_inputs_t -> struct psa_crypto_driver_pake_inputs_s
psa_pake_cipher_suite_t -> struct psa_pake_cipher_suite_s
psa_jpake_computation_stage_t -> struct psa_jpake_computation_stage_s

But I thought that was intentional and the _t types are aliases of the _s structs. So there is no API breakage.

@ronald-cron-arm
Copy link
Contributor

Can someone please take a look. The system is complaining about API changes in the naming of some structs:

psa_crypto_driver_pake_inputs_t -> struct psa_crypto_driver_pake_inputs_s
psa_pake_cipher_suite_t -> struct psa_pake_cipher_suite_s
psa_jpake_computation_stage_t -> struct psa_jpake_computation_stage_s

But I thought that was intentional and the _t types are aliases of the _s structs. So there is no API breakage.

Yes to me this is a false positive of our API/ABI checker script.

@minosgalanakis minosgalanakis self-requested a review June 10, 2025 09:38
minosgalanakis
minosgalanakis previously approved these changes Jun 10, 2025
Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, it is an incremental build-up ofMbed-TLS/TF-PSA-Crypto#258 following #10196.

The abi check is a false positive and the mangling of the function signature will not be affected if we refer ot it by struct or by typedef alias, when building with C/C++.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While reviewing Mbed-TLS/TF-PSA-Crypto#258 I noticed that commit #31f7446957212fb95089bdb45c87a631fefaa8e1 is missing.

It looks like a minor fix that is easy to back-port. If it was needed in the tf-psa-crypto version we should have it here too.

Signed-off-by: Cesar Cruz <cesar.cruz@philips.com>
Signed-off-by: ccrugoPhilips <cesar.cruz@philips.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
@ronald-cron-arm
Copy link
Contributor

While reviewing Mbed-TLS/TF-PSA-Crypto#258 I noticed that commit #31f7446957212fb95089bdb45c87a631fefaa8e1 is missing.

It looks like a minor fix that is easy to back-port. If it was needed in the tf-psa-crypto version we should have it here too.

I've added it.

@irwir
Copy link
Contributor

irwir commented Jun 18, 2025

Yes to me this is a false positive of our API/ABI checker script.

Not really. Declarations and definitions should match fully.
As was explained in my issue, such differences could break navigation to declaration/definition in IDE, and static analysis might generate diagnostic messages.
The issue was closed as not planned.

Copy link
Contributor

@davidhorstmann-arm davidhorstmann-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ronald-cron-arm ronald-cron-arm dismissed their stale review June 19, 2025 14:25

My comments have been addressed. I am one of the authors now thus cannot approve.

@davidhorstmann-arm davidhorstmann-arm added the approved Design and code approved - may be waiting for CI or backports label Jun 19, 2025
@davidhorstmann-arm davidhorstmann-arm added this pull request to the merge queue Jun 19, 2025
Merged via the queue into Mbed-TLS:mbedtls-3.6 with commit 54ceaf7 Jun 19, 2025
3 of 4 checks passed
@github-project-automation github-project-automation bot moved this from In Development to Done in Non-roadmap pull requests Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Design and code approved - may be waiting for CI or backports bug priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants