aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorPhil Sutter <phil.sutter@viprinet.com>2011-05-05 09:29:03 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2011-05-11 01:06:19 -0400
commitcc8d35057ce7ae2f88cc65be0f839316c4641332 (patch)
tree4eafc10f578f9ba4814bd4e417542e8f588cdc2a /drivers/crypto
parent6677a776cf3dc4950a790946f88d26dafc4baf7b (diff)
crypto: mv_cesa - fill inner/outer IV fields only in HMAC case
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/mv_cesa.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index de09303675d8..c1925c2a88b0 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -296,6 +296,7 @@ static void mv_crypto_algo_completion(void)
296static void mv_process_hash_current(int first_block) 296static void mv_process_hash_current(int first_block)
297{ 297{
298 struct ahash_request *req = ahash_request_cast(cpg->cur_req); 298 struct ahash_request *req = ahash_request_cast(cpg->cur_req);
299 const struct mv_tfm_hash_ctx *tfm_ctx = crypto_tfm_ctx(req->base.tfm);
299 struct mv_req_hash_ctx *req_ctx = ahash_request_ctx(req); 300 struct mv_req_hash_ctx *req_ctx = ahash_request_ctx(req);
300 struct req_progress *p = &cpg->p; 301 struct req_progress *p = &cpg->p;
301 struct sec_accel_config op = { 0 }; 302 struct sec_accel_config op = { 0 };
@@ -308,6 +309,8 @@ static void mv_process_hash_current(int first_block)
308 break; 309 break;
309 case COP_HMAC_SHA1: 310 case COP_HMAC_SHA1:
310 op.config = CFG_OP_MAC_ONLY | CFG_MACM_HMAC_SHA1; 311 op.config = CFG_OP_MAC_ONLY | CFG_MACM_HMAC_SHA1;
312 memcpy(cpg->sram + SRAM_HMAC_IV_IN,
313 tfm_ctx->ivs, sizeof(tfm_ctx->ivs));
311 break; 314 break;
312 } 315 }
313 316
@@ -510,7 +513,6 @@ static void mv_start_new_hash_req(struct ahash_request *req)
510{ 513{
511 struct req_progress *p = &cpg->p; 514 struct req_progress *p = &cpg->p;
512 struct mv_req_hash_ctx *ctx = ahash_request_ctx(req); 515 struct mv_req_hash_ctx *ctx = ahash_request_ctx(req);
513 const struct mv_tfm_hash_ctx *tfm_ctx = crypto_tfm_ctx(req->base.tfm);
514 int num_sgs, hw_bytes, old_extra_bytes, rc; 516 int num_sgs, hw_bytes, old_extra_bytes, rc;
515 cpg->cur_req = &req->base; 517 cpg->cur_req = &req->base;
516 memset(p, 0, sizeof(struct req_progress)); 518 memset(p, 0, sizeof(struct req_progress));
@@ -523,8 +525,6 @@ static void mv_start_new_hash_req(struct ahash_request *req)
523 p->crypt_len = ctx->extra_bytes; 525 p->crypt_len = ctx->extra_bytes;
524 } 526 }
525 527
526 memcpy(cpg->sram + SRAM_HMAC_IV_IN, tfm_ctx->ivs, sizeof(tfm_ctx->ivs));
527
528 if (unlikely(!ctx->first_hash)) { 528 if (unlikely(!ctx->first_hash)) {
529 writel(ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); 529 writel(ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A);
530 writel(ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); 530 writel(ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B);