Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: herbert@gondor.apana.org.au
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, qat-linux@intel.com
Subject: [PATCH] crypto: qat - Fix for qat_aes_cbc_hmac_sha512
Date: Tue, 13 Jan 2015 12:27:53 -0800	[thread overview]
Message-ID: <20150113202753.32216.26250.stgit@tstruk-mobl1> (raw)

After commit ad511e2 the qat_aes_cbc_hmac_sha512 stopped working:

alg: aead: Test 1 failed on encryption for qat_aes_cbc_hmac_sha512.
00000000: e3 53 77 9c 10 79 ae b8 27 08 94 2d be 77 18 1a
00000010: 94 8a 3a b4 70 5d 3b e5 89 f9 35 14 e5 3f dc 9b
00000020: 45 a2 a9 0b 95 eb 23 0a 81 d8 44 5c 0d 30 90 b8
00000030: 1e c6 de 20 23 66 c3 1f 5f 19 ce f2 f8 10 38 66
00000040: fc e7 1c 47 88 cf c3 34 0c 28 16 4e 17 d1 d0 75

We need to explicitly clean the rest of the context buffer
to make it working again.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
 drivers/crypto/qat/qat_common/qat_algs.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c
index a0d95f3..1c2f259 100644
--- a/drivers/crypto/qat/qat_common/qat_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_algs.c
@@ -186,10 +186,14 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
 
 		memcpy(ipad, buff, digest_size);
 		memcpy(opad, buff, digest_size);
+		memset(ipad + digest_size, 0, block_size - digest_size);
+		memset(opad + digest_size, 0, block_size - digest_size);
 		memzero_explicit(buff, sizeof(buff));
 	} else {
 		memcpy(ipad, auth_key, auth_keylen);
 		memcpy(opad, auth_key, auth_keylen);
+		memset(ipad + auth_keylen, 0, block_size - auth_keylen);
+		memset(opad + auth_keylen, 0, block_size - auth_keylen);
 	}
 
 	for (i = 0; i < block_size; i++) {

             reply	other threads:[~2015-01-13 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 20:27 Tadeusz Struk [this message]
2015-01-13 21:25 ` [PATCH] crypto: qat - Fix for qat_aes_cbc_hmac_sha512 Herbert Xu
2015-01-13 22:21   ` Tadeusz Struk
2015-01-13 22:47     ` Herbert Xu
2015-01-13 22:55       ` Tadeusz Struk
2015-01-13 23:07         ` crypto: qat - Ensure ipad and opad are zeroed Herbert Xu
2015-01-13 23:20           ` Tadeusz Struk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150113202753.32216.26250.stgit@tstruk-mobl1 \
    --to=tadeusz.struk@intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox