Function s2n_quic::provider::tls::default::ffi::s2n_connection_deserialize

source ·
pub unsafe extern "C" fn s2n_connection_deserialize(
    conn: *mut s2n_connection,
    buffer: *mut u8,
    buffer_length: u32
) -> i32
Expand description

Deserializes the provided buffer into the s2n_connection parameter.

@warning s2n-tls DOES NOT check the integrity of the provided buffer. s2n-tls may successfully deserialize a corrupted buffer which WILL cause a connection failure when attempting to resume sending/receiving encrypted data. To avoid this, it is recommended to MAC and encrypt the serialized connection before sending it off-box and deserializing it.

@warning Only a minimal amount of information about the original TLS connection is serialized. Therefore, after deserialization, the connection will behave like a new s2n_connection from the s2n_connection_new() call, except that it can read/write encrypted data from a peer. Any desired config-level or connection-level configuration will need to be re-applied to the deserialized connection. For this same reason none of the connection getters will return useful information about the original connection after deserialization. Any information about the original connection needs to be retrieved before serialization.

@param conn A pointer to the connection object. Should be a new s2n_connection object. @param buffer A pointer to the buffer where the serialized connection will be read from. @param buffer_length Maximum amount of data that can be read from the buffer parameter. @returns S2N_SUCCESS on success, S2N_FAILURE on error.