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

crypto/modes/ccm: update internal functions to const input buffers

Input buffers are not modified, so can be declared const arguments.
This will allow using `const` inputs for `modes/ccm`.

Also say `iv` const even if not required for the api update, just because it is
the case.
This commit is contained in:
Gaëtan Harter 2018-11-12 18:33:02 +01:00
parent 9427371849
commit 9e6782afb4
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B

View File

@ -34,8 +34,8 @@ static inline int min(int a, int b)
}
}
int ccm_compute_cbc_mac(cipher_t* cipher, uint8_t iv[16],
uint8_t* input, size_t length, uint8_t* mac)
int ccm_compute_cbc_mac(cipher_t* cipher, const uint8_t iv[16],
const uint8_t* input, size_t length, uint8_t* mac)
{
uint8_t offset, block_size, mac_enc[16] = {0};
@ -64,7 +64,7 @@ int ccm_compute_cbc_mac(cipher_t* cipher, uint8_t iv[16],
int ccm_create_mac_iv(cipher_t* cipher, uint8_t auth_data_len, uint8_t M,
uint8_t L, uint8_t* nonce, uint8_t nonce_len,
uint8_t L, const uint8_t* nonce, uint8_t nonce_len,
size_t plaintext_len, uint8_t X1[16])
{
uint8_t M_, L_;
@ -99,7 +99,7 @@ int ccm_create_mac_iv(cipher_t* cipher, uint8_t auth_data_len, uint8_t M,
return 0;
}
int ccm_compute_adata_mac(cipher_t* cipher, uint8_t* auth_data,
int ccm_compute_adata_mac(cipher_t* cipher, const uint8_t* auth_data,
uint32_t auth_data_len, uint8_t X1[16])
{
if (auth_data_len > 0) {