ngtcp2_crypto_generate_regular_token

Synopsis

#include <ngtcp2/ngtcp2_crypto.h>

ngtcp2_ssize ngtcp2_crypto_generate_regular_token(uint8_t *token, const uint8_t *secret, size_t secretlen, const ngtcp2_sockaddr *remote_addr, ngtcp2_socklen remote_addrlen, ngtcp2_tstamp ts)

ngtcp2_crypto_generate_regular_token() generates a token in the buffer pointed by token that is sent with NEW_TOKEN frame. The buffer pointed by token must have at least NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN bytes long. The successfully generated token starts with NGTCP2_CRYPTO_TOKEN_MAGIC_REGULAR. secret of length secretlen is a keying material to generate keys to encrypt the token. remote_addr of length remote_addrlen is an address of client. ts is the timestamp when the token is generated.

This function returns the length of generated token if it succeeds, or -1.