9#ifndef __CWIST_CORE_SEQ_SEQ_AUTH_H__
10#define __CWIST_CORE_SEQ_SEQ_AUTH_H__
18#define CWIST_SEQ_AUTH_KEY_SIZE 32
19#define CWIST_SEQ_AUTH_SESSION_ID_SIZE 16
20#define CWIST_SEQ_AUTH_MESSAGE_ID_SIZE 16
21#define CWIST_SEQ_AUTH_NONCE_SIZE 12
22#define CWIST_SEQ_AUTH_TAG_SIZE 16
23#define CWIST_SEQ_AUTH_HEADER_SIZE \
24 (CWIST_SEQ_HEADER_SIZE + CWIST_SEQ_AUTH_MESSAGE_ID_SIZE + CWIST_SEQ_AUTH_NONCE_SIZE + \
25 CWIST_SEQ_AUTH_TAG_SIZE)
38 size_t replay_window);
51 size_t chunk_len, uint8_t **out,
size_t *out_len);
TCP-like sequenced message fragmentation and reassembly.
#define CWIST_SEQ_AUTH_NONCE_SIZE
cwist_seq_auth_context_t * cwist_seq_auth_context_create(const uint8_t key[CWIST_SEQ_AUTH_KEY_SIZE], const uint8_t session_id[CWIST_SEQ_AUTH_SESSION_ID_SIZE], size_t replay_window)
Create an authenticated-sequencing context.
struct cwist_seq_auth_metadata cwist_seq_auth_metadata_t
bool cwist_seq_auth_wrap(const cwist_seq_auth_context_t *ctx, const uint8_t message_id[CWIST_SEQ_AUTH_MESSAGE_ID_SIZE], const uint8_t nonce[CWIST_SEQ_AUTH_NONCE_SIZE], const uint8_t *chunk, size_t chunk_len, uint8_t **out, size_t *out_len)
Attach message id, nonce, and authentication tag to a chunk.
bool cwist_seq_auth_random(uint8_t *out, size_t len)
Fill a buffer with cryptographically secure random bytes.
#define CWIST_SEQ_AUTH_SESSION_ID_SIZE
void cwist_seq_auth_context_destroy(cwist_seq_auth_context_t *ctx)
Destroy an authenticated-sequencing context.
#define CWIST_SEQ_AUTH_MESSAGE_ID_SIZE
struct cwist_seq_auth_context cwist_seq_auth_context_t
bool cwist_seq_auth_unwrap(cwist_seq_auth_context_t *ctx, const uint8_t *data, size_t len, cwist_seq_auth_metadata_t *metadata, cwist_seq_chunk_t *chunk)
Verify, authenticate, and split an incoming authenticated chunk.
#define CWIST_SEQ_AUTH_KEY_SIZE
void cwist_seq_auth_mark_complete(cwist_seq_auth_context_t *ctx, const uint8_t message_id[CWIST_SEQ_AUTH_MESSAGE_ID_SIZE])
Record a message id as fully received.
Parsed view of one sequenced chunk.