#include <ngtcp2/ngtcp2_crypto.h>

int ngtcp2_crypto_read_write_crypto_data(ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level, const uint8_t *data, size_t datalen)

ngtcp2_crypto_read_write_crypto_data() reads CRYPTO data data of length datalen in an encryption level encryption_level, and may feed outgoing CRYPTO data to conn. This function can drive handshake. This function can be also used after handshake completes. It is allowed to call this function with datalen == 0. In this case, no additional read operation is done.

This function returns 0 if it succeeds, or a negative error code. The generic error code is -1 if a specific error code is not suitable. The error codes less than -10000 are specific to underlying TLS implementation. For quictls, the error codes are defined in ngtcp2_crypto_quictls.h.