libcoap 4.3.5-develop-ea01661
Loading...
Searching...
No Matches
coap_crypto_internal.h
Go to the documentation of this file.
1/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3/*
4 * coap_crypto_internal.h -- Structures, Enums & Functions that are not
5 * exposed to application programming
6 *
7 * Copyright (C) 2017-2025 Olaf Bergmann <bergmann@tzi.org>
8 * Copyright (C) 2021-2025 Jon Shallow <supjps-libcoap@jpshallow.com>
9 *
10 * SPDX-License-Identifier: BSD-2-Clause
11 *
12 * This file is part of the CoAP library libcoap. Please see README for terms
13 * of use.
14 */
15
21#ifndef COAP_CRYPTO_INTERNAL_H_
22#define COAP_CRYPTO_INTERNAL_H_
23
31#include "oscore/oscore_cose.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#ifndef COAP_CRYPTO_MAX_KEY_SIZE
38#define COAP_CRYPTO_MAX_KEY_SIZE (32)
39#endif /* COAP_CRYPTO_MAX_KEY_SIZE */
40
41#ifndef COAP_OSCORE_DEFAULT_REPLAY_WINDOW
42#define COAP_OSCORE_DEFAULT_REPLAY_WINDOW 32
43#endif /* COAP_OSCORE_DEFAULT_REPLAY_WINDOW */
44
49
59
70
80
90
104 coap_bin_const_t *data,
105 coap_bin_const_t *aad,
106 uint8_t *result,
107 size_t *max_result_len);
108
122 coap_bin_const_t *data,
123 coap_bin_const_t *aad,
124 uint8_t *result,
125 size_t *max_result_len);
126
140 coap_bin_const_t *key,
141 coap_bin_const_t *data,
142 coap_bin_const_t **hmac);
143
156 const coap_bin_const_t *data,
157 coap_bin_const_t **hash);
158
161#ifdef __cplusplus
162}
163#endif
164
165#endif /* COAP_CRYPTO_INTERNAL_H_ */
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.
coap_bin_const_t coap_crypto_key_t
The structure that holds the Crypto Key.
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.
int coap_crypto_hash(cose_alg_t alg, const coap_bin_const_t *data, coap_bin_const_t **hash)
Create a hash of the provided data.
int coap_crypto_check_hkdf_alg(cose_hkdf_alg_t hkdf_alg)
Check whether the defined hkdf algorithm is supported by the underlying crypto library.
int coap_crypto_check_cipher_alg(cose_alg_t alg)
Check whether the defined cipher algorithm is supported by the underlying crypto library.
cose_hkdf_alg_t
cose_hmac_alg_t
cose_alg_t
An implementation of the CBOR Object Signing and Encryption (RFC).
CoAP binary data definition with const data.
Definition coap_str.h:67
The structure that holds the AES Crypto information.
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.
coap_crypto_key_t key
The key to use.
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.