From patchwork Thu Jan 28 15:24:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 8151521 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A19EABEEE5 for ; Thu, 28 Jan 2016 15:27:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D49032035B for ; Thu, 28 Jan 2016 15:27:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E80BB201F4 for ; Thu, 28 Jan 2016 15:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966171AbcA1P1y (ORCPT ); Thu, 28 Jan 2016 10:27:54 -0500 Received: from mga01.intel.com ([192.55.52.88]:61916 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965255AbcA1P1y (ORCPT ); Thu, 28 Jan 2016 10:27:54 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 28 Jan 2016 07:27:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,358,1449561600"; d="scan'208";a="903094079" Received: from ztgrote-mobl1.amr.corp.intel.com (HELO [127.0.1.1]) ([10.254.62.77]) by fmsmga002.fm.intel.com with ESMTP; 28 Jan 2016 07:27:54 -0800 Subject: [PATCH v2 1/2] crypto: skcipher - return the correct request to the user From: Tadeusz Struk To: herbert@gondor.apana.org.au Cc: linux-crypto@vger.kernel.org, stable@vger.kernel.org, tadeusz.struk@intel.com Date: Thu, 28 Jan 2016 07:24:00 -0800 Message-ID: <20160128152359.5394.37085.stgit@tstruk-mobl1> In-Reply-To: <20160128152354.5394.90834.stgit@tstruk-mobl1> References: <20160128152354.5394.90834.stgit@tstruk-mobl1> User-Agent: StGit/0.17.1-dirty 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, 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 A user of the skcipher api may have some private context associated with a request, like for instance the algif_skcipher does, so the api needs to return the original skcipher_request in the callback instead of the ablkcipher_request subtype. Cc: # 4.4.x- Signed-off-by: Tadeusz Struk --- crypto/skcipher.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 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/crypto/skcipher.c b/crypto/skcipher.c index 69230e9..22a9c2a 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -142,6 +142,13 @@ static int skcipher_setkey_ablkcipher(struct crypto_skcipher *tfm, return err; } +static void skcipher_complete(struct crypto_async_request *req_base, int err) +{ + struct skcipher_request *req = req_base->data; + + req->base.complete(&req->base, err); +} + static int skcipher_crypt_ablkcipher(struct skcipher_request *req, int (*crypt)(struct ablkcipher_request *)) { @@ -151,7 +158,7 @@ static int skcipher_crypt_ablkcipher(struct skcipher_request *req, ablkcipher_request_set_tfm(subreq, *ctx); ablkcipher_request_set_callback(subreq, skcipher_request_flags(req), - req->base.complete, req->base.data); + skcipher_complete, req); ablkcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen, req->iv);