diff options
author | Jens Axboe <axboe@kernel.dk> | 2013-07-02 02:31:48 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-07-02 02:31:48 -0400 |
commit | 5f0e5afa0de4522abb3ea7d1369039b94e740ec5 (patch) | |
tree | 6a5be3db9ecfed8ef2150c6146f6d1e0d658ac8b /drivers/crypto/nx/nx-sha512.c | |
parent | d752b2696072ed52fd5afab08b601e2220a3b87e (diff) | |
parent | 9e895ace5d82df8929b16f58e9f515f6d54ab82d (diff) |
Merge tag 'v3.10-rc7' into for-3.11/drivers
Linux 3.10-rc7
Pull this in early to avoid doing it with the bcache merge,
since there are a number of changes to bcache between my old
base (3.10-rc1) and the new pull request.
Diffstat (limited to 'drivers/crypto/nx/nx-sha512.c')
-rw-r--r-- | drivers/crypto/nx/nx-sha512.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c index 3177b8c3d5f1..08eee1122349 100644 --- a/drivers/crypto/nx/nx-sha512.c +++ b/drivers/crypto/nx/nx-sha512.c | |||
@@ -69,7 +69,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
69 | * 1: <= SHA512_BLOCK_SIZE: copy into state, return 0 | 69 | * 1: <= SHA512_BLOCK_SIZE: copy into state, return 0 |
70 | * 2: > SHA512_BLOCK_SIZE: process X blocks, copy in leftover | 70 | * 2: > SHA512_BLOCK_SIZE: process X blocks, copy in leftover |
71 | */ | 71 | */ |
72 | if ((u64)len + sctx->count[0] <= SHA512_BLOCK_SIZE) { | 72 | if ((u64)len + sctx->count[0] < SHA512_BLOCK_SIZE) { |
73 | memcpy(sctx->buf + sctx->count[0], data, len); | 73 | memcpy(sctx->buf + sctx->count[0], data, len); |
74 | sctx->count[0] += len; | 74 | sctx->count[0] += len; |
75 | goto out; | 75 | goto out; |
@@ -110,7 +110,8 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
110 | atomic_inc(&(nx_ctx->stats->sha512_ops)); | 110 | atomic_inc(&(nx_ctx->stats->sha512_ops)); |
111 | 111 | ||
112 | /* copy the leftover back into the state struct */ | 112 | /* copy the leftover back into the state struct */ |
113 | memcpy(sctx->buf, data + len - leftover, leftover); | 113 | if (leftover) |
114 | memcpy(sctx->buf, data + len - leftover, leftover); | ||
114 | sctx->count[0] = leftover; | 115 | sctx->count[0] = leftover; |
115 | 116 | ||
116 | spbc_bits = csbcpb->cpb.sha512.spbc * 8; | 117 | spbc_bits = csbcpb->cpb.sha512.spbc * 8; |
@@ -168,7 +169,7 @@ static int nx_sha512_final(struct shash_desc *desc, u8 *out) | |||
168 | goto out; | 169 | goto out; |
169 | 170 | ||
170 | atomic_inc(&(nx_ctx->stats->sha512_ops)); | 171 | atomic_inc(&(nx_ctx->stats->sha512_ops)); |
171 | atomic64_add(csbcpb->cpb.sha512.message_bit_length_lo, | 172 | atomic64_add(csbcpb->cpb.sha512.message_bit_length_lo / 8, |
172 | &(nx_ctx->stats->sha512_bytes)); | 173 | &(nx_ctx->stats->sha512_bytes)); |
173 | 174 | ||
174 | memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE); | 175 | memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE); |