49#if COAP_OSCORE_SUPPORT 
   85  if (salt == NULL || salt->
s == NULL) {
 
   86    uint8_t zeroes_data[32];
 
   89    memset(zeroes_data, 0, 
sizeof(zeroes_data));
 
   90    zeroes.
s = zeroes_data;
 
   91    zeroes.
length = 
sizeof(zeroes_data);
 
  110  size_t N = (okm_len + 32 - 1) / 32; 
 
  112  uint8_t *out_buffer =
 
  122  memcpy(aggregate_buffer, info, info_len);
 
  123  aggregate_buffer[info_len] = 0x01;
 
  125  data.
s = aggregate_buffer;
 
  126  data.
length = info_len + 1;
 
  129  memcpy(&out_buffer[0], hkdf->
s, hkdf->
length);
 
  133  memcpy(aggregate_buffer, &(out_buffer[0]), 32);
 
  134  for (i = 1; i < N; i++) {
 
  135    memcpy(&(aggregate_buffer[32]), info, info_len);
 
  136    aggregate_buffer[32 + info_len] = (uint8_t)(i + 1);
 
  137    data.
s = aggregate_buffer;
 
  138    data.
length = 32 + info_len + 1;
 
  141    memcpy(&out_buffer[i * 32], hkdf->
s, hkdf->
length);
 
  143    memcpy(aggregate_buffer, &(out_buffer[i * 32]), 32);
 
  145  memcpy(okm, out_buffer, okm_len);
 
  184#pragma GCC diagnostic ignored "-Wunused-function" 
Library specific build wrapper for coap_internal.h.
 
void * coap_malloc_type(coap_memory_tag_t type, size_t size)
Allocates a chunk of size bytes and returns a pointer to the newly allocated memory.
 
void coap_free_type(coap_memory_tag_t type, void *p)
Releases the memory that was allocated by coap_malloc_type().
 
int coap_crypto_hmac(cose_hmac_alg_t hmac_alg, coap_bin_const_t *key, coap_bin_const_t *data, coap_bin_const_t **hmac)
Create a HMAC hash of the provided data.
 
#define coap_log_warn(...)
 
int cose_get_hmac_alg_for_hkdf(cose_hkdf_alg_t hkdf_alg, cose_hmac_alg_t *hmac_alg)
 
int oscore_hkdf_expand(cose_hkdf_alg_t hkdf_alg, coap_bin_const_t *prk, uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len)
Derive the key using HKDF-Expand() function.
 
int oscore_hkdf(cose_hkdf_alg_t hkdf_alg, coap_bin_const_t *salt, coap_bin_const_t *ikm, uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len)
Derive the key using HKDF() function.
 
int oscore_hmac_hash(cose_hmac_alg_t hmac_alg, coap_bin_const_t *key, coap_bin_const_t *data, coap_bin_const_t **hmac)
Derive the hmac hash using HMAC-HASH() function.
 
int oscore_hkdf_extract(cose_hkdf_alg_t hkdf_alg, coap_bin_const_t *salt, coap_bin_const_t *ikm, coap_bin_const_t **hkdf_extract)
Derive the pseudorandom key using HKDF-Extract() function.
 
void coap_delete_bin_const(coap_bin_const_t *s)
Deletes the given const binary data and releases any memory allocated.
 
CoAP binary data definition with const data.
 
size_t length
length of binary data
 
const uint8_t * s
read-only binary data