libcoap 4.3.4
oscore_context.h File Reference

An implementation of the Object Security for Constrained RESTful Enviornments (RFC 8613). More...

#include "coap3/coap_internal.h"
#include "coap3/coap_uthash_internal.h"
#include <stdint.h>
+ Include dependency graph for oscore_context.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  oscore_ctx_t
 
struct  oscore_sender_ctx_t
 
struct  oscore_recipient_ctx_t
 
struct  oscore_association_t
 

Macros

#define CONTEXT_KEY_LEN   16
 
#define TOKEN_SEQ_NUM   2 /* to be set by application */
 
#define EP_CTX_NUM   10 /* to be set by application */
 
#define CONTEXT_INIT_VECT_LEN   13
 
#define CONTEXT_SEQ_LEN   sizeof(uint64_t)
 
#define ED25519_PRIVATE_KEY_LEN   32
 
#define ED25519_PUBLIC_KEY_LEN   32
 
#define ED25519_SEED_LEN   32
 
#define ED25519_SIGNATURE_LEN   64
 
#define OSCORE_SEQ_MAX   (((uint64_t)1 << 40) - 1)
 
#define OSCORE_ASSOCIATIONS_ADD(r, obj)    HASH_ADD(hh, (r), token->s[0], (obj)->token->length, (obj))
 
#define OSCORE_ASSOCIATIONS_DELETE(r, obj)   HASH_DELETE(hh, (r), (obj))
 
#define OSCORE_ASSOCIATIONS_ITER(r, tmp)
 
#define OSCORE_ASSOCIATIONS_ITER_SAFE(e, el, rtmp)    for ((el) = (e); (el) && ((rtmp) = (el)->hh.next, 1); (el) = (rtmp))
 
#define OSCORE_ASSOCIATIONS_FIND(r, k, res)    { HASH_FIND(hh, (r), (k)->s, (k)->length, (res)); }
 

Typedefs

typedef struct oscore_sender_ctx_t oscore_sender_ctx_t
 
typedef struct oscore_recipient_ctx_t oscore_recipient_ctx_t
 
typedef struct oscore_association_t oscore_association_t
 

Enumerations

enum  oscore_mode_t { OSCORE_MODE_SINGLE = 0 , OSCORE_MODE_GROUP , OSCORE_MODE_PAIRWISE }
 

Functions

oscore_ctx_toscore_derive_ctx (coap_context_t *c_context, coap_oscore_conf_t *oscore_conf)
 oscore_derive_ctx - derive a osc_ctx from oscore_conf information More...
 
oscore_ctx_toscore_duplicate_ctx (coap_context_t *c_context, oscore_ctx_t *o_osc_ctx, coap_bin_const_t *sender_id, coap_bin_const_t *recipient_id, coap_bin_const_t *id_context)
 oscore_duplicate_ctx - duplicate a osc_ctx More...
 
void oscore_update_ctx (oscore_ctx_t *osc_ctx, coap_bin_const_t *id_context)
 oscore_update_ctx - update a osc_ctx with a new id_context More...
 
void oscore_free_context (oscore_ctx_t *osc_ctx)
 
void oscore_free_contexts (coap_context_t *c_context)
 
int oscore_remove_context (coap_context_t *c_context, oscore_ctx_t *osc_ctx)
 
oscore_recipient_ctx_toscore_add_recipient (oscore_ctx_t *ctx, coap_bin_const_t *rid, uint32_t break_key)
 oscore_add_recipient - add in recipient information More...
 
int oscore_delete_recipient (oscore_ctx_t *osc_ctx, coap_bin_const_t *rid)
 
uint8_t oscore_bytes_equal (uint8_t *a_ptr, uint8_t a_len, uint8_t *b_ptr, uint8_t b_len)
 
void oscore_convert_to_hex (const uint8_t *src, size_t src_len, char *dest, size_t dst_len)
 
void oscore_log_hex_value (coap_log_t level, const char *name, coap_bin_const_t *value)
 
void oscore_log_int_value (coap_log_t level, const char *name, int value)
 
void oscore_log_char_value (coap_log_t level, const char *name, const char *value)
 
oscore_ctx_toscore_find_context (const coap_context_t *c_context, const coap_bin_const_t rcpkey_id, const coap_bin_const_t *ctxkey_id, uint8_t *oscore_r2, oscore_recipient_ctx_t **recipient_ctx)
 oscore_find_context - Locate recipient context (and hence OSCORE context) More...
 
void oscore_free_association (oscore_association_t *association)
 
int oscore_new_association (coap_session_t *session, coap_pdu_t *sent_pdu, coap_bin_const_t *token, oscore_recipient_ctx_t *recipient_ctx, coap_bin_const_t *aad, coap_bin_const_t *nonce, coap_bin_const_t *partial_iv, int is_observe)
 
oscore_association_toscore_find_association (coap_session_t *session, coap_bin_const_t *token)
 
int oscore_delete_association (coap_session_t *session, oscore_association_t *association)
 
void oscore_delete_server_associations (coap_session_t *session)
 
int oscore_derive_keystream (oscore_ctx_t *osc_ctx, cose_encrypt0_t *code, uint8_t coap_request, coap_bin_const_t *sender_key, coap_bin_const_t *id_context, size_t cs_size, uint8_t *keystream, size_t keystream_size)
 

Detailed Description

An implementation of the Object Security for Constrained RESTful Enviornments (RFC 8613).

Author
Martin Gunnarsson marti.nosp@m.n.gu.nosp@m.nnars.nosp@m.son@.nosp@m.ri.se adapted to libcoap; added group communication Peter van der Stok consu.nosp@m.ltan.nosp@m.cy@va.nosp@m.nder.nosp@m.stok..nosp@m.org on request of Fairhair alliance adapted for libcoap integration Jon Shallow supjp.nosp@m.s-li.nosp@m.bcoap.nosp@m.@jps.nosp@m.hallo.nosp@m.w.co.nosp@m.m

Definition in file oscore_context.h.