提交 e9b25f16 编写于 作者: H Herbert Xu

crypto: padlock - Fix hashing of partial blocks

When we encounter partial blocks in finup, we'll invoke the xsha
instruction with a bogus count that is not a multiple of the block
size.  This patch fixes it.
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 cbc86b91
...@@ -94,6 +94,7 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in, ...@@ -94,6 +94,7 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,
memcpy(state.buffer + leftover, in, count); memcpy(state.buffer + leftover, in, count);
in = state.buffer; in = state.buffer;
count += leftover; count += leftover;
state.count &= ~(SHA1_BLOCK_SIZE - 1);
} }
} }
...@@ -157,6 +158,7 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in, ...@@ -157,6 +158,7 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,
memcpy(state.buf + leftover, in, count); memcpy(state.buf + leftover, in, count);
in = state.buf; in = state.buf;
count += leftover; count += leftover;
state.count &= ~(SHA1_BLOCK_SIZE - 1);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册