From patchwork Tue Jan 13 20:27:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 5624041 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0EB2F9F358 for ; Tue, 13 Jan 2015 20:31:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3081B203EB for ; Tue, 13 Jan 2015 20:31:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 309B7203E6 for ; Tue, 13 Jan 2015 20:31:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbbAMUba (ORCPT ); Tue, 13 Jan 2015 15:31:30 -0500 Received: from mga03.intel.com ([134.134.136.65]:60104 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751965AbbAMUb3 (ORCPT ); Tue, 13 Jan 2015 15:31:29 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 13 Jan 2015 12:27:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="511746258" Received: from tstruk-mobl1.intel.com (HELO [127.0.1.1]) ([134.134.171.153]) by orsmga003.jf.intel.com with ESMTP; 13 Jan 2015 12:25:04 -0800 Subject: [PATCH] crypto: qat - Fix for qat_aes_cbc_hmac_sha512 To: herbert@gondor.apana.org.au From: Tadeusz Struk Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, qat-linux@intel.com Date: Tue, 13 Jan 2015 12:27:53 -0800 Message-ID: <20150113202753.32216.26250.stgit@tstruk-mobl1> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/crypto/qat/qat_common/qat_algs.c | 4 ++++ 1 file changed, 4 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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++) {