aws / s2n-tls

An implementation of the TLS/SSL protocols
https://aws.github.io/s2n-tls/usage-guide/
Apache License 2.0
4.52k stars 704 forks source link

bindings: expose ergonomic key logging #4805

Open jmayclin opened 5 days ago

jmayclin commented 5 days ago

Problem:

The bindings expose a key logging callback: set_key_log_callback

However, this method isn't usable without pulling in the raw s2n_tls_sys types because the callback function requires a pointer to the raw s2n-tls connection: s2n_tls_key_log_fn

Solution:

We should expose an ergonomic, safe key log functionality for the rust bindings

camshaft commented 5 days ago

We should probably just move https://github.com/aws/s2n-quic/blob/main/quic/s2n-quic-tls/src/keylog.rs into the s2n-tls crate.

One thing that we should probably fix is making the opened file a static/LazyCell. The way it is right now is each try_open returns a new File handle, which could potentially lead to a mangled file, since we're concurrently writing to it.