Skip to content

Commit

Permalink
stub set tls ext ticket callbacks
Browse files Browse the repository at this point in the history
The `SSL_CTX_set_tlsext_ticket_key_cb` and
`SSL_CTX_set_tlsext_ticket_key_evp_cb` API functions can be used to set
up callbacks for managing TLS session tickets. Implementing this
properly will be challenging as they take `EVP_CIPHER_CTX` and
`EVP_MAC_CTX` arguments and expect the caller to do a lot of the
heavy-lifting.

For now let's stub it and see how far we can get by just opaquely
handling TLS session tickets internal to Rustls w/ our own ticketer.
  • Loading branch information
cpu committed Jun 27, 2024
1 parent 0f68342 commit de4eb6e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rustls-libssl/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ entry! {
C_INT_SUCCESS as c_long
}
Ok(SslCtrl::GetMaxProtoVersion) => ctx.get().get_max_protocol_version().into(),
Ok(SslCtrl::SetTlsExtHostname) | Ok(SslCtrl::SetTlsExtServerNameCallback) => {
Ok(SslCtrl::SetTlsExtHostname)
| Ok(SslCtrl::SetTlsExtServerNameCallback)
| Ok(SslCtrl::SetTlsExtTicketKeyCallback) => {
// not a defined operation in the OpenSSL API
0
}
Expand Down Expand Up @@ -635,6 +637,10 @@ entry! {
ctx.get_mut().set_servername_callback(fp);
C_INT_SUCCESS as c_long
}
Ok(SslCtrl::SetTlsExtTicketKeyCallback) => {
log::warn!("ignoring tls ext ticket key callback");
C_INT_SUCCESS as c_long
}
_ => 0,
}
}
Expand Down Expand Up @@ -855,6 +861,7 @@ entry! {
}
// not a defined operation in the OpenSSL API
Ok(SslCtrl::SetTlsExtServerNameCallback)
| Ok(SslCtrl::SetTlsExtTicketKeyCallback)
| Ok(SslCtrl::SetTlsExtServerNameArg)
| Ok(SslCtrl::SetSessCacheSize)
| Ok(SslCtrl::GetSessCacheSize)
Expand Down Expand Up @@ -1885,6 +1892,7 @@ num_enum! {
SetTlsExtServerNameCallback = 53,
SetTlsExtServerNameArg = 54,
SetTlsExtHostname = 55,
SetTlsExtTicketKeyCallback = 72,
SetChain = 88,
SetMinProtoVersion = 123,
SetMaxProtoVersion = 124,
Expand Down

0 comments on commit de4eb6e

Please sign in to comment.