Skip to content

Flag certificate verification functions with MBEDTLS_X509_CRT_PARSE_C. #8465

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

Merged
merged 1 commit into from
Oct 22, 2018

Conversation

SeppoTakalo
Copy link
Contributor

Description

If Mbed TLS support for X509 is not compiled in, TLSSocketWrapper class would
not compile anymore. However, there might be other uses for it, even
if certificates are not used. Therefore add flagging for X509 only
on specific functions.

It has been reported to me, that this issue might became visible if somebody tries to create minimal Mbed TLS configuration file, for example Client Lite does it.

@juhoeskeli Please review.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Copy link
Contributor

@juhoeskeli juhoeskeli left a comment

Choose a reason for hiding this comment

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

This line (183) tries to access struct member hostname which is not there with this setup
/* Start the handshake, the rest will be done in onReceive() */ tr_info("Starting TLS handshake with %s", _ssl.hostname);

The same on line (195):
/* It also means the handshake is done, time to print info */ tr_info("TLS connection to %s established\r\n", _ssl.hostname);

The struct mbedtls_ssl_context in ssl.h has the following macro check:
#if defined(MBEDTLS_X509_CRT_PARSE_C) char *hostname; /*!< expected peer CN for verification (and SNI if available) */ #endif /* MBEDTLS_X509_CRT_PARSE_C */

If Mbed TLS support for X509 is not compiled in, this class would
not compile anymore. However, there might be other uses for it, even
if certificates are not used. Therefore add flagging for X509 only
on specific functions.
@SeppoTakalo
Copy link
Contributor Author

Good catch. Thank you.

I don't know why it did not break the build.

Fixed now.

@juhoeskeli
Copy link
Contributor

juhoeskeli commented Oct 19, 2018

Looks good now. (seems I can not change my review anymore)

@cmonr
Copy link
Contributor

cmonr commented Oct 19, 2018

Looks good now. (seems I can not change my review anymore)

...Huh. Thanks for the heads up.

@NirSonnenschein
Copy link
Contributor

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 21, 2018

Build : SUCCESS

Build number : 3420
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8465/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 21, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 21, 2018

@cmonr cmonr merged commit e269d76 into ARMmbed:master Oct 22, 2018
@adbridge
Copy link
Contributor

adbridge commented Nov 2, 2018

This functionality is not coming in until 5.11 thus updating the release for this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants