The friendly Operating System for the Internet of Things
ccm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef CRYPTO_MODES_CCM_H
21 #define CRYPTO_MODES_CCM_H
22 
23 #include "crypto/ciphers.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
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
34 
54 int cipher_encrypt_ccm(cipher_t* cipher, uint8_t* auth_data,
55  uint32_t auth_data_len, uint8_t mac_length,
56  uint8_t length_encoding, uint8_t* nonce, size_t nonce_len,
57  uint8_t* input, size_t input_len, uint8_t* output);
58 
59 
79 int cipher_decrypt_ccm(cipher_t* cipher, uint8_t* auth_data,
80  uint32_t auth_data_len, uint8_t mac_length,
81  uint8_t length_encoding, uint8_t* nonce, size_t nonce_len,
82  uint8_t* input, size_t input_len, uint8_t* output);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* CRYPTO_MODES_CCM_H */
basic struct for using block ciphers contains the cipher interface and the context ...
Definition: ciphers.h:112
int cipher_encrypt_ccm(cipher_t *cipher, uint8_t *auth_data, uint32_t auth_data_len, uint8_t mac_length, uint8_t length_encoding, uint8_t *nonce, size_t nonce_len, uint8_t *input, size_t input_len, uint8_t *output)
Encrypt and authenticate data of arbitrary length in ccm mode.
int cipher_decrypt_ccm(cipher_t *cipher, uint8_t *auth_data, uint32_t auth_data_len, uint8_t mac_length, uint8_t length_encoding, uint8_t *nonce, size_t nonce_len, uint8_t *input, size_t input_len, uint8_t *output)
Decrypt data of arbitrary length in ccm mode.
Headers for the packet encryption class.