wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
keyset.h File Reference

RFC 9001 4: per-protection-level key sets. More...

Go to the source code of this file.

Data Structures

struct  keyset
 Per-protection-level key store: one AES-128-GCM key set per level plus an installed flag. More...

Macros

#define LEVEL_INITIAL   0
 Initial packet protection level.
#define LEVEL_HANDSHAKE   1
 Handshake packet protection level.
#define LEVEL_ONERTT   2
 1-RTT packet protection level
#define KEYSET_LEVELS   3
 number of protection levels

Functions

void keyset_init (keyset *state)
 Clear all levels to not-installed.
int keyset_install (keyset *state, int level, const initial_keys *keys)
 Install keys at level (0/1/2).
int keyset_for_level (const keyset *state, int level, const initial_keys **out)
 Fetch keys for level into *out.

Detailed Description

RFC 9001 4: per-protection-level key sets.

Levels: 0=Initial, 1=Handshake, 2=1-RTT. Each level holds one initial_keys (AES-128-GCM material) plus an installed flag.

Function Documentation

◆ keyset_for_level()

int keyset_for_level ( const keyset * state,
int level,
const initial_keys ** out )

Fetch keys for level into *out.

*out points into state; it stays valid while state lives and the level is not overwritten.

Parameters
statekey set to query
levelprotection level (LEVEL_*)
outreceives a pointer to the installed keys
Returns
1 if installed, 0 otherwise.

◆ keyset_init()

void keyset_init ( keyset * state)

Clear all levels to not-installed.

Parameters
statekey set to reset

◆ keyset_install()

int keyset_install ( keyset * state,
int level,
const initial_keys * keys )

Install keys at level (0/1/2).

Parameters
statekey set to update
levelprotection level (LEVEL_*)
keyskey material copied into the set
Returns
1 ok, 0 if level out of range.