Skip to content

Mbedtls certificate time validation and board-config fragments. #9658

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

Closed

Conversation

iabdalkader
Copy link
Contributor

@iabdalkader iabdalkader commented Oct 17, 2022

This PR enables CA certificate validation (a straightforward port of #8854) for stm32 port, and enables support for mbedtls board-level config fragments, for rp2 and stm32 ports. Some boards require specific (very flash consuming) features to be enabled, that are not very useful in general. I imagine this is preferred over enabling these features on port level. Additionally, two board-level configuration files are added for Arduino boards.

@iabdalkader iabdalkader force-pushed the mbedtls_updates_fixes branch from 28933be to ef13017 Compare October 17, 2022 19:38
* This is a reimplementation of micropython#8854 for the stm32 port.
@iabdalkader iabdalkader force-pushed the mbedtls_updates_fixes branch from ef13017 to 9c94080 Compare October 25, 2022 06:51
@iabdalkader
Copy link
Contributor Author

iabdalkader commented Oct 25, 2022

Rebased on the common mbedtls config file, still need those fragments especially for MBEDTLS_ECP_NIST_OPTIM but even if that is enabled in the common config file, it's still a good idea for the required board-config to be known (also in the future, need to add options to enable ALT functions).

@dpgeorge
Copy link
Member

dpgeorge commented Nov 4, 2022

Rebased on the common mbedtls config file, still need those fragments especially for MBEDTLS_ECP_NIST_OPTIM but even if that is enabled in the common config file, it's still a good idea for the required board-config to be known

I'm not sure about this, about having the options repeated in the board config fragment. The idea of the common mbedtls config file is that all ports and boards behave as similar as possible. This follows the general trend of trying to unify the behaviour of all ports/boards, so users aren't confused why one board works with some feature while another doesn't. Adding custom mbedtls config per board goes against that goal.

We are careful about backwards incompatible changes, so these common mbedtls options will not be easily disabled. If you are concerned about it, maybe it's better to add a test (in tests/net_inet/) which accesses the websites that need to have these mbedtls options enabled? That would be a more robust way of ensuring that the required features exist (eg if one day the TLS library changes to something else).

@iabdalkader
Copy link
Contributor Author

about having the options repeated in the board config fragment
Adding custom mbedtls config per board goes against that goal.

I can remove the repeated config options (although I think they double as documentation for the board, I can comment them out maybe ?), however there's nothing I can do about the custom mebdtls config options, they need to be turned on/off somehow per-board. I don't think MBEDTLS_ECP_NIST_OPTIM should be enabled unconditionally in the stm32 port, and some of the options can't even be enabled on port level unconditionally, for example if you enable some ALT function you must provide the alternate implementation. So there will always be a need to conditionally enable/disable mbedtls options somehow, including a board config just seemed to fit in with mpconfigboard.h approach.

@dpgeorge
Copy link
Member

dpgeorge commented Nov 8, 2022

although I think they double as documentation for the board, I can comment them out maybe

What you really want to document is not these options, but the fact that the board should be able to connect via SSL to a given website. That website may change its security protocol and hence you may need to update the mbedtls options to continue to connect to it. As I said, I think a test is the best way to document this requirement. And a comment in the board config file about needing to connect to a given site would also be fine.

however there's nothing I can do about the custom mebdtls config options

Yes, I agree. So for that I think CFLAGS_BOARD is the way forward, with a custom mbedtls_config.h file for the board that includes the existing mbedtls_config.h file and enables additional things.

@iabdalkader iabdalkader force-pushed the mbedtls_updates_fixes branch from 9c94080 to ee48a74 Compare November 8, 2022 08:37
@iabdalkader iabdalkader force-pushed the mbedtls_updates_fixes branch from ee48a74 to 032160e Compare November 8, 2022 08:44
@iabdalkader
Copy link
Contributor Author

Yes, I agree. So for that I think CFLAGS_BOARD is the way forward, with a custom mbedtls_config.h file for the board that includes the existing mbedtls_config.h file and enables additional things.

This is implemented now, but not with CFLAGS_BOARD can you take a look ? I don't think it needs to be any complex than this.

@dpgeorge
Copy link
Member

dpgeorge commented Nov 8, 2022

Rebased and merged in efe7dac through ecd4d54 (and I renamed mbedtls_boardconfig.h to mbedtls_config_board.h, to match other names like mpconfigboard.h).

@dpgeorge dpgeorge closed this Nov 8, 2022
@iabdalkader iabdalkader deleted the mbedtls_updates_fixes branch November 8, 2022 13:16
tannewt added a commit to tannewt/circuitpython that referenced this pull request Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants