-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 missing header when defining MBEDTLS_DEBUG #6045
Fix missing header when defining MBEDTLS_DEBUG #6045
Conversation
and this header is also present in somewhat older versions? |
It is present from version 2.0. I can add a compile time check for MBEDTLS_VERSION_MAJOR >= 2 ? |
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.
I am not into this library but according to your description the definition is probably a CPP macro so this doesn't matter
lib/vtls/mbedtls.c
Outdated
@@ -46,6 +46,8 @@ | |||
#include <mbedtls/ctr_drbg.h> | |||
#include <mbedtls/sha256.h> | |||
|
|||
#include <mbedtls/debug.h> |
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.
Shouldn't you add a #ifdef MBEDTLS_DEBUG
?
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.
From the code it looks like the idea is that you manually "#define" instead of the "#undef" in
Line 119 in 924ae86
#undef MBEDTLS_DEBUG |
Assuming that is correct your suggestion would not fix the issue.
I didn't know if it was permissible to add the include file in the block that follows line 119?
Or let mbedtls/config.h decide if MBEDTLS_DEBUG is set or not. I.e. deleting line 119?
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.
I think the #undef
of the debug define probably should be removed. Or at least moved to the top of the file so that it is easier to find.
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.
I think the proper way to do it would be to include mbedtls/config.h . But I am not 100% certain that it does not introduce some regression. So I have moved the #undef
to the top.
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.
I think undefing stuff we haven't defined is a bad idea and will create lots of confusion. If people invoke the compilation with extra CPP definitions, we shouldn't ignore them IMO.
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.
But again, I am not able to judge on this as I am not into the library 😊
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.
What do you think about the latest commit? It combines the previous functionality with your suggestion.
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.
Do you mean d06f3e1?
If so it's not perfect. Double slash comments are not allowed on the one hand, on the second hand I don't think we should leave unused Code commented out, especially when it has never been in use
Thanks! I squashed the commits and edited it slightly before I merged.... |
Building curl fails when defining MBEDTLS_DEBUG for mbedtls version 2.16.x because of a missing header.