diff options
Diffstat (limited to 'drivers/crypto/ccp/ccp-crypto-sha.c')
-rw-r--r-- | drivers/crypto/ccp/ccp-crypto-sha.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c index 96531571f7cf..507b34e0cc19 100644 --- a/drivers/crypto/ccp/ccp-crypto-sha.c +++ b/drivers/crypto/ccp/ccp-crypto-sha.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include "ccp-crypto.h" | 24 | #include "ccp-crypto.h" |
25 | 25 | ||
26 | |||
27 | static int ccp_sha_complete(struct crypto_async_request *async_req, int ret) | 26 | static int ccp_sha_complete(struct crypto_async_request *async_req, int ret) |
28 | { | 27 | { |
29 | struct ahash_request *req = ahash_request_cast(async_req); | 28 | struct ahash_request *req = ahash_request_cast(async_req); |
@@ -37,11 +36,13 @@ static int ccp_sha_complete(struct crypto_async_request *async_req, int ret) | |||
37 | if (rctx->hash_rem) { | 36 | if (rctx->hash_rem) { |
38 | /* Save remaining data to buffer */ | 37 | /* Save remaining data to buffer */ |
39 | unsigned int offset = rctx->nbytes - rctx->hash_rem; | 38 | unsigned int offset = rctx->nbytes - rctx->hash_rem; |
39 | |||
40 | scatterwalk_map_and_copy(rctx->buf, rctx->src, | 40 | scatterwalk_map_and_copy(rctx->buf, rctx->src, |
41 | offset, rctx->hash_rem, 0); | 41 | offset, rctx->hash_rem, 0); |
42 | rctx->buf_count = rctx->hash_rem; | 42 | rctx->buf_count = rctx->hash_rem; |
43 | } else | 43 | } else { |
44 | rctx->buf_count = 0; | 44 | rctx->buf_count = 0; |
45 | } | ||
45 | 46 | ||
46 | /* Update result area if supplied */ | 47 | /* Update result area if supplied */ |
47 | if (req->result) | 48 | if (req->result) |
@@ -227,8 +228,9 @@ static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key, | |||
227 | } | 228 | } |
228 | 229 | ||
229 | key_len = digest_size; | 230 | key_len = digest_size; |
230 | } else | 231 | } else { |
231 | memcpy(ctx->u.sha.key, key, key_len); | 232 | memcpy(ctx->u.sha.key, key, key_len); |
233 | } | ||
232 | 234 | ||
233 | for (i = 0; i < block_size; i++) { | 235 | for (i = 0; i < block_size; i++) { |
234 | ctx->u.sha.ipad[i] = ctx->u.sha.key[i] ^ 0x36; | 236 | ctx->u.sha.ipad[i] = ctx->u.sha.key[i] ^ 0x36; |
@@ -355,7 +357,7 @@ static int ccp_register_hmac_alg(struct list_head *head, | |||
355 | ret = crypto_register_ahash(alg); | 357 | ret = crypto_register_ahash(alg); |
356 | if (ret) { | 358 | if (ret) { |
357 | pr_err("%s ahash algorithm registration error (%d)\n", | 359 | pr_err("%s ahash algorithm registration error (%d)\n", |
358 | base->cra_name, ret); | 360 | base->cra_name, ret); |
359 | kfree(ccp_alg); | 361 | kfree(ccp_alg); |
360 | return ret; | 362 | return ret; |
361 | } | 363 | } |
@@ -410,7 +412,7 @@ static int ccp_register_sha_alg(struct list_head *head, | |||
410 | ret = crypto_register_ahash(alg); | 412 | ret = crypto_register_ahash(alg); |
411 | if (ret) { | 413 | if (ret) { |
412 | pr_err("%s ahash algorithm registration error (%d)\n", | 414 | pr_err("%s ahash algorithm registration error (%d)\n", |
413 | base->cra_name, ret); | 415 | base->cra_name, ret); |
414 | kfree(ccp_alg); | 416 | kfree(ccp_alg); |
415 | return ret; | 417 | return ret; |
416 | } | 418 | } |