diff --git a/sys/crypto/modes/cbc.c b/sys/crypto/modes/cbc.c index b5ffdeb845525aca5d334004bf7a1d9407c347fa..21e193569d0d4a7580e713b2f80cfc9a1a0aaaa4 100644 --- a/sys/crypto/modes/cbc.c +++ b/sys/crypto/modes/cbc.c @@ -23,7 +23,7 @@ #include "crypto/modes/cbc.h" int cipher_encrypt_cbc(cipher_t* cipher, uint8_t iv[16], - uint8_t* input, size_t length, uint8_t* output) + const uint8_t* input, size_t length, uint8_t* output) { size_t offset = 0; uint8_t block_size, input_block[CIPHER_MAX_BLOCK_SIZE] = {0}, @@ -55,10 +55,11 @@ int cipher_encrypt_cbc(cipher_t* cipher, uint8_t iv[16], int cipher_decrypt_cbc(cipher_t* cipher, uint8_t iv[16], - uint8_t* input, size_t length, uint8_t* output) + const uint8_t* input, size_t length, uint8_t* output) { size_t offset = 0; - uint8_t* input_block, *input_block_last, block_size; + const uint8_t *input_block, *input_block_last; + uint8_t block_size; block_size = cipher_get_block_size(cipher); diff --git a/sys/include/crypto/modes/cbc.h b/sys/include/crypto/modes/cbc.h index 022bfa20f14c70a6df32994840d7f9973094223c..c09a60ff379770f104101ebf6ca04f6d8fdb5c00 100644 --- a/sys/include/crypto/modes/cbc.h +++ b/sys/include/crypto/modes/cbc.h @@ -37,7 +37,7 @@ extern "C" { * @param output pointer to allocated memory for encrypted data. It has to * be of size data_len + BLOCK_SIZE - data_len % BLOCK_SIZE. */ -int cipher_encrypt_cbc(cipher_t* cipher, uint8_t iv[16], uint8_t* input, +int cipher_encrypt_cbc(cipher_t* cipher, uint8_t iv[16], const uint8_t* input, size_t input_len, uint8_t* output); @@ -51,7 +51,7 @@ int cipher_encrypt_cbc(cipher_t* cipher, uint8_t iv[16], uint8_t* input, * @param output pointer to allocated memory for plaintext data. It has to * be of size input_len. */ -int cipher_decrypt_cbc(cipher_t* cipher, uint8_t iv[16], uint8_t* input, +int cipher_decrypt_cbc(cipher_t* cipher, uint8_t iv[16], const uint8_t* input, size_t input_len, uint8_t* output); #ifdef __cplusplus