-
Notifications
You must be signed in to change notification settings - Fork 60
Rename BEFORE_COLON/BC to avoid conflicts #68
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
Rename BEFORE_COLON/BC to avoid conflicts #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, those changes should be submitted to upstream Mbed TLS: https://github.com/Mbed-TLS/mbedtls/pulls
They can then be cherry-picked into Zephyr.
The patches were merged upstream 243e13f. Please consider cherry-picking the commits or merging this PR now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Can you now just cherry pick the commits directly from upstream with the -x
flag so we keep track of the commit hashes (useful for when updating this repo)?
You'll also need to make a PR in Zephyr if you want that change to land into |
d5062f6
to
c9bebc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not quite right yet. The title of the commit should be identical to that of the upstream one. You shouldn't be using git merge
, really just git cherry-pick
.
Feel free to contact me on the Zephyr Discord if you need help doing that.
This is the merge commit from upstream (243e13f). I did
to pull it in. I think you want to see only my two commits, and not the merge commit? I tried doing that but it would always pull in the merge commit instead. Thanks for the offer. I will try again as soon as I get back to work and then write you in case I don't manage to do it. |
Ah yeah, kinda had forgotten that Mbed TLS merges PRs with merge commits. |
BEFORE_COLON and BC defines with the accompanying comment are only required in x509_crt and x509_csr, but not used in x509_crl.c. Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com> (cherry picked from commit 6a9cf113611de1d8ac18f49563883a639ae7c7d6) Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
Namespace BEFORE_COLON and BC defines by prepending MBEDTLS_ and expanding BC to BEFORE_COLON_STR. This is to avoid naming conflicts with third-party code. No functional change. Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com> (cherry picked from commit b5c079b13c4977bdba8593d174d7851e41b5788e) Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
c9bebc9
to
4952e13
Compare
Thanks, I think it worked now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
We (Arduino) are impacted too by this bug while porting Portenta C33 (RA6M5 based) with networking, thanks @stgloorious for providing the fix! |
Bear in mind (any of) you will need to make a PR in the main Zephyr repo that changes the reference to this repo (in the |
See: zephyrproject-rtos/mbedtls#68 Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
Done. Please consider merging this PR now, so I can update the hash in zephyrproject-rtos/zephyr#86704. |
We first need to see that CI agrees. 🙂 |
See: zephyrproject-rtos/mbedtls#68 Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
See: zephyrproject-rtos/mbedtls#68 Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
See: zephyrproject-rtos/mbedtls#68 Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
See: zephyrproject-rtos/mbedtls#68 Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
See: zephyrproject-rtos/mbedtls#68 Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
Description
Rename the
BEFORE_COLON
andBC
defines to include aMBEDTLS_
prefix and expand theBC
toBEFORE_COLON
.The existing names are rather short and are not properly namespaced, increasing the likelihood for conflicts.
The defines are not even used in
x509_crl.c
, so remove them entirely there.One example is the Renesas RA HAL headers that have variables named
BC
. Those headers are included into the mbedtls module via thesys/socket.h
andarpa/inet.h
headers inlibrary/x509.crt.c
which will eventually include CPU-specific headers containing the Renesas HAL. The conflict can be triggered with the https sample:west build -p auto -b ek_ra6m4 zephyr/samples/net/sockets/http_server
, which will lead toThe include chain can be investigated by copying the GCC command, removing the
-M*
options, and adding-H
.Arguably, this conflict can also be solved by not including the
socket.h
andinet.h
headers, e.g., by adding a special#ifdef __ZEPHYR__
case that defaults to the software version ofinet_pton()
just as it is done for Win32.It could also be solved in the Renesas HAL header, but it makes more sense to me to fix the
#define
.Consider this an RFC. Let me know if you have any better ideas to fix this. If this is accepted here I will submit it upstream as well.
PR checklist