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  quic_keyset
 Per-protection-level key store: one AES-128-GCM key set per level plus an installed flag. More...

Macros

#define QUIC_LEVEL_INITIAL   0
 Initial packet protection level.
#define QUIC_LEVEL_HANDSHAKE   1
 Handshake packet protection level.
#define QUIC_LEVEL_ONERTT   2
 1-RTT packet protection level
#define QUIC_KEYSET_LEVELS   3
 number of protection levels

Functions

void quic_keyset_init (quic_keyset *state)
 Clear all levels to not-installed.
int quic_keyset_install (quic_keyset *state, int level, const quic_initial_keys *keys)
 Install keys at level (0/1/2).
int quic_keyset_for_level (const quic_keyset *state, int level, const quic_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 quic_initial_keys (AES-128-GCM material) plus an installed flag.

Function Documentation

◆ quic_keyset_for_level()

int quic_keyset_for_level ( const quic_keyset * state,
int level,
const quic_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 (QUIC_LEVEL_*)
outreceives a pointer to the installed keys
Returns
1 if installed, 0 otherwise.

◆ quic_keyset_init()

void quic_keyset_init ( quic_keyset * state)

Clear all levels to not-installed.

Parameters
statekey set to reset

◆ quic_keyset_install()

int quic_keyset_install ( quic_keyset * state,
int level,
const quic_initial_keys * keys )

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

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