diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-07-15 22:33:27 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-07-15 22:33:27 -0400 |
commit | e9b25f16cda88b33fe15b30c009912e6c471edda (patch) | |
tree | 088b467b09f050bf7d6cc867d0ce8190d9e2ee4b /drivers/crypto/padlock-sha.c | |
parent | cbc86b9161b40f95caee0e56381b68956fc28cc4 (diff) |
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: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/padlock-sha.c')
-rw-r--r-- | drivers/crypto/padlock-sha.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index a936ba49b390..76cb6b345e7b 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -94,6 +94,7 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in, | |||
94 | memcpy(state.buffer + leftover, in, count); | 94 | memcpy(state.buffer + leftover, in, count); |
95 | in = state.buffer; | 95 | in = state.buffer; |
96 | count += leftover; | 96 | count += leftover; |
97 | state.count &= ~(SHA1_BLOCK_SIZE - 1); | ||
97 | } | 98 | } |
98 | } | 99 | } |
99 | 100 | ||
@@ -157,6 +158,7 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in, | |||
157 | memcpy(state.buf + leftover, in, count); | 158 | memcpy(state.buf + leftover, in, count); |
158 | in = state.buf; | 159 | in = state.buf; |
159 | count += leftover; | 160 | count += leftover; |
161 | state.count &= ~(SHA1_BLOCK_SIZE - 1); | ||
160 | } | 162 | } |
161 | } | 163 | } |
162 | 164 | ||