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

sys/crypto: CBC and ECB add const

This commit is contained in:
Fabian Hüßler 2020-10-02 14:40:43 +02:00
parent be93529c89
commit 83d391f6b1
4 changed files with 10 additions and 10 deletions

View File

@ -22,7 +22,7 @@
#include <string.h>
#include "crypto/modes/cbc.h"
int cipher_encrypt_cbc(cipher_t *cipher, uint8_t iv[16],
int cipher_encrypt_cbc(const cipher_t *cipher, uint8_t iv[16],
const uint8_t *input, size_t length, uint8_t *output)
{
size_t offset = 0;
@ -54,7 +54,7 @@ int cipher_encrypt_cbc(cipher_t *cipher, uint8_t iv[16],
}
int cipher_decrypt_cbc(cipher_t *cipher, uint8_t iv[16],
int cipher_decrypt_cbc(const cipher_t *cipher, uint8_t iv[16],
const uint8_t *input, size_t length, uint8_t *output)
{
size_t offset = 0;

View File

@ -23,7 +23,7 @@
#include "crypto/modes/ecb.h"
int cipher_encrypt_ecb(cipher_t *cipher, uint8_t *input,
int cipher_encrypt_ecb(const cipher_t *cipher, const uint8_t *input,
size_t length, uint8_t *output)
{
size_t offset;
@ -46,7 +46,7 @@ int cipher_encrypt_ecb(cipher_t *cipher, uint8_t *input,
return offset;
}
int cipher_decrypt_ecb(cipher_t *cipher, uint8_t *input,
int cipher_decrypt_ecb(const cipher_t *cipher, const uint8_t *input,
size_t length, uint8_t *output)
{
size_t offset = 0;

View File

@ -43,7 +43,7 @@ extern "C" {
* @return CIPHER_ERR_ENC_FAILED on internal encryption error
* @return otherwise number of input bytes that aren't consumed
*/
int cipher_encrypt_cbc(cipher_t *cipher, uint8_t iv[16], const uint8_t *input,
int cipher_encrypt_cbc(const cipher_t *cipher, uint8_t iv[16], const uint8_t *input,
size_t input_len, uint8_t *output);
@ -62,7 +62,7 @@ int cipher_encrypt_cbc(cipher_t *cipher, uint8_t iv[16], const uint8_t *input,
* @return CIPHER_ERR_DEC_FAILED on internal decryption error
* @return otherwise number of bytes decrypted
*/
int cipher_decrypt_cbc(cipher_t *cipher, uint8_t iv[16], const uint8_t *input,
int cipher_decrypt_cbc(const cipher_t *cipher, uint8_t iv[16], const uint8_t *input,
size_t input_len, uint8_t *output);
#ifdef __cplusplus

View File

@ -42,8 +42,8 @@ extern "C" {
* @return A negative error code if something went wrong
*
*/
int cipher_encrypt_ecb(cipher_t *cipher, uint8_t *input, size_t length,
uint8_t *output);
int cipher_encrypt_ecb(const cipher_t *cipher, const uint8_t *input,
size_t length, uint8_t *output);
/**
@ -59,8 +59,8 @@ int cipher_encrypt_ecb(cipher_t *cipher, uint8_t *input, size_t length,
* @return Length of decrypted data on a successful decryption
* @return A negative error code if something went wrong
*/
int cipher_decrypt_ecb(cipher_t *cipher, uint8_t *input, size_t length,
uint8_t *output);
int cipher_decrypt_ecb(const cipher_t *cipher, const uint8_t *input,
size_t length, uint8_t *output);
#ifdef __cplusplus
}