Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

CoAP OSCORE API. More...

Data Structures

struct  coap_oscore_init_params
 OSCORE security context derivation parameters (@rfc{8613,section-3.2}). More...
struct  coap_oscore_exchange
 OSCORE exchange entry. More...

Enumerations

enum  coap_oscore_aead_alg { COAP_OSCORE_AEAD_AES_CCM_16_64_128 = 0 }
 AEAD algorithm used to protect OSCORE messages (@rfc{8613,section-3.1}). More...
enum  coap_oscore_hkdf { COAP_OSCORE_HKDF_SHA_256 = 0 }
 HKDF algorithm used to derive OSCORE keys (@rfc{8613,section-3.1}). More...

Functions

int coap_oscore_context_add (const struct coap_oscore_init_params *params, struct coap_oscore_context **ctx)
 Add an OSCORE security context.
int coap_oscore_context_remove (struct coap_oscore_context *ctx)
 Remove an OSCORE security context.

Detailed Description

CoAP OSCORE API.

Since
4.5
Version
0.1.0

Enumeration Type Documentation

◆ coap_oscore_aead_alg

#include <coap_oscore.h>

AEAD algorithm used to protect OSCORE messages (@rfc{8613,section-3.1}).

Enumerator
COAP_OSCORE_AEAD_AES_CCM_16_64_128 

AES-CCM mode 128-bit key, 64-bit tag, 13-byte nonce.

◆ coap_oscore_hkdf

#include <coap_oscore.h>

HKDF algorithm used to derive OSCORE keys (@rfc{8613,section-3.1}).

Enumerator
COAP_OSCORE_HKDF_SHA_256 

HKDF-SHA-256.

Function Documentation

◆ coap_oscore_context_add()

int coap_oscore_context_add ( const struct coap_oscore_init_params * params,
struct coap_oscore_context ** ctx )

#include <coap_oscore.h>

Add an OSCORE security context.

Derives the common, sender and recipient contexts from params (@rfc{8613,section-3.2}) and adds them to the pool of contexts that can be used with the CoAP server. Contexts are allocated from a fixed pool sized by

CONFIG_COAP_OSCORE_MAX_CONTEXTS 

and released with coap_oscore_context_remove(). Each context corresponds to one client identity (Recipient ID); add one context per client to serve multiple clients concurrently.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_COAP_OSCORE 
.
Parameters
paramsDerivation parameters.
ctxOn success, set to the newly created context handle.
Return values
0on success.
-EINVALif params is NULL, a required parameter is missing or has an invalid size, or the context could not be derived.
-ENOTSUPif fresh_master_secret_salt is false while
CONFIG_COAP_OSCORE_CONTEXT_REUSE 
is disabled.
-ENOMEMif no free context slot is available.

◆ coap_oscore_context_remove()

int coap_oscore_context_remove ( struct coap_oscore_context * ctx)

#include <coap_oscore.h>

Remove an OSCORE security context.

Removes the context from the pool of contexts that can be used with the CoAP server. The context is reference-counted: if an in-flight request, an active exchange, or an observer still references it, the context is retained and -EAGAIN is returned. Retry once those references have been released. Passing NULL returns -EINVAL.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_COAP_OSCORE 
.
Parameters
ctxContext handle to remove.
Return values
0on success.
-EAGAINif the context is in use and cannot be removed.
-EINVALif ctx is NULL or not a valid context handle.