libcoap 4.3.5-develop-490e4e0
Loading...
Searching...
No Matches
oscore_cose.c
Go to the documentation of this file.
1/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3/*
4 * Copyright (c) 2018, SICS, RISE AB
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the Institute nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 */
32
47
48#if COAP_OSCORE_SUPPORT
49
50#include "stdio.h"
51
52struct cose_curve_desc {
53 const char *name;
54 cose_curve_t id;
55};
56
57static struct cose_curve_desc curve_mapping[] = {
58 { "P-256", COSE_CURVE_P_256 },
59 { "X25519", COSE_CURVE_X25519 },
60 { "X448", COSE_CURVE_X448 },
61 { "Ed25519", COSE_CURVE_ED25519 },
62 { "Ed448", COSE_CURVE_ED448 },
63 { "secp256k1", COSE_CURVE_SECP256K1 },
64};
65
66const char *
67cose_get_curve_name(cose_curve_t id, char *buffer, size_t buflen) {
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);
71 return buffer;
72 }
73 }
74 snprintf(buffer, buflen, "curve Fix me (%d)", id);
75 return buffer;
76}
77
79cose_get_curve_id(const char *name) {
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;
83 }
84 return 0;
85}
86
87struct cose_alg_desc {
88 const char *name;
89 cose_alg_t id;
90};
91
92static struct cose_alg_desc alg_mapping[] = {
93 { "ES256K", COSE_ALGORITHM_ES256K },
94 { "SHA-512", COSE_ALGORITHM_SHA_512 },
95 { "SHA-384", COSE_ALGORITHM_SHA_384 },
96 { "ES512", COSE_ALGORITHM_ES512 },
97 { "ES384", COSE_ALGORITHM_ES384 },
98 { "ECDH-SS + HKDF-256", COSE_ALGORITHM_ECDH_SS_HKDF_256 },
99 { "SHA-512/256", COSE_ALGORITHM_SHA_512_256 },
100 { "SHA-256", COSE_ALGORITHM_SHA_256_256 },
101 { "SHA-256/64", COSE_ALGORITHM_SHA_256_64 },
102 { "SHA-1", COSE_ALGORITHM_SHA_1 },
103 { "direct+HKDF-SHA-512", COSE_ALGORITHM_HKDF_SHA_512 },
104 { "direct+HKDF-SHA-256", COSE_ALGORITHM_HKDF_SHA_256 },
105 { "EdDSA", COSE_ALGORITHM_EDDSA },
106 { "ES256", COSE_ALGORITHM_ES256 },
107 { "HMAC 256/64", COSE_ALGORITHM_HMAC256_64 },
108 { "HMAC 256/256", COSE_ALGORITHM_HMAC256_256 },
109 { "HMAC 384/384", COSE_ALGORITHM_HMAC384_384 },
110 { "HMAC 512/512", COSE_ALGORITHM_HMAC512_512 },
111 { "AES-CCM-16-64-128", COSE_ALGORITHM_AES_CCM_16_64_128 },
112 { "AES-CCM-16-64-256", COSE_ALGORITHM_AES_CCM_16_64_256 },
113 { "AES-CCM-64-64-128", COSE_ALGORITHM_AES_CCM_64_64_128 },
114 { "AES-CCM-64-64-256", COSE_ALGORITHM_AES_CCM_64_64_256 },
115 { "ChaCha20/Poly1305", COSE_ALGORITHM_CHACHA20_P1035 },
116 { "AES-CCM-16-128-128", COSE_ALGORITHM_AES_CCM_16_128_128 },
117 { "AES-CCM-16-128-256", COSE_ALGORITHM_AES_CCM_16_128_256 },
118 { "AES-CCM-64-128-128", COSE_ALGORITHM_AES_CCM_64_128_128 },
119 { "AES-CCM-64-128-256", COSE_ALGORITHM_AES_CCM_64_128_256 },
120};
121
122const char *
123cose_get_alg_name(cose_alg_t id, char *buffer, size_t buflen) {
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);
127 return buffer;
128 }
129 }
130 snprintf(buffer, buflen, "alg Fix me (%d)", id);
131 return buffer;
132}
133
135cose_get_alg_id(const char *name) {
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;
139 }
140 return 0;
141}
142
143struct cose_hkdf_alg_desc {
144 const char *name;
146};
147
148static struct cose_hkdf_alg_desc hkdf_alg_mapping[] = {
149 { "direct+HKDF-SHA-512", COSE_HKDF_ALG_HKDF_SHA_512 },
150 { "direct+HKDF-SHA-256", COSE_HKDF_ALG_HKDF_SHA_256 },
151};
152
153const char *
154cose_get_hkdf_alg_name(cose_hkdf_alg_t id, char *buffer, size_t buflen) {
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);
158 return buffer;
159 }
160 }
161 snprintf(buffer, buflen, "hkdf_alg Fix me (%d)", id);
162 return buffer;
163}
164
165/*
166 * The struct hmac_algs and the function cose_get_hmac_alg_for_hkdf() are
167 * used to determine which hmac type to use for the appropriate hkdf
168 */
169static struct hkdf_hmac_algs {
170 cose_hkdf_alg_t hkdf_alg;
171 cose_hmac_alg_t hmac_alg;
172} hkdf_hmacs[] = {
175};
176
177/*
178 * return 0 fail
179 * 1 OK
180 */
181int
183 size_t idx;
184
185 for (idx = 0; idx < sizeof(hkdf_hmacs) / sizeof(struct hkdf_hmac_algs);
186 idx++) {
187 if (hkdf_hmacs[idx].hkdf_alg == hkdf_alg) {
188 *hmac_alg = hkdf_hmacs[idx].hmac_alg;
189 return 1;
190 }
191 }
192 coap_log_debug("cose_get_hmac_alg_for_hkdf: COSE HKDF %d not supported\n",
193 hkdf_alg);
194 return 0;
195}
196
197/* return tag length belonging to cose algorithm */
198size_t
199cose_tag_len(cose_alg_t cose_alg) {
200 switch ((int)cose_alg) {
209 default:
210 return 0;
211 }
212}
213
214/* return hash length belonging to cose algorithm */
215size_t
216cose_hash_len(cose_alg_t cose_alg) {
217 switch ((int)cose_alg) {
240 default:
241 return 0;
242 }
243}
244
245/* return nonce length belonging to cose algorithm */
246size_t
247cose_nonce_len(cose_alg_t cose_alg) {
248 switch ((int)cose_alg) {
257 default:
258 return 0;
259 }
260}
261
262/* return key length belonging to cose algorithm */
263size_t
264cose_key_len(cose_alg_t cose_alg) {
265 switch ((int)cose_alg) {
274 default:
275 return 0;
276 }
277}
278
279/* Return length */
280size_t
281cose_encrypt0_encode(cose_encrypt0_t *ptr, uint8_t *buffer, size_t buf_len) {
282 size_t ret = 0;
283 size_t rem_size = buf_len;
284
285 ret += oscore_cbor_put_array(&buffer, &rem_size, 3);
286 ret += oscore_cbor_put_bytes(&buffer, &rem_size, NULL, 0);
287 /* ret += cose encode attributyes */
288 ret += oscore_cbor_put_bytes(&buffer,
289 &rem_size,
290 ptr->ciphertext.s,
291 ptr->ciphertext.length);
292 return ret;
293}
294
295/*Return status */
296int cose_encrypt0_decode(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size);
297
298/* Initiate a new COSE Encrypt0 object. */
299void
301 memset(ptr, 0, sizeof(cose_encrypt0_t));
302}
303
304void
305cose_encrypt0_set_alg(cose_encrypt0_t *ptr, uint8_t alg) {
306 ptr->alg = alg;
307}
308
309void
311 uint8_t *buffer,
312 size_t size) {
313 ptr->ciphertext.s = buffer;
314 ptr->ciphertext.length = size;
315}
316
317void
319 uint8_t *buffer,
320 size_t size) {
321 ptr->plaintext.s = buffer;
322 ptr->plaintext.length = size;
323}
324/* Return length */
325int cose_encrypt0_get_plaintext(cose_encrypt0_t *ptr, uint8_t **buffer);
326
327void
329 coap_bin_const_t *partial_iv) {
330 if (partial_iv == NULL || partial_iv->length == 0) {
331 ptr->partial_iv.s = NULL;
332 ptr->partial_iv.length = 0;
333 } else {
334 if (partial_iv->length > (int)sizeof(ptr->partial_iv_data))
335 partial_iv->length = sizeof(ptr->partial_iv_data);
336 memcpy(ptr->partial_iv_data, partial_iv->s, partial_iv->length);
337 ptr->partial_iv.s = ptr->partial_iv_data;
338 ptr->partial_iv.length = partial_iv->length;
339 }
340}
341
342/* Return length */
345 return ptr->partial_iv;
346}
347
348void
350 if (key_id) {
351 ptr->key_id = *key_id;
352 } else {
353 ptr->key_id.length = 0;
354 ptr->key_id.s = NULL;
355 }
356}
357/* Return length */
358size_t
359cose_encrypt0_get_key_id(cose_encrypt0_t *ptr, const uint8_t **buffer) {
360 *buffer = ptr->key_id.s;
361 return ptr->key_id.length;
362}
363
364size_t
365cose_encrypt0_get_kid_context(cose_encrypt0_t *ptr, const uint8_t **buffer) {
366 *buffer = ptr->kid_context.s;
367 return ptr->kid_context.length;
368}
369
370void
372 coap_bin_const_t *kid_context) {
373 if (kid_context) {
374 ptr->kid_context = *kid_context;
375 } else {
376 ptr->kid_context.length = 0;
377 ptr->kid_context.s = NULL;
378 }
379}
380
381void
383 coap_bin_const_t *external_aad) {
384 if (external_aad) {
385 ptr->external_aad = *external_aad;
386 } else {
387 ptr->external_aad.length = 0;
388 ptr->external_aad.s = NULL;
389 }
390}
391
392void
394 if (aad) {
395 ptr->aad = *aad;
396 } else {
397 ptr->aad.length = 0;
398 ptr->aad.s = NULL;
399 }
400}
401
402/* Returns 1 if successfull, 0 if key is of incorrect length. */
403int
405 if (key == NULL || key->length != 16) {
406 return 0;
407 }
408
409 ptr->key = *key;
410 return 1;
411}
412
413void
415 if (nonce) {
416 ptr->nonce = *nonce;
417 } else {
418 ptr->nonce.length = 0;
419 ptr->nonce.s = NULL;
420 }
421}
422
423int
425 uint8_t *ciphertext_buffer,
426 size_t ciphertext_len) {
427 coap_crypto_param_t params;
428 size_t tag_len = cose_tag_len(ptr->alg);
429 size_t max_result_len = ptr->plaintext.length + tag_len;
430
431 if (ptr->key.s == NULL || ptr->key.length != (size_t)cose_key_len(ptr->alg)) {
432 return -1;
433 }
434 if (ptr->nonce.s == NULL ||
435 ptr->nonce.length != (size_t)cose_nonce_len(ptr->alg)) {
436 return -2;
437 }
438 if (ptr->aad.s == NULL || ptr->aad.length == 0) {
439 return -3;
440 }
441 if (ptr->plaintext.s == NULL ||
442 (ptr->plaintext.length + tag_len) > ciphertext_len) {
443 return -4;
444 }
445
446 memset(&params, 0, sizeof(params));
447 params.alg = ptr->alg;
448 params.params.aes.key = ptr->key;
449 params.params.aes.nonce = ptr->nonce.s;
450 params.params.aes.tag_len = tag_len;
451 params.params.aes.l = 15 - ptr->nonce.length;
452 if (!coap_crypto_aead_encrypt(&params,
453 &ptr->plaintext,
454 &ptr->aad,
455 ciphertext_buffer,
456 &max_result_len)) {
457 return -5;
458 }
459 return (int)max_result_len;
460}
461
462int
464 uint8_t *plaintext_buffer,
465 size_t plaintext_len) {
466 int ret_len = 0;
467 coap_crypto_param_t params;
468 size_t tag_len = cose_tag_len(ptr->alg);
469 size_t max_result_len = ptr->ciphertext.length - tag_len;
470
471 if (ptr->key.s == NULL || ptr->key.length != (size_t)cose_key_len(ptr->alg)) {
472 return -1;
473 }
474 if (ptr->nonce.s == NULL ||
475 ptr->nonce.length != (size_t)cose_nonce_len(ptr->alg)) {
476 return -2;
477 }
478 if (ptr->aad.s == NULL || ptr->aad.length == 0) {
479 return -3;
480 }
481 if (ptr->ciphertext.s == NULL ||
482 ptr->ciphertext.length > (plaintext_len + tag_len)) {
483 return -4;
484 }
485
486 memset(&params, 0, sizeof(params));
487 params.alg = ptr->alg;
488 params.params.aes.key = ptr->key;
489 params.params.aes.nonce = ptr->nonce.s;
490 params.params.aes.tag_len = tag_len;
491 params.params.aes.l = 15 - ptr->nonce.length;
492 if (!coap_crypto_aead_decrypt(&params,
493 &ptr->ciphertext,
494 &ptr->aad,
495 plaintext_buffer,
496 &max_result_len)) {
497 return -5;
498 }
499 ret_len = (int)max_result_len;
500 return ret_len;
501}
502
503#else /* ! COAP_OSCORE_SUPPORT */
504
505#ifdef __clang__
506/* Make compilers happy that do not like empty modules. As this function is
507 * never used, we ignore -Wunused-function at the end of compiling this file
508 */
509#pragma GCC diagnostic ignored "-Wunused-function"
510#endif
511static inline void
512dummy(void) {
513}
514
515#endif /* ! COAP_OSCORE_SUPPORT */
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(...)
Definition coap_debug.h:126
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
Definition oscore_cose.h:98
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
Definition oscore_cose.h:99
cose_alg_t cose_get_alg_id(const char *name)
#define COSE_ALGORITHM_AES_CCM_64_128_128_TAG_LEN
Definition oscore_cose.h:95
#define COSE_ALGORITHM_AES_CCM_16_64_128_KEY_LEN
Definition oscore_cose.h:89
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
Definition oscore_cose.h:97
size_t cose_key_len(cose_alg_t cose_alg)
#define COSE_ALGORITHM_AES_CCM_16_64_128_NONCE_LEN
Definition oscore_cose.h:90
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)
cose_hkdf_alg_t
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
Definition oscore_cose.h:87
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
Definition oscore_cose.h:85
void cose_encrypt0_set_aad(cose_encrypt0_t *ptr, coap_bin_const_t *aad)
cose_hmac_alg_t
#define COSE_ALGORITHM_AES_CCM_64_64_128_NONCE_LEN
Definition oscore_cose.h:86
int cose_encrypt0_decode(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size)
cose_curve_t
Definition oscore_cose.h:64
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
Definition oscore_cose.h:91
cose_alg_t
#define COSE_ALGORITHM_AES_CCM_64_128_128_KEY_LEN
Definition oscore_cose.h:93
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
Definition oscore_cose.h:94
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_CURVE_X25519
Definition oscore_cose.h:66
@ COSE_CURVE_ED448
Definition oscore_cose.h:69
@ COSE_CURVE_P_256
Definition oscore_cose.h:65
@ COSE_CURVE_SECP256K1
Definition oscore_cose.h:70
@ COSE_CURVE_ED25519
Definition oscore_cose.h:68
@ COSE_CURVE_X448
Definition oscore_cose.h:67
@ 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_ES384
@ 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_SHA_1
@ COSE_ALGORITHM_EDDSA
@ COSE_ALGORITHM_HMAC256_64
@ COSE_ALGORITHM_ES256
@ COSE_ALGORITHM_AES_CCM_64_64_256
@ COSE_ALGORITHM_HKDF_SHA_256
@ COSE_ALGORITHM_AES_CCM_16_64_128
@ COSE_ALGORITHM_ES512
@ COSE_ALGORITHM_HMAC384_384
@ COSE_ALGORITHM_SHA_512
@ COSE_ALGORITHM_AES_CCM_64_128_128
@ COSE_ALGORITHM_AES_CCM_16_64_256
@ COSE_ALGORITHM_ES256K
@ COSE_ALGORITHM_SHA_384
static void dummy(void)
CoAP binary data definition with const data.
Definition coap_str.h:67
size_t length
length of binary data
Definition coap_str.h:68
const uint8_t * s
read-only binary data
Definition coap_str.h:69
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 aad
coap_bin_const_t key
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 nonce
coap_bin_const_t external_aad
coap_bin_const_t key_id
uint8_t partial_iv_data[8]
cose_alg_t alg