Function anjay_oscore_add_instance

Function Documentation

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:
  • anjay – Anjay instance with OSCORE Object installed to operate on.

  • instance – Structure containing information required to instantiate OSCORE Instance.

  • inout_iid – OSCORE 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.