Skip to content
Snippets Groups Projects
Unverified Commit 9e6782af authored by Gaëtan Harter's avatar Gaëtan Harter
Browse files

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.
parent 94273718
Branches
No related tags found
No related merge requests found
...@@ -34,8 +34,8 @@ static inline int min(int a, int b) ...@@ -34,8 +34,8 @@ static inline int min(int a, int b)
} }
} }
int ccm_compute_cbc_mac(cipher_t* cipher, uint8_t iv[16], int ccm_compute_cbc_mac(cipher_t* cipher, const uint8_t iv[16],
uint8_t* input, size_t length, uint8_t* mac) const uint8_t* input, size_t length, uint8_t* mac)
{ {
uint8_t offset, block_size, mac_enc[16] = {0}; 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], ...@@ -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, 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]) size_t plaintext_len, uint8_t X1[16])
{ {
uint8_t M_, L_; uint8_t M_, L_;
...@@ -99,7 +99,7 @@ int ccm_create_mac_iv(cipher_t* cipher, uint8_t auth_data_len, uint8_t M, ...@@ -99,7 +99,7 @@ int ccm_create_mac_iv(cipher_t* cipher, uint8_t auth_data_len, uint8_t M,
return 0; 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]) uint32_t auth_data_len, uint8_t X1[16])
{ {
if (auth_data_len > 0) { if (auth_data_len > 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment