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

Merged
6 changes: 6 additions & 0 deletions tests/suites/test_suite_ssl.function
Original file line number Diff line number Diff line change
Expand Up @@ -1148,13 +1148,19 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
void ssl_set_hostname_twice(char *hostname0, char *hostname1)
{
const char *hostname;
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.

TEST_ASSERT(strcmp(hostname0, hostname) == 0);

TEST_ASSERT(mbedtls_ssl_set_hostname(&ssl, hostname1) == 0);
hostname = mbedtls_ssl_get_hostname(&ssl);
TEST_ASSERT(strcmp(hostname1, hostname) == 0);

exit:
mbedtls_ssl_free(&ssl);
Expand Down