From patchwork Wed Jan 27 17:13:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 8135981 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 20D2D9F818 for ; Wed, 27 Jan 2016 17:17:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D47E20328 for ; Wed, 27 Jan 2016 17:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 296702026D for ; Wed, 27 Jan 2016 17:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932803AbcA0RRu (ORCPT ); Wed, 27 Jan 2016 12:17:50 -0500 Received: from mga03.intel.com ([134.134.136.65]:35775 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbcA0RRt (ORCPT ); Wed, 27 Jan 2016 12:17:49 -0500 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 27 Jan 2016 09:17:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,355,1449561600"; d="scan'208";a="37177101" Received: from tstruk-mobl1.jf.intel.com (HELO [127.0.1.1]) ([134.134.171.59]) by fmsmga004.fm.intel.com with ESMTP; 27 Jan 2016 09:17:49 -0800 Subject: [PATCH 1/3] 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: Wed, 27 Jan 2016 09:13:56 -0800 Message-ID: <20160127171355.32579.12218.stgit@tstruk-mobl1> In-Reply-To: <20160127171350.32579.49931.stgit@tstruk-mobl1> References: <20160127171350.32579.49931.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 | 11 ++++++++++- 1 file changed, 10 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..a9d54c0 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -142,6 +142,15 @@ static int skcipher_setkey_ablkcipher(struct crypto_skcipher *tfm, return err; } +static void skcipher_complete(struct crypto_async_request *req_base, int err) +{ + void *subreq = ablkcipher_request_cast(req_base); + struct skcipher_request *req = + container_of(subreq, struct skcipher_request, __ctx); + + req->base.complete(&req->base, err); +} + static int skcipher_crypt_ablkcipher(struct skcipher_request *req, int (*crypt)(struct ablkcipher_request *)) { @@ -151,7 +160,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->base.data); ablkcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen, req->iv);