Function bearssl::br_ssl_engine_set_buffer [] [src]

pub unsafe extern "C" fn br_ssl_engine_set_buffer(
    cc: *mut br_ssl_engine_context,
    iobuf: *mut c_void,
    iobuf_len: usize,
    bidi: c_int
)

\brief Set the I/O buffer for the SSL engine.

Once this call has been made, br_ssl_client_reset() or br_ssl_server_reset() MUST be called before using the context.

The provided buffer will be used as long as the engine context is used. The caller is responsible for keeping it available.

If bidi is 0, then the engine will operate in half-duplex mode (it won't be able to send data while there is unprocessed incoming data in the buffer, and it won't be able to receive data while there is unsent data in the buffer). The optimal buffer size in half-duplex mode is BR_SSL_BUFSIZE_MONO; if the buffer is larger, then extra bytes are ignored. If the buffer is smaller, then this limits the capacity of the engine to support all allowed record sizes.

If bidi is 1, then the engine will split the buffer into two parts, for separate handling of outgoing and incoming data. This enables full-duplex processing, but requires more RAM. The optimal buffer size in full-duplex mode is BR_SSL_BUFSIZE_BIDI; if the buffer is larger, then extra bytes are ignored. If the buffer is smaller, then the split will favour the incoming part, so that interoperability is maximised.

\param cc SSL engine context \param iobuf I/O buffer. \param iobuf_len I/O buffer length (in bytes). \param bidi non-zero for full-duplex mode.