Conversation
src/client.rs
Outdated
| ca_chain: Some(tls.certificates.clone()), | ||
| creds: None, |
There was a problem hiding this comment.
This is an incompatible upgrade; Where previously esp_mbedtls::Certificates contained a client certificate, a private key and a CA chain, now Certificate represents only a parsed X509 chain.
By setting creds: None, there's now no way to use client certificates for authentication.
|
@ivmarkov pinging you for a review, since you have a broader knowledge of the refactoring than I do. |
ivmarkov
left a comment
There was a problem hiding this comment.
Really, just one nit from my side but overall - LGTM.
src/client.rs
Outdated
| min_version: tls.version, | ||
| }), | ||
| )?; | ||
| session.set_server_name(unsafe { core::ffi::CStr::from_bytes_with_nul_unchecked(&servername) })?; |
There was a problem hiding this comment.
Nit: strictly speaking, there is no need for unsafe. Isn't it better to do CStr::from_bytes_with_nul(&servername).unwrap()?
There was a problem hiding this comment.
unsafe is the way it was done before, so I thought I'd leave it. But yeah I agree, the performance benefit is absolutely negligible. Fixed now.
You can also make the case that we should publish a "0.1" version of I think once esp-rs/mbedtls-rs#108 is in, we should really do it. |
Yes, absolutely. Is that something that's imminent? If yes, sure, let's wait for that. Because if not, or if other API changes are coming up, I'd just reference the current commit for the time. What about the What I think we can do here is call |
I hope it is a matter of a week or two - at most.
|
Alright, then let's wait for that! We can either put the crates.io version into I implemented a draft for |
The most recent refactor as well as the renaming of
esp-mbedtls(nowmbedtls-rs) broke quite a bit.This fixes it, making it usable again.
However, there are a few points I would like to discuss before possibly merging this:
mbedtls_rswants C-Strings for theservername, and we only get it as a&str, so we need some sort of allocation. Here, I did it similarly to how it was before and copied, but that needs thealloccrate.mbedtlsneeds some form of allocation anyway, so it can as well be the rust-one.mbedtls-rscommit?mbedtls'sSessionhas aclose()function, which the library seems to expect to be called (and produces a warning when not). Currently, this is not implemented.close()isasyncand hence cannot be called from, say,drop()HttpClient,close, but don't know if it's the best solution.