Navigation Menu

Skip to content

Commit

Permalink
crypto: fix cppcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 authored and OlegHahm committed Apr 14, 2017
1 parent 22fd9c1 commit 62ca7f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sys/crypto/chacha.c
Expand Up @@ -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)];
Expand Down
4 changes: 2 additions & 2 deletions sys/crypto/modes/cbc.c
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 62ca7f9

Please sign in to comment.