Skip to content
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

Merged
merged 4 commits into from
Jul 20, 2018

Conversation

RonEld
Copy link
Contributor

@RonEld RonEld commented May 14, 2017

Remove the mbedtls namesapcing in the #include in header files
Resolves #857

ChangeLog Outdated
= mbed TLS x.x.x branch released xxxx-xx-xx

Bugfix
* Fix namespacing in header files. REmove the `mbedtls` namespacing in

Choose a reason for hiding this comment

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

Typo

@Patater Patater added needs-review Every commit must be reviewed by at least two team members, needs-work labels Sep 29, 2017
@RonEld
Copy link
Contributor Author

RonEld commented Oct 1, 2017

@hanno-arm Thank you for your review
I fixed the typo. Please approve

@RonEld RonEld requested a review from andresag01 October 1, 2017 14:13
*/

#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"
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

@RonEld RonEld mentioned this pull request Dec 21, 2017
@simonbutcher simonbutcher added the needs-backports Backports are missing or are pending review and approval. label May 30, 2018
andresag01
andresag01 previously approved these changes May 30, 2018
@RonEld
Copy link
Contributor Author

RonEld commented Jun 21, 2018

I have merged development branch into this PR to resolve conflicts.
I have fixed typo in previous commit message.
@andresag01 @hanno-arm Please review

@RonEld RonEld removed the needs-work label Jun 21, 2018
@andresag01
Copy link
Contributor

andresag01 commented Jun 21, 2018

@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?

@simonbutcher simonbutcher added needs-work and removed needs-review Every commit must be reviewed by at least two team members, labels Jun 22, 2018
Remove the `mbedtls` namesapcing in the `#include` in header files
Resolves issue Mbed-TLS#857
Fix typo in ChangeLog discovered in PR review
@RonEld
Copy link
Contributor Author

RonEld commented Jun 24, 2018

@andresag01 I have removed the merge commit and rebased.
Please review

@RonEld RonEld added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Jun 24, 2018
@RonEld
Copy link
Contributor Author

RonEld commented Jun 24, 2018

backports created in #1779 and #1780 for mbedtls-2.1 and mbedtls-2.7 respectively

Copy link
Contributor

@andresag01 andresag01 left a 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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@@ -83,6 +83,6 @@
*/
#define MBEDTLS_SSL_MAX_CONTENT_LEN 512

#include "mbedtls/check_config.h"
#include "check_config.h"
Copy link
Contributor

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

  1. 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.)

  2. 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.

Copy link
Contributor Author

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

@andresag01 andresag01 dismissed their stale review June 27, 2018 08:37

Dismissing review as there are pending questions.

@andresag01 andresag01 added needs-work and removed needs-review Every commit must be reviewed by at least two team members, needs-backports Backports are missing or are pending review and approval. labels Jun 27, 2018
@RonEld RonEld added the needs-backports Backports are missing or are pending review and approval. label Jun 27, 2018
@RonEld
Copy link
Contributor Author

RonEld commented Jun 27, 2018

Added the "needs backports" label, as the backports are still pending reviews

@simonbutcher simonbutcher changed the title Remove unneeded namesapcing in header files Remove unneeded namespacing in header files Jun 29, 2018
Revert the changes in the `configs` folder to
align with the `README.txt` file.
@RonEld
Copy link
Contributor Author

RonEld commented Jul 1, 2018

@andresag01 I have reverted the changes in the configs folder, and added an mbedtls namespace in the config-no-entropy.h file as well. Please review

cc @hanno-arm

@RonEld RonEld added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Jul 1, 2018
Copy link
Contributor

@andresag01 andresag01 left a 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...

@@ -87,6 +87,6 @@
/* Miscellaneous options */
#define MBEDTLS_AES_ROM_TABLES

#include "check_config.h"
#include "mbedtls/check_config.h"
Copy link
Contributor

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.

@RonEld RonEld added needs-work and removed needs-review Every commit must be reviewed by at least two team members, labels Jul 3, 2018
Remove the `mbedtls` namespacing from the `config-no-entropy.h` file,
as it is being imported to the include folder.
@RonEld
Copy link
Contributor Author

RonEld commented Jul 3, 2018

@andresag01 I have removed the mbedtls namespacing as you requested.
I will update the backports once this PR is approved

@RonEld RonEld added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Jul 3, 2018
Copy link
Contributor

@simonbutcher simonbutcher left a 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"
Copy link
Contributor

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.

@simonbutcher simonbutcher removed the needs-review Every commit must be reviewed by at least two team members, label Jul 4, 2018
@simonbutcher
Copy link
Contributor

@RonEld - Can you please backport the review feedback? #1779 and #1780 need the same fixes following the review of this PR.

@RonEld
Copy link
Contributor Author

RonEld commented Jul 5, 2018

Done

@andresag01 andresag01 removed the needs-backports Backports are missing or are pending review and approval. label Jul 10, 2018
@simonbutcher simonbutcher added the approved Design and code approved - may be waiting for CI or backports label Jul 16, 2018
@simonbutcher
Copy link
Contributor

retest

@simonbutcher simonbutcher added needs-ci Needs to pass CI tests and removed approved Design and code approved - may be waiting for CI or backports labels Jul 16, 2018
@simonbutcher simonbutcher merged commit 21f9afe into Mbed-TLS:development Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-ci Needs to pass CI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants