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

coap_mbedtls.c: Make TLS error recovery more rigorous #807

Merged
merged 1 commit into from
Feb 24, 2022

Conversation

mrdeep1
Copy link
Collaborator

@mrdeep1 mrdeep1 commented Dec 23, 2021

Support self-signed certificates that have expired.

Correct variable ret initialization in coap_tls_read().

Catch some additional MbedTLS SSL error codes in do_mbedtls_handshake().

@obgm
Copy link
Owner

obgm commented Jan 14, 2022

Two minor things:

  • Indentation seems a bit uneven,
  • do we want to log if an expired self-signed certificate has been accepted?

@mrdeep1
Copy link
Collaborator Author

mrdeep1 commented Jan 14, 2022

I think that I have caught the indentations that you are referring to - code pushed.
With the fix otherwise, it still reports (from cert_verify_callback_mbedtls())

Jan 14 18:45:14.061 INFO    127.0.0.1:32837 <-> 127.0.0.1:5684 TLS : The certificate has expired: overridden: 'registrar.stok.nl' depth 0
Jan 14 18:45:14.061 INFO    127.0.0.1:32837 <-> 127.0.0.1:5684 TLS : Self-signed: overridden: 'registrar.stok.nl' depth 0

whereas before this PR is applied

Jan 14 18:47:16.115 INFO    127.0.0.1:32838 <-> 127.0.0.1:5684 TLS : The certificate has expired: overridden: 'registrar.stok.nl' depth 0
Jan 14 18:47:16.115 INFO CN 'registrar.stok.nl' presented by server (Certificate)
Jan 14 18:47:16.115 WARN    127.0.0.1:32838 <-> 127.0.0.1:5684 TLS : The certificate is not correctly signed by the trusted CA: issue 0x8: 'registrar.stok.nl' depth 0

Before, if we were handling MBEDTLS_X509_BADCERT_NOT_TRUSTED (coap_mbedtls.c:377), we could not check if it was a self-signed certificate if there was an expiry error.

src/coap_mbedtls.c Outdated Show resolved Hide resolved
Support self-signed certificates that have expired.

Correct variable ret initialization in coap_tls_read().

Catch some additional MbedTLS SSL error codes in do_mbedtls_handshake().
@obgm obgm merged commit 6afee4a into obgm:develop Feb 24, 2022
@mrdeep1 mrdeep1 deleted the mbedtls_tcp_fixes branch February 24, 2022 08:43
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