Skip to content

Commit a81ae80

Browse files
WOnder93herbertx
authored andcommitted
crypto: morus640 - Fix out-of-bounds access
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]>
1 parent f044a84 commit a81ae80

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crypto/morus640.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,9 @@ static void crypto_morus640_decrypt_chunk(struct morus640_state *state, u8 *dst,
274274
union morus640_block_in tail;
275275

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

278-
crypto_morus640_load_a(&m, src);
279+
crypto_morus640_load_a(&m, tail.bytes);
279280
crypto_morus640_core(state, &m);
280281
crypto_morus640_store_a(tail.bytes, &m);
281282
memset(tail.bytes + size, 0, MORUS640_BLOCK_SIZE - size);

0 commit comments

Comments
 (0)