anjay
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
oscore.h File Reference
#include <anjay/dm.h>
#include <avsystem/coap/oscore.h>

Go to the source code of this file.

Data Structures

struct  anjay_oscore_instance_t
 

Functions

int anjay_oscore_add_instance (anjay_t *anjay, const anjay_oscore_instance_t *instance, anjay_iid_t *inout_iid)
 
void anjay_oscore_object_purge (anjay_t *anjay)
 
avs_error_t anjay_oscore_object_persist (anjay_t *anjay, avs_stream_t *out_stream)
 
avs_error_t anjay_oscore_object_restore (anjay_t *anjay, avs_stream_t *in_stream)
 
bool anjay_oscore_object_is_modified (anjay_t *anjay)
 
int anjay_oscore_object_install (anjay_t *anjay)
 

Function Documentation

◆ anjay_oscore_add_instance()

int anjay_oscore_add_instance ( anjay_t anjay,
const anjay_oscore_instance_t instance,
anjay_iid_t inout_iid 
)

Adds new Instance of OSCORE Object and returns newly created Instance ID, via inout_iid .

NOTE: if inout_iid is set to ANJAY_ID_INVALID then the Instance id is generated automatically, otherwise value of inout_iid is used as a new OSCORE Instance ID.

NOTE: info may be safely freed by the user code after this function finishes (internally a deep copy of anjay_oscore_instance_t is performed).

WARNING: calling this function during active communication with Bootstrap Server may yield undefined behavior and unexpected failures may occur.

IMPORTANT: The AEAD Algorithm used is AES-CCM-16-64-128. IMPORTANT: The HMAC Algorithm used is HKDF SHA-256.

Parameters
anjayAnjay instance with OSCORE Object installed to operate on.
instanceStructure containing information required to instantiate OSCORE Instance.
inout_iidOSCORE Instance ID to use or ANJAY_ID_INVALID .
Returns
0 on success, negative value in case of an error or if the instance of specified id already exists.

◆ anjay_oscore_object_install()

int anjay_oscore_object_install ( anjay_t anjay)

Installs the OSCORE Object in Anjay.

The OSCORE module does not require explicit cleanup; all resources will be automatically freed up during the call to anjay_delete.

Parameters
anjayAnjay instance for which the OSCORE Object is installed.
Returns
0 on success, or a negative value in case of error.

◆ anjay_oscore_object_is_modified()

bool anjay_oscore_object_is_modified ( anjay_t anjay)

Checks whether the OSCORE Object in Anjay instance has been modified since last successful call to anjay_oscore_object_persist or anjay_oscore_object_restore.

◆ anjay_oscore_object_persist()

avs_error_t anjay_oscore_object_persist ( anjay_t anjay,
avs_stream_t *  out_stream 
)

Dumps OSCORE Object Instances to the out_stream.

Parameters
anjayAnjay instance with OSCORE Object installed.
out_streamStream to write to.
Returns
AVS_OK in case of success, or an error code.

◆ anjay_oscore_object_purge()

void anjay_oscore_object_purge ( anjay_t anjay)

Purges instances of OSCORE Object, leaving it in an empty state.

Parameters
anjayAnjay instance with OSCORE Object installed.

◆ anjay_oscore_object_restore()

avs_error_t anjay_oscore_object_restore ( anjay_t anjay,
avs_stream_t *  in_stream 
)

Attempts to restore OSCORE Object Instances from specified in_stream.

Note: if restore fails, then OSCORE Object will be left untouched, on success though all Instances stored within the Object will be purged.

Parameters
anjayAnjay instance with OSCORE Object installed.
in_streamStream to read from.
Returns
AVS_OK in case of success, or an error code.