48#if COAP_OSCORE_SUPPORT 
   52struct cose_curve_desc {
 
   57static struct cose_curve_desc curve_mapping[] = {
 
   68  for (
size_t i = 0; i < 
sizeof(curve_mapping)/
sizeof(curve_mapping[0]); i++) {
 
   69    if (
id == curve_mapping[i].
id) {
 
   70      snprintf(buffer, buflen, 
"%s (%d)", curve_mapping[i].name, 
id);
 
   74  snprintf(buffer, buflen, 
"curve Fix me (%d)", 
id);
 
   80  for (
size_t i = 0; i < 
sizeof(curve_mapping)/
sizeof(curve_mapping[0]); i++) {
 
   81    if (strcmp(name, curve_mapping[i].name) == 0)
 
   82      return curve_mapping[i].
id;
 
   92static struct cose_alg_desc alg_mapping[] = {
 
  124  for (
size_t i = 0; i < 
sizeof(alg_mapping)/
sizeof(alg_mapping[0]); i++) {
 
  125    if (
id == alg_mapping[i].
id) {
 
  126      snprintf(buffer, buflen, 
"%s (%d)", alg_mapping[i].name, 
id);
 
  130  snprintf(buffer, buflen, 
"alg Fix me (%d)", 
id);
 
  136  for (
size_t i = 0; i < 
sizeof(alg_mapping)/
sizeof(alg_mapping[0]); i++) {
 
  137    if (strcmp(name, alg_mapping[i].name) == 0)
 
  138      return alg_mapping[i].
id;
 
  143struct cose_hkdf_alg_desc {
 
  148static struct cose_hkdf_alg_desc hkdf_alg_mapping[] = {
 
  155  for (
size_t i = 0; i < 
sizeof(hkdf_alg_mapping)/
sizeof(hkdf_alg_mapping[0]); i++) {
 
  156    if (
id == hkdf_alg_mapping[i].
id) {
 
  157      snprintf(buffer, buflen, 
"%s (%d)", hkdf_alg_mapping[i].name, 
id);
 
  161  snprintf(buffer, buflen, 
"hkdf_alg Fix me (%d)", 
id);
 
  169static struct hkdf_hmac_algs {
 
  185  for (idx = 0; idx < 
sizeof(hkdf_hmacs) / 
sizeof(
struct hkdf_hmac_algs);
 
  187    if (hkdf_hmacs[idx].hkdf_alg == hkdf_alg) {
 
  188      *hmac_alg = hkdf_hmacs[idx].hmac_alg;
 
  192  coap_log_debug(
"cose_get_hmac_alg_for_hkdf: COSE HKDF %d not supported\n",
 
  200  switch ((
int)cose_alg) {
 
  217  switch ((
int)cose_alg) {
 
  248  switch ((
int)cose_alg) {
 
  265  switch ((
int)cose_alg) {
 
  283  size_t rem_size = buf_len;
 
  330  if (partial_iv == NULL || partial_iv->
length == 0) {
 
  405  if (key == NULL || key->
length != 16) {
 
  425                      uint8_t *ciphertext_buffer,
 
  426                      size_t ciphertext_len) {
 
  434  if (ptr->
nonce.
s == NULL ||
 
  446  memset(¶ms, 0, 
sizeof(params));
 
  459  return (
int)max_result_len;
 
  464                      uint8_t *plaintext_buffer,
 
  465                      size_t plaintext_len) {
 
  474  if (ptr->
nonce.
s == NULL ||
 
  486  memset(¶ms, 0, 
sizeof(params));
 
  499  ret_len = (int)max_result_len;
 
  509#pragma GCC diagnostic ignored "-Wunused-function" 
Library specific build wrapper for coap_internal.h.
 
int coap_crypto_aead_decrypt(const coap_crypto_param_t *params, coap_bin_const_t *data, coap_bin_const_t *aad, uint8_t *result, size_t *max_result_len)
Decrypt the provided encrypted data into plaintext.
 
int coap_crypto_aead_encrypt(const coap_crypto_param_t *params, coap_bin_const_t *data, coap_bin_const_t *aad, uint8_t *result, size_t *max_result_len)
Encrypt the provided plaintext data.
 
#define coap_log_debug(...)
 
size_t oscore_cbor_put_bytes(uint8_t **buffer, size_t *buf_size, const uint8_t *bytes, size_t bytes_len)
 
size_t oscore_cbor_put_array(uint8_t **buffer, size_t *buf_size, size_t elements)
 
#define COSE_ALGORITHM_ES512_HASH_LEN
 
void cose_encrypt0_set_plaintext(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size)
 
int cose_encrypt0_get_plaintext(cose_encrypt0_t *ptr, uint8_t **buffer)
 
#define COSE_ALGORITHM_HMAC384_384_HASH_LEN
 
const char * cose_get_hkdf_alg_name(cose_hkdf_alg_t id, char *buffer, size_t buflen)
 
#define COSE_ALGORITHM_AES_CCM_16_128_128_NONCE_LEN
 
int cose_encrypt0_set_key(cose_encrypt0_t *ptr, coap_bin_const_t *key)
 
#define COSE_ALGORITHM_SHA_256_64_LEN
 
size_t cose_nonce_len(cose_alg_t cose_alg)
 
#define COSE_ALGORITHM_AES_CCM_16_128_128_TAG_LEN
 
cose_alg_t cose_get_alg_id(const char *name)
 
#define COSE_ALGORITHM_AES_CCM_64_128_128_TAG_LEN
 
#define COSE_ALGORITHM_AES_CCM_16_64_128_KEY_LEN
 
void cose_encrypt0_set_kid_context(cose_encrypt0_t *ptr, coap_bin_const_t *kid_context)
 
cose_curve_t cose_get_curve_id(const char *name)
 
#define COSE_ALGORITHM_HMAC256_64_HASH_LEN
 
#define COSE_ALGORITHM_AES_CCM_16_128_128_KEY_LEN
 
size_t cose_key_len(cose_alg_t cose_alg)
 
#define COSE_ALGORITHM_AES_CCM_16_64_128_NONCE_LEN
 
size_t cose_encrypt0_get_key_id(cose_encrypt0_t *ptr, const uint8_t **buffer)
 
const char * cose_get_alg_name(cose_alg_t id, char *buffer, size_t buflen)
 
#define COSE_ALGORITHM_HMAC512_512_HASH_LEN
 
int cose_get_hmac_alg_for_hkdf(cose_hkdf_alg_t hkdf_alg, cose_hmac_alg_t *hmac_alg)
 
coap_bin_const_t cose_encrypt0_get_partial_iv(cose_encrypt0_t *ptr)
 
size_t cose_encrypt0_get_kid_context(cose_encrypt0_t *ptr, const uint8_t **buffer)
 
void cose_encrypt0_set_ciphertext(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size)
 
size_t cose_hash_len(cose_alg_t cose_alg)
 
int cose_encrypt0_decrypt(cose_encrypt0_t *ptr, uint8_t *plaintext_buffer, size_t plaintext_len)
 
#define COSE_ALGORITHM_AES_CCM_64_64_128_TAG_LEN
 
size_t cose_tag_len(cose_alg_t cose_alg)
 
#define COSE_ALGORITHM_HMAC256_256_HASH_LEN
 
#define COSE_ALGORITHM_SHA_256_256_LEN
 
#define COSE_ALGORITHM_AES_CCM_64_64_128_KEY_LEN
 
void cose_encrypt0_set_aad(cose_encrypt0_t *ptr, coap_bin_const_t *aad)
 
#define COSE_ALGORITHM_AES_CCM_64_64_128_NONCE_LEN
 
int cose_encrypt0_decode(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size)
 
int cose_encrypt0_encrypt(cose_encrypt0_t *ptr, uint8_t *ciphertext_buffer, size_t ciphertext_len)
 
void cose_encrypt0_set_partial_iv(cose_encrypt0_t *ptr, coap_bin_const_t *partial_iv)
 
#define COSE_ALGORITHM_SHA_512_LEN
 
#define COSE_ALGORITHM_AES_CCM_16_64_128_TAG_LEN
 
#define COSE_ALGORITHM_AES_CCM_64_128_128_KEY_LEN
 
const char * cose_get_curve_name(cose_curve_t id, char *buffer, size_t buflen)
 
#define COSE_ALGORITHM_AES_CCM_64_128_128_NONCE_LEN
 
size_t cose_encrypt0_encode(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size)
 
void cose_encrypt0_set_external_aad(cose_encrypt0_t *ptr, coap_bin_const_t *external_aad)
 
#define COSE_ALGORITHM_SHA_512_256_LEN
 
void cose_encrypt0_init(cose_encrypt0_t *ptr)
 
void cose_encrypt0_set_alg(cose_encrypt0_t *ptr, uint8_t alg)
 
void cose_encrypt0_set_key_id(cose_encrypt0_t *ptr, coap_bin_const_t *key_id)
 
void cose_encrypt0_set_nonce(cose_encrypt0_t *ptr, coap_bin_const_t *nonce)
 
#define COSE_ALGORITHM_ES384_HASH_LEN
 
@ COSE_HKDF_ALG_HKDF_SHA_256
 
@ COSE_HKDF_ALG_HKDF_SHA_512
 
@ COSE_HMAC_ALG_HMAC256_256
 
@ COSE_HMAC_ALG_HMAC512_512
 
@ COSE_ALGORITHM_HMAC256_256
 
@ COSE_ALGORITHM_AES_CCM_16_128_256
 
@ COSE_ALGORITHM_ECDH_SS_HKDF_256
 
@ COSE_ALGORITHM_HMAC512_512
 
@ COSE_ALGORITHM_SHA_256_64
 
@ COSE_ALGORITHM_SHA_512_256
 
@ COSE_ALGORITHM_AES_CCM_64_64_128
 
@ COSE_ALGORITHM_CHACHA20_P1035
 
@ COSE_ALGORITHM_HKDF_SHA_512
 
@ COSE_ALGORITHM_AES_CCM_16_128_128
 
@ COSE_ALGORITHM_AES_CCM_64_128_256
 
@ COSE_ALGORITHM_SHA_256_256
 
@ COSE_ALGORITHM_HMAC256_64
 
@ COSE_ALGORITHM_AES_CCM_64_64_256
 
@ COSE_ALGORITHM_HKDF_SHA_256
 
@ COSE_ALGORITHM_AES_CCM_16_64_128
 
@ COSE_ALGORITHM_HMAC384_384
 
@ COSE_ALGORITHM_AES_CCM_64_128_128
 
@ COSE_ALGORITHM_AES_CCM_16_64_256
 
CoAP binary data definition with const data.
 
size_t length
length of binary data
 
const uint8_t * s
read-only binary data
 
size_t l
The number of bytes in the length field.
 
const uint8_t * nonce
must be exactly 15 - l bytes
 
coap_crypto_key_t key
The Key to use.
 
size_t tag_len
The size of the Tag.
 
The common structure that holds the Crypto information.
 
union coap_crypto_param_t::@2 params
 
coap_crypto_aes_ccm_t aes
Used if AES type encryption.
 
cose_alg_t alg
The COSE algorith to use.
 
coap_bin_const_t ciphertext
 
coap_bin_const_t plaintext
 
coap_bin_const_t partial_iv
 
coap_bin_const_t kid_context
 
coap_bin_const_t external_aad
 
uint8_t partial_iv_data[8]