-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Remove unneeded namespacing in header files #921
Conversation
ChangeLog
Outdated
= mbed TLS x.x.x branch released xxxx-xx-xx | ||
|
||
Bugfix | ||
* Fix namespacing in header files. REmove the `mbedtls` namespacing in |
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.
Typo
@hanno-arm Thank you for your review |
*/ | ||
|
||
#if !defined(MBEDTLS_DEPRECATED_REMOVED) | ||
#include "mbedtls/net_sockets.h" | ||
#include "net_sockets.h" | ||
#if defined(MBEDTLS_DEPRECATED_WARNING) | ||
#warning "Deprecated header file: Superseded by mbedtls/net_sockets.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.
Should we change this one as well?
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.
@andresag01 Why do you think it shouldn't change? Although net.h
is superseded, it can still be included.
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.
This was a long time ago, so what I probably meant is that in the message for this warning there is a mbedtls/net_sockets.h
. Do we want to make that net_sockets.h
as well? Its a really minor thing and certainly not a stopper, more of a question. I will accept the PR.
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 in the message, it's more appropriate to keep it as is, as it is intended for human readers, and it's informative with the current wording
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 personally think it's better to keep it as it is.
I have merged development branch into this PR to resolve conflicts. |
@RonEld: Thanks for looking into this again, but could you please rebase instead of creating a merge commit. For example, the diff now shows as if you had introduced a new config file and in general its not ideal to have these merge commits in the history. Also, could you please create backports? |
Remove the `mbedtls` namesapcing in the `#include` in header files Resolves issue Mbed-TLS#857
Fix typo in ChangeLog discovered in PR review
@andresag01 I have removed the merge commit and rebased. |
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.
Thanks for reworking the PR. In general, I am happy with the changes, but I have a question regarding the use of namespaced includes in the configs. Sorry about that, I should have spotted it in the earlier reviews.
@@ -1,7 +1,7 @@ | |||
/** | |||
* \file net.h | |||
* | |||
* \brief Deprecated header file that includes mbedtls/net_sockets.h | |||
* \brief Deprecated header file that includes net_sockets.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.
Minor: Why did you remove mbedtls/
from this comment for example and not from the one below?
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 don't really have a good answer.
Probably because in this comment, it's more reasonable that a human reader will read the file within the same folder, and in the warning message, the compilation will probably be from the root folder. I'm fine either way
configs/config-ccm-psk-tls1_2.h
Outdated
@@ -83,6 +83,6 @@ | |||
*/ | |||
#define MBEDTLS_SSL_MAX_CONTENT_LEN 512 | |||
|
|||
#include "mbedtls/check_config.h" | |||
#include "check_config.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.
The README.txt file in the configs directory states that there are two options to use these config files
Replace the default file include/mbedtls/config.h with the chosen one.
(Depending on your compiler, you may need to adjust the line with
#include "mbedtls/check_config.h" then.)Define MBEDTLS_CONFIG_FILE and adjust the include path accordingly.
So in case (1) the user has to do nothing and just copy the file over as stated in the readme (actually, I think the information in brackets is no longer relevant). However, in the case of (2) the user will probably need to add ./configs
to the include path as well as ./include/mbedtls
(because this patch removes the namespacing bit). Also, note that without this change, case (1) will also work with the mbedtls/
prefix, its just not ideal and its already properly documented.
So I am not too sure that we should remove the namespacing from these config files. But if we do want to remove, we should at least fix the documentation accordingly.
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'll revert the changes in the configs
Dismissing review as there are pending questions.
Added the "needs backports" label, as the backports are still pending reviews |
Revert the changes in the `configs` folder to align with the `README.txt` file.
@andresag01 I have reverted the changes in the cc @hanno-arm |
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.
@RonEld: Sorry to cause so much trouble over this, but please see my comment regarding the config-no-entropy. You could either leave the header as it was or fix the Mbed OS script for the next Mbed TLS release into that repo. However, to be honest I think this is a bit too much trouble to fix this issue, in reality I do not think this is causing anyone any trouble because the compiler is going to find the headers either way, its just a difference as to what it is going to search first...
configs/config-no-entropy.h
Outdated
@@ -87,6 +87,6 @@ | |||
/* Miscellaneous options */ | |||
#define MBEDTLS_AES_ROM_TABLES | |||
|
|||
#include "check_config.h" | |||
#include "mbedtls/check_config.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.
I think this might not be ideal. The issue is that this file is copied by some import script directly into the inc/mbedtls directory in Mbed TLS, so technically the mbedtls/
prefix is not needed.
Remove the `mbedtls` namespacing from the `config-no-entropy.h` file, as it is being imported to the include folder.
@andresag01 I have removed the |
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.
LGTM
*/ | ||
|
||
#if !defined(MBEDTLS_DEPRECATED_REMOVED) | ||
#include "mbedtls/net_sockets.h" | ||
#include "net_sockets.h" | ||
#if defined(MBEDTLS_DEPRECATED_WARNING) | ||
#warning "Deprecated header file: Superseded by mbedtls/net_sockets.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.
I personally think it's better to keep it as it is.
Done |
retest |
Remove the
mbedtls
namesapcing in the#include
in header filesResolves #857