1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/crypto: CCM add const

This commit is contained in:
Fabian Hüßler 2020-10-05 10:49:24 +02:00
parent 83d391f6b1
commit a9295ae531
2 changed files with 11 additions and 11 deletions

View File

@ -34,8 +34,8 @@ static inline int min(int a, int b)
}
}
static int ccm_compute_cbc_mac(cipher_t *cipher, const uint8_t iv[16],
const uint8_t *input, size_t length, uint8_t *mac)
static int ccm_compute_cbc_mac(const cipher_t *cipher, const uint8_t iv[16],
const uint8_t *input, size_t length, uint8_t *mac)
{
uint8_t block_size, mac_enc[16] = { 0 };
uint32_t offset;
@ -70,9 +70,9 @@ static int ccm_compute_cbc_mac(cipher_t *cipher, const uint8_t iv[16],
}
static int ccm_create_mac_iv(cipher_t *cipher, uint8_t auth_data_len, uint8_t M,
uint8_t L, const uint8_t *nonce, uint8_t nonce_len,
size_t plaintext_len, uint8_t X1[16])
static int ccm_create_mac_iv(const cipher_t *cipher, uint8_t auth_data_len, uint8_t M,
uint8_t L, const uint8_t *nonce, uint8_t nonce_len,
size_t plaintext_len, uint8_t X1[16])
{
uint8_t M_, L_;
@ -106,8 +106,8 @@ static int ccm_create_mac_iv(cipher_t *cipher, uint8_t auth_data_len, uint8_t M,
return 0;
}
static int ccm_compute_adata_mac(cipher_t *cipher, const uint8_t *auth_data,
uint32_t auth_data_len, uint8_t X1[16])
static int ccm_compute_adata_mac(const cipher_t *cipher, const uint8_t *auth_data,
uint32_t auth_data_len, uint8_t X1[16])
{
if (auth_data_len > 0) {
int len;
@ -174,7 +174,7 @@ static inline int _fits_in_nbytes(size_t value, uint8_t num_bytes)
}
int cipher_encrypt_ccm(cipher_t *cipher,
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,
@ -240,7 +240,7 @@ int cipher_encrypt_ccm(cipher_t *cipher,
}
int cipher_decrypt_ccm(cipher_t *cipher,
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,

View File

@ -69,7 +69,7 @@ extern "C" {
* can be 0 if input_len=0 (no plaintext)
* @return A negative error code if something went wrong
*/
int cipher_encrypt_ccm(cipher_t *cipher,
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,
@ -99,7 +99,7 @@ int cipher_encrypt_ccm(cipher_t *cipher,
* can be 0 if only auth_data and MAC is present.
* @return A negative error code if something went wrong
*/
int cipher_decrypt_ccm(cipher_t *cipher,
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,