71 snprintf(buffer, buflen,
"curve Fix me (%d)",
id);
127 snprintf(buffer, buflen,
"alg Fix me (%d)",
id);
158 snprintf(buffer, buflen,
"hkdf_alg Fix me (%d)",
id);
189 coap_log_debug(
"cose_get_hmac_alg_for_hkdf: COSE HKDF %d not supported\n",
197 switch ((
int)cose_alg) {
214 switch ((
int)cose_alg) {
245 switch ((
int)cose_alg) {
262 switch ((
int)cose_alg) {
280 size_t rem_size = buf_len;
327 if (partial_iv == NULL || partial_iv->
length == 0) {
402 if (key == NULL || key->
length != 16) {
422 uint8_t *ciphertext_buffer,
423 size_t ciphertext_len) {
431 if (ptr->
nonce.
s == NULL ||
443 memset(¶ms, 0,
sizeof(params));
456 return (
int)max_result_len;
461 uint8_t *plaintext_buffer,
462 size_t plaintext_len) {
471 if (ptr->
nonce.
s == NULL ||
483 memset(¶ms, 0,
sizeof(params));
496 ret_len = (int)max_result_len;
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)
#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_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 buf_len)
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
int cose_encrypt0_get_plaintext(cose_encrypt0_t *ptr, uint8_t **buffer)
static struct cose_alg_desc alg_mapping[]
static struct hkdf_hmac_algs hkdf_hmacs[]
static struct cose_hkdf_alg_desc hkdf_alg_mapping[]
static struct cose_curve_desc curve_mapping[]
int cose_encrypt0_decode(cose_encrypt0_t *ptr, uint8_t *buffer, size_t size)
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]