External Authorization Data

EDHOC carries optional EAD items in fields EAD_1EAD_4 of the four handshake messages. libedhoc exposes a thin callback interface that lets the application produce outgoing EAD tokens and inspect incoming ones without changing the protocol state machine.

Header file: include/edhoc/ead.h
group EDHOC interface EAD
struct edhoc_ead_token
#include <ead.h>

A single EAD item: a label and an optional value (RFC 9528: 3.8).

Public Members

int32_t label

EAD label. A negative label marks the item as critical: the library does not act on that, so edhoc_ead::process must fail the session when it does not recognise one (RFC 9528: 3.8).

struct edhoc_buffer value

Optional EAD value. Empty when the item carries a label only.

Neither side owns the bytes. On compose they belong to the application and must stay valid until the composing call returns; on process they point into a library buffer released as soon as the callback returns, so anything needed later must be copied out.

struct edhoc_ead
#include <ead.h>

External authorization data interface, bound with edhoc_bind_ead.

  Both entries are mandatory. The library never takes ownership of a
  buffer and never frees one.

Public Members

int (*compose)(void *user_context, const struct edhoc_call_context *call_context, struct edhoc_ead_token *ead_token, size_t ead_token_size, size_t *ead_token_count)

Compose external authorization data (EAD) items.

Called by the library while composing an outgoing message so the application can attach EAD items to it (RFC 9528: 3.8). Write zero or more items and set ead_token_count accordingly.

Param user_context:

[in] User context.

Param call_context:

[in] Context of this call.

Param ead_token:

[out] Array to fill with the EAD items to send.

Param ead_token_size:

Capacity of the ead_token array in entries.

Param ead_token_count:

[out] On success, the number of items written.

Retval EDHOC_SUCCESS:

Success.

Return:

Negative error code on failure (EDHOC error codes).

int (*process)(void *user_context, const struct edhoc_call_context *call_context, const struct edhoc_ead_token *ead_token, size_t ead_token_size)

Process received external authorization data (EAD) items.

Called by the library while processing an incoming message to deliver the received EAD items to the application for validation (RFC 9528: 3.8). Returning an error aborts the EDHOC session.

Param user_context:

[in] User context.

Param call_context:

[in] Context of this call.

Param ead_token:

[in] Array of the received EAD items.

Param ead_token_size:

Number of received items in ead_token.

Retval EDHOC_SUCCESS:

Success.

Return:

Negative error code on failure (EDHOC error codes).