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

crypto/modes/ctr: update api to const input buffers

Input buffers are not modified, so can be declared const arguments.
This will allow using `const` inputs for `modes/ccm`.
This commit is contained in:
Gaëtan Harter 2018-11-12 18:33:02 +01:00
parent d15f287312
commit 9427371849
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B
2 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@
#include "crypto/modes/ctr.h"
int cipher_encrypt_ctr(cipher_t* cipher, uint8_t nonce_counter[16],
uint8_t nonce_len, uint8_t* input, size_t length,
uint8_t nonce_len, const uint8_t* input, size_t length,
uint8_t* output)
{
size_t offset = 0;
@ -50,7 +50,7 @@ int cipher_encrypt_ctr(cipher_t* cipher, uint8_t nonce_counter[16],
}
int cipher_decrypt_ctr(cipher_t* cipher, uint8_t nonce_counter[16],
uint8_t nonce_len, uint8_t* input, size_t length,
uint8_t nonce_len, const uint8_t* input, size_t length,
uint8_t* output)
{
return cipher_encrypt_ctr(cipher, nonce_counter, nonce_len, input,

View File

@ -45,7 +45,7 @@ extern "C" {
* @return A negative error code if something went wrong
*/
int cipher_encrypt_ctr(cipher_t* cipher, uint8_t nonce_counter[16],
uint8_t nonce_len, uint8_t* input, size_t length,
uint8_t nonce_len, const uint8_t* input, size_t length,
uint8_t* output);
@ -69,7 +69,7 @@ int cipher_encrypt_ctr(cipher_t* cipher, uint8_t nonce_counter[16],
* @return A negative error code if something went wrong
*/
int cipher_decrypt_ctr(cipher_t* cipher, uint8_t nonce_counter[16],
uint8_t nonce_len, uint8_t* input, size_t length,
uint8_t nonce_len, const uint8_t* input, size_t length,
uint8_t* output);
#ifdef __cplusplus