-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
mbedtls: fix v3.1.0 build private access #8214
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- curl version=[7.81.0-DEV] CMake Warning (dev) at /usr/share/cmake-3.22.1/Modules/FindPackageHandleStandardArgs.cmake:438 (message): The package name passed to `find_package_handle_standard_args` (MBEDTLS) does not match the name of the calling package (MbedTLS). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern. Call Stack (most recent call first): deps/curl/CMake/FindMbedTLS.cmake:31 (find_package_handle_standard_args) deps/curl/CMakeLists.txt:473 (find_package) This warning is for project developers. Use -Wno-dev to suppress it.
"As a last resort, you can access the field foo of a structure bar by writing bar.MBEDTLS_PRIVATE(foo). Note that you do so at your own risk, since such code is likely to break in a future minor version of Mbed TLS." - https://github.com/ARMmbed/mbedtls/blob/f2d1199edc5834df4297f247f213e614f7782d1d/docs/3.0-migration-guide.md That future minor version is v3.1.0. I set the >= to == for the version checks because v3.1.0 is a release, and I am not sure when the private designation was reverted after v3.0.0. The change made to support v3.0.0 causes builds to break for v3.1.0 with the following errors: [ 81%] Building C object deps/curl/lib/CMakeFiles/libcurl.dir/vtls/mbedtls.c.o In file included from /c/Users/Valentin/Downloads/stateSpaceSolver/deps/mbedtls-3.1.0/build/include/mbedtls/net_sockets.h:40, /c/Users/Valentin/Downloads/stateSpaceSolver/deps/curl/lib/vtls/mbedtls.c: In function 'mbed_connect_step2': /c/Users/Valentin/Downloads/stateSpaceSolver/deps/mbedtls-3.1.0/build/include/mbedtls/private_access.h:27:33: error: 'mbedtls_x509_crt' has no member named 'private_raw'; did you mean 'private_sig'? 27 | #define MBEDTLS_PRIVATE(member) private_##member | ^~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/curl/lib/vtls/mbedtls.c:703:32: note: in expansion of macro 'MBEDTLS_PRIVATE' 703 | if(!peercert || !peercert->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(p) || | ^~~~~~~~~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/mbedtls-3.1.0/build/include/mbedtls/private_access.h:27:33: error: 'mbedtls_x509_crt' has no member named 'private_raw'; did you mean 'private_sig'? 27 | #define MBEDTLS_PRIVATE(member) private_##member | ^~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/curl/lib/vtls/mbedtls.c:704:19: note: in expansion of macro 'MBEDTLS_P | ^~~~~~~~~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/mbedtls-3.1.0/build/include/mbedtls/private_access.h:27:33: error: 'mb 27 | #define MBEDTLS_PRIVATE(member) private_##member | ^~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/curl/lib/vtls/mbedtls.c:731:35: note: in expansion of macro 'MBEDTLS_PRIVATE' 731 | peercert->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(p), | ^~~~~~~~~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/mbedtls-3.1.0/build/include/mbedtls/private_access.h:27:33: error: 'mbedtls_x509_crt' has no member named 'private_raw'; did you mean 'private_sig'? 27 | #define MBEDTLS_PRIVATE(member) private_##member | ^~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/curl/lib/vtls/mbedtls.c:732:35: note: in expansion of macro 'MBEDTLS_PRIVATE' 732 | peercert->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(len))) { | ^~~~~~~~~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/mbedtls-3.1.0/build/include/mbedtls/private_access.h:27:33: error: 'mbedtls_x509_crt' has no member named 'private_pk'; did you mean 'private_sig'? 27 | #define MBEDTLS_PRIVATE(member) private_##member | ^~~~~~~~ /c/Users/Valentin/Downloads/stateSpaceSolver/deps/curl/lib/vtls/mbedtls.c:742:44: note: in expansion of macro 'MBEDTLS_PRIVATE' 742 | size = mbedtls_pk_write_pubkey_der(&p->MBEDTLS_PRIVATE(pk), pubkey, | ^~~~~~~~~~~~~~~ make[2]: *** [deps/curl/lib/CMakeFiles/libcurl.dir/build.make:1994: deps/curl/lib/CMakeFiles/libcurl.dir/vtls/mbedtls.c.o] Error 1
Seems fair. I'll bump the mbedtls CI job in #8215 to use 3.1.0 once this is merged. |
Can you rebase/force-push this to remove the irrelevant commits already merged from #8207? |
Never mind, I'll do that. |
Thanks! |
I have actually been wondering what the proper pull request format is. Will read into rebase and force push a bit to see if I can fix it in the future. |
BhanuPrakash-P
pushed a commit
to BhanuPrakash-P/curl
that referenced
this pull request
May 16, 2024
"As a last resort, you can access the field foo of a structure bar by writing bar.MBEDTLS_PRIVATE(foo). Note that you do so at your own risk, since such code is likely to break in a future minor version of Mbed TLS." - https://github.com/ARMmbed/mbedtls/blob/f2d1199edc5834df4297f247f213e614f7782d1d/docs/3.0-migration-guide.md That future minor version is v3.1.0. I set the >= to == for the version checks because v3.1.0 is a release, and I am not sure when the private designation was reverted after v3.0.0. Closes curl#8214
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"As a last resort, you can access the field foo of a structure bar by writing bar.MBEDTLS_PRIVATE(foo). Note that you do so at your own risk, since such code is likely to break in a future minor version of Mbed TLS." - https://github.com/ARMmbed/mbedtls/blob/f2d1199edc5834df4297f247f213e614f7782d1d/docs/3.0-migration-guide.md
That future minor version is v3.1.0. I set the >= to == for the version checks relevant to the private members because v3.1.0 is an MbedTLS release, and I am not sure when the private designation was reverted after v3.0.0. The change made to support v3.0.0 causes builds to break for v3.1.0.
Build errors are included in the extended description of the latest commit. I do not believe this error would be exclusive to CMake, but that is what I am using for my project.