Skip to content

Commit

Permalink
crypto: morus640 - Fix out-of-bounds access
Browse files Browse the repository at this point in the history
We must load the block from the temporary variable here, not directly
from the input.

Also add forgotten zeroing-out of the uninitialized part of the
temporary block (as is done correctly in morus1280.c).

Fixes: 396be41 ("crypto: morus - Add generic MORUS AEAD implementations")
Reported-by: [email protected]
Reported-by: [email protected]
Signed-off-by: Ondrej Mosnacek <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
WOnder93 authored and herbertx committed Jun 15, 2018
1 parent f044a84 commit a81ae80
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/morus640.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ static void crypto_morus640_decrypt_chunk(struct morus640_state *state, u8 *dst,
union morus640_block_in tail;

memcpy(tail.bytes, src, size);
memset(tail.bytes + size, 0, MORUS640_BLOCK_SIZE - size);

crypto_morus640_load_a(&m, src);
crypto_morus640_load_a(&m, tail.bytes);
crypto_morus640_core(state, &m);
crypto_morus640_store_a(tail.bytes, &m);
memset(tail.bytes + size, 0, MORUS640_BLOCK_SIZE - size);
Expand Down

0 comments on commit a81ae80

Please sign in to comment.