Loading...
Searching...
No Matches
ccm.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "crypto/ciphers.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
29#define CCM_ERR_INVALID_NONCE_LENGTH (-2)
30#define CCM_ERR_INVALID_CBC_MAC (-3)
31#define CCM_ERR_INVALID_DATA_LENGTH (-3)
32#define CCM_ERR_INVALID_LENGTH_ENCODING (-4)
33#define CCM_ERR_INVALID_MAC_LENGTH (-5)
35
39#define CCM_BLOCK_SIZE 16
40
44#define CCM_MAC_MAX_LEN 16
45
68int cipher_encrypt_ccm(const cipher_t *cipher,
69 const uint8_t *auth_data, uint32_t auth_data_len,
70 uint8_t mac_length, uint8_t length_encoding,
71 const uint8_t *nonce, size_t nonce_len,
72 const uint8_t *input, size_t input_len,
73 uint8_t *output);
74
97int cipher_decrypt_ccm(const cipher_t *cipher,
98 const uint8_t *auth_data, uint32_t auth_data_len,
99 uint8_t mac_length, uint8_t length_encoding,
100 const uint8_t *nonce, size_t nonce_len,
101 const uint8_t *input, size_t input_len,
102 uint8_t *output);
103
104#ifdef __cplusplus
105}
106#endif
107
int cipher_decrypt_ccm(const cipher_t *cipher, const uint8_t *auth_data, uint32_t auth_data_len, uint8_t mac_length, uint8_t length_encoding, const uint8_t *nonce, size_t nonce_len, const uint8_t *input, size_t input_len, uint8_t *output)
Decrypt data of arbitrary length in ccm mode.
int cipher_encrypt_ccm(const cipher_t *cipher, const uint8_t *auth_data, uint32_t auth_data_len, uint8_t mac_length, uint8_t length_encoding, const uint8_t *nonce, size_t nonce_len, const uint8_t *input, size_t input_len, uint8_t *output)
Encrypt and authenticate data of arbitrary length in ccm mode.
Headers for the packet encryption class.
basic struct for using block ciphers contains the cipher interface and the context
Definition ciphers.h:115