You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mbedtls_x509_crt_parse parses multiple certificates, and it finds an invalid certificate (e.g. with unrecognized critical extensions), it will free the current certificate pointer. This means our strategy of calling once to determine the linked list size and then again to fill a pre-allocated linked list fails with an invalid cert in the input because mbedTLS will try to free the pre-allocated certificate.
The text was updated successfully, but these errors were encountered:
128: MbedTLS Reference counted instead of lifetimes r=jethrogb a=AdrianCX
Moving from referene counting allows simpler move to native-tls / hyper.
Arc Changes:
- Each Config/Context/... will hold Arcs towards items it holds pointers to.
- This forces objects to live as long as needed, once no longer used they get destroyed by reference counting.
This allows passing the objects to multiple threads without worrying about lifetime.
I've also added notes why classes are Sync where used. Let me know if I missed any classes.
Usage example of an intermediate mbed-hyper integration is at:
- https://github.com/fortanix/rust-mbedtls/tree/acruceru/wip-mbed-hyper-v2/mbedtls-hyper/examples/integrations
There I added a crate to wrap hyper - similar to native-tls. (that will be moved to native-tls layer soon)
That crate can be considered an integration test that I will raise a separate PR for.
Edit:
Changes after initial review:
- Added forward_mbedtls_calloc / forward_mbedtls_free functions so we can pass certificates to and from mbedtls without allocator mismatches/corruptions.
- Switched to MbedtlsList<Certificate> and Certificate. A MbedtlsBox is pending for this PR as well.
- Fixed most comments.
Still pending:
- Update define! macros
- Add MbedtlsBox<Certificate>
Fixes#1
Partial progress on #3Fixes#4Fixes#8
Partially addresses #9
Co-authored-by: Adrian Cruceru <adrian.cruceru@fortanix.com>
When
mbedtls_x509_crt_parse
parses multiple certificates, and it finds an invalid certificate (e.g. with unrecognized critical extensions), it will free the current certificate pointer. This means our strategy of calling once to determine the linked list size and then again to fill a pre-allocated linked list fails with an invalid cert in the input because mbedTLS will try to free the pre-allocated certificate.The text was updated successfully, but these errors were encountered: