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

Add getters for some fields #7216

Conversation

lpy4105
Copy link
Contributor

@lpy4105 lpy4105 commented Mar 7, 2023

Description

Partially Fix: #6840

The getters are added for the convenience of application usage.

Gatekeeper checklist

  • changelog provided
  • backport not required
  • tests provided

@lpy4105 lpy4105 added enhancement needs-design-approval needs-review Every commit must be reviewed by at least two team members, component-tls needs-reviewer This PR needs someone to pick it up for review size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon labels Mar 7, 2023
@yanesca
Copy link
Contributor

yanesca commented Apr 17, 2023

@lpy4105 according to the new process only planned work that is scheduled for the current quarter should have 'high-priority' label. PRs with 'high-priority' label should be added to the unified board. This PR is labelled 'high-priority' but is not on the unified board. Does this PR belong to some stream of work we planned for this quarter?

@gilles-peskine-arm
Copy link
Contributor

@yanesca This is from last quarter and I don't see any reason to abandon it.

@yanesca
Copy link
Contributor

yanesca commented Apr 17, 2023

@gilles-peskine-arm thank you for confirming. I am not trying to challenge the necessity of this work or proposing to abandon it. There is an inconsistency between the number of items on the unified board and the items labelled as 'priority-high' and would like to figure out what is going on.

@lpy4105 lpy4105 added priority-medium Medium priority - this can be reviewed as time permits and removed priority-high High priority - will be reviewed soon labels Apr 19, 2023
@daverodgman daverodgman added the historical-reviewing Currently reviewing (for legacy PR/issues) label Jul 7, 2023
@daverodgman daverodgman self-requested a review July 7, 2023 13:13
@tom-daubney-arm tom-daubney-arm requested review from tom-daubney-arm and removed request for daverodgman July 7, 2023 13:13
Copy link
Contributor

@daverodgman daverodgman left a comment

Choose a reason for hiding this comment

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

Please add tests & changelog

lpy4105 added 6 commits July 10, 2023 11:33
It would be convenient for users to query the endpoint
type directly from a ssl context:

```
    mbedtls_ssl_conf_get_endpoint(
        mbedtls_ssl_context_get_config(&ssl))
```

Signed-off-by: Pengyu Lv <[email protected]>
@lpy4105 lpy4105 force-pushed the issue/6840/add-getters-for-some-fields branch from d326840 to 7c57b9d Compare July 10, 2023 04:13
@lpy4105
Copy link
Contributor Author

lpy4105 commented Jul 10, 2023

Adding tests results a conflict with development due to some changes in tests/suites/test_suite_ssl.function. So I rebased the PR to the latest development.

Changes:

  • The parameter of mbedtls_ssl_conf_get_endpoint is changed to const mbedtls_ssl_config *
  • Add tests for mbedtls_ssl_conf_get_endpoint, mbedtls_ssl_get_hostname and mbedtls_ssl_cache_get_timeout.
  • Add changelog.

Signed-off-by: Pengyu Lv <[email protected]>
@lpy4105 lpy4105 force-pushed the issue/6840/add-getters-for-some-fields branch from 7c57b9d to 5a3f5f4 Compare July 10, 2023 05:27
@daverodgman
Copy link
Contributor

daverodgman commented Jul 10, 2023

Please merge (e.g. git merge origin/development) rather than rebase, as it makes it easier for reviewers to see what's changed since their last review

@daverodgman daverodgman removed needs-work needs-reviewer This PR needs someone to pick it up for review labels Jul 10, 2023
@daverodgman
Copy link
Contributor

And please don't forget to update labels (@tom-daubney-arm remember to remove needs-reviewer when adding yourself as second reviewer)

@daverodgman daverodgman added the needs-ci Needs to pass CI tests label Jul 10, 2023
@lpy4105 lpy4105 requested a review from daverodgman July 10, 2023 09:01
@tom-daubney-arm tom-daubney-arm added historical-reviewed Reviewed & agreed to keep legacy PR/issue and removed needs-ci Needs to pass CI tests historical-reviewing Currently reviewing (for legacy PR/issues) labels Jul 10, 2023
Copy link
Contributor

@tom-daubney-arm tom-daubney-arm left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Testing looks sufficient.

A couple of minor points to address if you agree that they are beneficial changes but nothing that should hold up review. Thanks!

/**
* \brief Get the hostname that checked against the received
* server certificate. It is used to set the ServerName
* TLS extension, too, if that extension is enabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove the commas around the word "too". Not really needed here.

mbedtls_ssl_context ssl;

mbedtls_ssl_init(&ssl);
USE_PSA_INIT();

TEST_ASSERT(mbedtls_ssl_set_hostname(&ssl, hostname0) == 0);
hostname = mbedtls_ssl_get_hostname(&ssl);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like the naming of the variables here. I know hostname0 and hostname1 existed before this PR but since we're here it might be nicer to rename them a bit for clarity. Maybe to distinguish between inputs and outputs so perhaps hostname0 --> input_hotstname0, similar for hostname1 and then perhaps hostname --> ouput_hostname.

This is just my preference and I accept others may not think this is needed so I won't request changes just for this, but consider changing them if you agree.

@daverodgman daverodgman added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, labels Jul 10, 2023
@daverodgman
Copy link
Contributor

I think Tom's comments are sensible, but I don't think it's worth iterating the PR just for this.

@daverodgman daverodgman merged commit f3e488e into Mbed-TLS:development Jul 10, 2023
@lpy4105 lpy4105 mentioned this pull request Jul 11, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports component-tls enhancement historical-reviewed Reviewed & agreed to keep legacy PR/issue priority-medium Medium priority - this can be reviewed as time permits size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add getters for some fields
5 participants