Browse Source

crypto: fix cppcheck warnings

master
Martine Lenders 6 years ago committed by Oleg Hahm
parent
commit
62ca7f9242
  1. 2
      sys/crypto/chacha.c
  2. 4
      sys/crypto/modes/cbc.c

2
sys/crypto/chacha.c

@ -53,6 +53,8 @@ static void _doubleround(void *output_, const uint32_t input[16], uint8_t rounds
rounds *= 4;
for (unsigned i = 0; i < rounds; ++i) {
/* cppcheck-suppress duplicateExpressionTernary
* (reason: Externally imported code beautification) */
uint32_t *a = &output[((i + ((i & 4) ? 0 : 0)) & 3) + (4 * 0)];
uint32_t *b = &output[((i + ((i & 4) ? 1 : 0)) & 3) + (4 * 1)];
uint32_t *c = &output[((i + ((i & 4) ? 2 : 0)) & 3) + (4 * 2)];

4
sys/crypto/modes/cbc.c

@ -58,7 +58,7 @@ int cipher_decrypt_cbc(cipher_t* cipher, uint8_t iv[16],
uint8_t* input, size_t length, uint8_t* output)
{
size_t offset = 0;
uint8_t* input_block, *output_block, *input_block_last, block_size;
uint8_t* input_block, *input_block_last, block_size;
block_size = cipher_get_block_size(cipher);
@ -69,7 +69,7 @@ int cipher_decrypt_cbc(cipher_t* cipher, uint8_t iv[16],
input_block_last = iv;
do {
input_block = input + offset;
output_block = output + offset;
uint8_t *output_block = output + offset;
if (cipher_decrypt(cipher, input_block, output_block) != 1) {
return CIPHER_ERR_DEC_FAILED;

Loading…
Cancel
Save