From patchwork Thu Sep 1 13:25:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 75214 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp299241qga; Thu, 1 Sep 2016 06:27:23 -0700 (PDT) X-Received: by 10.98.30.133 with SMTP id e127mr26970197pfe.104.1472736443367; Thu, 01 Sep 2016 06:27:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si5762771pfa.54.2016.09.01.06.27.23; Thu, 01 Sep 2016 06:27:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754126AbcIAN1W (ORCPT + 1 other); Thu, 1 Sep 2016 09:27:22 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:35843 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754953AbcIAN1V (ORCPT ); Thu, 1 Sep 2016 09:27:21 -0400 Received: by mail-wm0-f45.google.com with SMTP id c133so78461736wmd.1 for ; Thu, 01 Sep 2016 06:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Gs4N/8MVGxsuq7v5vnZK/TbRCYn6cApHg0gMzlAxNwo=; b=UAJTJeNWTxP6kTgmg4T3r5idBwZNHFYhCApHetZ2DwQ5Ev2S/3nXaxf6Z5w+RtbUMQ NkJIVdodqfFbQxMUn8k2gMHjID8L/a48FR9rJ0HeBCjQCcRrQ3ciCMCLvf9en98e7jrx 1chy4oxTJHGjO5aSOSb1S/sFytI06C39lESTE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Gs4N/8MVGxsuq7v5vnZK/TbRCYn6cApHg0gMzlAxNwo=; b=NMpylyFr62BWfW8edREg6ceCUhdZJ9qTAPrPkTV1C3b9nswtVcjnAOTRL6Z2wzoNre ZT3n0gv+qf/MQGwZyXLLlx4MIniF8wswnui6+zFDcuylAlYVO1K4C6vjTdI8JR6VQFy6 tPgMr4GX1xP7CPtI9kyd7CYowtPXLl5YXmjRtq94XNE2dXNZpKBC+KdixdJMZ7Yv2nED GplejC1Enk6Ys2/ceGqzh42lNjjzrGVO5puoL5v7YwclJpALKcJjjsUrlXHStAoyxcvN XyaQAQQFYLy1za6Ro1Vp8JdS38GSqq6WcQBv9fKj/z9AuB/yUHRJoYONwNUKUmihy9XR CpdQ== X-Gm-Message-State: AE9vXwOy6+x04vkqFMH5n1xTZAPkBOhySvwxPKdfzB8hwhg1te5YHUv/+NNP+GuSWKX1cU1R X-Received: by 10.194.85.18 with SMTP id d18mr13913433wjz.43.1472736439297; Thu, 01 Sep 2016 06:27:19 -0700 (PDT) Received: from localhost.localdomain ([105.147.72.48]) by smtp.gmail.com with ESMTPSA id e5sm29182678wma.13.2016.09.01.06.27.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Sep 2016 06:27:18 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: Ard Biesheuvel Subject: [PATCH v2 3/3] crypto: cryptd - initialize child shash_desc on import Date: Thu, 1 Sep 2016 14:25:43 +0100 Message-Id: <1472736343-15305-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472736343-15305-1-git-send-email-ard.biesheuvel@linaro.org> References: <1472736343-15305-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org When calling .import() on a cryptd ahash_request, the structure members that describe the child transform in the shash_desc need to be initialized like they are when calling .init() Signed-off-by: Ard Biesheuvel --- crypto/cryptd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.7.4 -- 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/cryptd.c b/crypto/cryptd.c index cf8037a87b2d..510a25f6ee37 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c @@ -631,9 +631,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out) static int cryptd_hash_import(struct ahash_request *req, const void *in) { - struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm); + struct shash_desc *desc = cryptd_shash_desc(req); + + desc->tfm = ctx->child; + desc->flags = req->base.flags; - return crypto_shash_import(&rctx->desc, in); + return crypto_shash_import(desc, in); } static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,