From patchwork Thu Nov 8 22:55:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 150597 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1436805ljp; Thu, 8 Nov 2018 14:55:25 -0800 (PST) X-Google-Smtp-Source: AJdET5dGYProwjmzrHZ7QWRusi9/JduQFZBu0JDLZYqkbTla1XRAcj5VtdXvCtdL/eKwBlANgX10 X-Received: by 2002:a17:902:6b87:: with SMTP id p7-v6mr6550575plk.282.1541717724913; Thu, 08 Nov 2018 14:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541717724; cv=none; d=google.com; s=arc-20160816; b=0jGIHTw9VFvOoMOUwV8zP/kJs2eCvqruID1us0k2FCEP9B+phE+mAchNsW9cFGSF1D cp5+hcxpxJAefi4ySggBF5WaxECoFRV5o8WBqJ6FgbTLd8TN96H5lPv6zDiD+VZPJh4g Dw4ECsUP8SxEJWg7m8BqcPFe876vt2jy7p+i9Al21oy719xvpGGuhYf6R22kyKY0Jjg5 FAyK0AWXWsTYLME0HVmDf9KyPMNBIGVUEy1eU3+sr5nIPofNIEssbHNCSKOymanK1X2E 8WHiE9wiOM8iwKagBwL0n43zf2xHVfaLSJ3kQH05dOFzhE6Sps4q/cW7p2PbWaDB0cmZ ZzfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=B0GNnP1iwPIPOseTy5XJmzcrkOkSiybuNVRavulrX4I=; b=KvV59CuEweVZewwxlbH2gwg7FqbrKLhdEM3Ny3f3O2JZP+2zbosOQH3FhMZA7voBE6 fJGrroq6QWvG6JcMsY25WKpo7fWh5nyPtD7WN/er1pknKO5xARGhLZxqvQRqOT+Lw8+/ 6RPFe/weZdlp4rdh5DHaMtvQ3Y8Gc94kSvdUKE+Prgejrh129JrrNxNK6bhIi0gLS7N3 dRBMsCm50Xxo5a2MZR6iwrGL9kpU0QgUxti4MKOWu77AxccKrUItvRTXxRXf16G34DBR fKtfWMzgtA9VahSTFrc7mQP31QKoAagIaN8c5nwY2BuKsz6Xp2pzWO+dMR+oKLLWJfF6 n/zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IYj7M0UJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b137-v6si5569015pfb.144.2018.11.08.14.55.24; Thu, 08 Nov 2018 14:55:24 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=IYj7M0UJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbeKIIdI (ORCPT + 2 others); Fri, 9 Nov 2018 03:33:08 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55118 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbeKIIdI (ORCPT ); Fri, 9 Nov 2018 03:33:08 -0500 Received: by mail-wm1-f68.google.com with SMTP id r63-v6so298399wma.4 for ; Thu, 08 Nov 2018 14:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B0GNnP1iwPIPOseTy5XJmzcrkOkSiybuNVRavulrX4I=; b=IYj7M0UJNsIDReZkuFopGvtr0wOeLTZ46hWFZrhEh5LgOI7Wkvc4JgAfpSnp32Pma3 xzfORxDjRXWSuNNHy8GW4xaWefjeGVWLnXXDSvbrJ16Z32jcFToi+NqKh/WPh+LllhSZ F8smWuUImHGbAhzVmuTuJOmnV+Ka1i4JJdZUA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B0GNnP1iwPIPOseTy5XJmzcrkOkSiybuNVRavulrX4I=; b=BucdbcEdhfO9mGttXBmpIGnR8pwjY+pFcOClJFvKl6e30BiTwYb8F4sMYUF2yadla2 L/d0TAF/nd5mmRKre1TWFZab5oP6X04wQy7uLxvMAIWk7XKg3Mc77C7qD4A1vdUd8FIP zZ/1pFqvbVMfVGSblP8dVj11J2qVhDGiUbITskg81k9gzeh4XDo3Lvn9IluRxPT+v+e/ tFhhOLAHDzj2eesEbuT0D0hUoqHaHrgINfQ8Yygjav1iAaOp6t3hsp9U+hiwhYiyCdGE BySIvbDQLpvOm6jz8BdoRugzBkOilODj5qL74M3raWziD8hlsbY3hYZp4uwci40bsdPS E5tA== X-Gm-Message-State: AGRZ1gJ5eBLChoT7aV3O5zNTHnobeqbvw055I9K8Ok/H6b8A9Dlf2CLs 0V4hFhGCQXZs8QbLQ1ABUA/quxDJZuo= X-Received: by 2002:a1c:c46:: with SMTP id 67-v6mr2716085wmm.6.1541717721463; Thu, 08 Nov 2018 14:55:21 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:744a:cf78:9aaa:a66d]) by smtp.gmail.com with ESMTPSA id v10-v6sm9456871wrq.4.2018.11.08.14.55.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 14:55:20 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, cai@gmx.us, Ard Biesheuvel Subject: [PATCH] crypto/simd: correctly take reqsize of wrapped skcipher into account Date: Thu, 8 Nov 2018 23:55:16 +0100 Message-Id: <20181108225516.9967-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The simd wrapper's skcipher request context structure consists of a single subrequest whose size is taken from the subordinate skcipher. However, in simd_skcipher_init(), the reqsize that is retrieved is not from the subordinate skcipher but from the cryptd request structure, whose size is completely unrelated to the actual wrapped skcipher. Reported-by: Qian Cai Signed-off-by: Ard Biesheuvel --- crypto/simd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 Tested-by: Qian Cai diff --git a/crypto/simd.c b/crypto/simd.c index ea7240be3001..2f3d6e897afc 100644 --- a/crypto/simd.c +++ b/crypto/simd.c @@ -125,7 +125,7 @@ static int simd_skcipher_init(struct crypto_skcipher *tfm) ctx->cryptd_tfm = cryptd_tfm; reqsize = sizeof(struct skcipher_request); - reqsize += crypto_skcipher_reqsize(&cryptd_tfm->base); + reqsize += crypto_skcipher_reqsize(cryptd_skcipher_child(cryptd_tfm)); crypto_skcipher_set_reqsize(tfm, reqsize);