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: 10675079 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C68F1709 for ; Thu, 8 Nov 2018 22:55:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F233B28B86 for ; Thu, 8 Nov 2018 22:55:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E66962E526; Thu, 8 Nov 2018 22:55:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CE6729334 for ; Thu, 8 Nov 2018 22:55:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbeKIIdI (ORCPT ); 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-Google-Smtp-Source: AJdET5eUThl+E73dVeV/vYz6nvR2k0fTA982AAWyBc6nGmHvsV7rJk2kMLXQT6vCWsz4k3RedM+Lyw== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Qian Cai --- crypto/simd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);