From patchwork Wed Jan 3 19:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10142867 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.web.codeaurora.org (Postfix) with ESMTP id 66313601A1 for ; Wed, 3 Jan 2018 19:18:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56EBC26247 for ; Wed, 3 Jan 2018 19:18:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BA9129266; Wed, 3 Jan 2018 19:18:31 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 EBBEB26247 for ; Wed, 3 Jan 2018 19:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750996AbeACTS3 (ORCPT ); Wed, 3 Jan 2018 14:18:29 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:37016 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbeACTS1 (ORCPT ); Wed, 3 Jan 2018 14:18:27 -0500 Received: by mail-io0-f195.google.com with SMTP id n14so3146825iob.4 for ; Wed, 03 Jan 2018 11:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GRoUgREYqAvhtDmytE7CNUuYI4Jc555oXITfuAhaJDc=; b=srLj6o+J3e3zsrFnNs6WU+Vnl6rT8X6fiGFC/2vkD38DUTkgRXdo7kCH36ny3n/tOH Y+/Q/TrzmY8OSJBLNtrfx+iTvOhCY9QYqnnfix4GSbTaak9CsdE3yNKuqENWybghbMt6 2Zch1kAABbj2PFto++XEwJEACJWLuoi5Mk5SZePawJ4F/X80NJ3KlgXZrzpWGF+vrq3B BenxrdNwKiO6ectvbIypfF3tx3qMURx9GQpxMpE1Yx8tduGPjaC6a6zDhhlilFzoRNEd m6UY+f057jsgMe3QFyxe44gPjwNyaRIHJzxKE3w57KdhV3AEM+/nMZ3jfgD+nBd8yUkH go8Q== 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:in-reply-to :references; bh=GRoUgREYqAvhtDmytE7CNUuYI4Jc555oXITfuAhaJDc=; b=fljjNKWWbajVDZpOXPc3zFNbLog5/1NY4x3FsnY6xRlgBOYvpOKwKIizcimNvTtZqD pV4y1qII90xhx9fnmDOfIha5shEOqrV3mZ0PadKjotxSzRyoCf2JU09DqPUqWRc5yhG/ T7tiM0Zy/QiTBbJygvzTKwmWmOkI2HMoLqDe6bTl9agyTkVCI0/Muwx+0v9fLOBwRKpS 3yJWApvW3hJ6dVbcHZ9utWFHkwjQuf+HuUHZ8MbYL/7c4VAIrkjdGyUZ4hnxyVMVonfy sZc9IowbmGEM5TqxOBBJDmVQ0/fU3t8LMqg0MFWc2omi8CKQhTSOGRrZisLGqx9qMxDA 7NOg== X-Gm-Message-State: AKGB3mJr/dgPVN+PtctUP/Wp9YDZXJL+8rb3Nqtsg+PoZYwgUAIUBgR8 iOTmQ61gqr19muylmaOyf05dIAEG X-Google-Smtp-Source: ACJfBoueeZtrFa0cRUqfI51Y16yBLpYjb+9u/Ubpv8LQyfXdT5ta9Sz2FbqiakScytTD6P9KHw72tQ== X-Received: by 10.107.11.166 with SMTP id 38mr2682179iol.102.1515007106393; Wed, 03 Jan 2018 11:18:26 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id o66sm944386iod.87.2018.01.03.11.18.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jan 2018 11:18:26 -0800 (PST) From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: Herbert Xu , "David S . Miller" , Eric Biggers Subject: [RFC PATCH 2/9] crypto: cryptd - pass through absence of ->setkey() Date: Wed, 3 Jan 2018 11:16:23 -0800 Message-Id: <20180103191630.79917-3-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.1.620.gb9897f4670-goog In-Reply-To: <20180103191630.79917-1-ebiggers3@gmail.com> References: <20180103191630.79917-1-ebiggers3@gmail.com> 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 From: Eric Biggers When the cryptd template is used to wrap an unkeyed hash algorithm, don't install a ->setkey() method to the cryptd instance. This change is necessary for cryptd to keep working with unkeyed hash algorithms once we start enforcing that ->setkey() is called when present. Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers --- crypto/cryptd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 552e3a86e829..457ae3e66a41 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c @@ -914,7 +914,8 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, inst->alg.finup = cryptd_hash_finup_enqueue; inst->alg.export = cryptd_hash_export; inst->alg.import = cryptd_hash_import; - inst->alg.setkey = cryptd_hash_setkey; + if (crypto_shash_alg_has_setkey(salg)) + inst->alg.setkey = cryptd_hash_setkey; inst->alg.digest = cryptd_hash_digest_enqueue; err = ahash_register_instance(tmpl, inst);