From patchwork Wed Jan 3 19:16:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10142869 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 CB75F601A1 for ; Wed, 3 Jan 2018 19:18:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB12726247 for ; Wed, 3 Jan 2018 19:18:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0340290FA; Wed, 3 Jan 2018 19:18:32 +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 6742826247 for ; Wed, 3 Jan 2018 19:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750912AbeACTSa (ORCPT ); Wed, 3 Jan 2018 14:18:30 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:37017 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831AbeACTS2 (ORCPT ); Wed, 3 Jan 2018 14:18:28 -0500 Received: by mail-io0-f195.google.com with SMTP id n14so3146864iob.4 for ; Wed, 03 Jan 2018 11:18:27 -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=EVteCybYh+/mkcHlUTuZO/qS2bbhbLc9Jj0PcZf93lA=; b=Kgrvwdm/T50QtPkwsagvcJ289ukYtiz58pvmjmO4P+2MvnwSZ2IN/Hz2uLs36FdLDL ZHZb3PQBkBPDXHNZZf7IU0EaZLn53s5aEHYAZ6hVPhergmo4+1hl+WGPTyaDSGo5cPv8 X9hJ/lEtFuT31n92qWczlNKrI0Js9zxuG+dmmrQUk6jxg05KXOP07SMRHXpnJcRPBf7l HY/D73/jCu7gLfFxC6yQHU9u86DMQ5vBvK4rjP//LuKyxk+/JYnAZIRFJg+gIbXHQnn5 z5ctqtjEx1Lnyf1OwVxLHiqDQQeJkPYlUdga+fut5qwe5/qrG3O7x+vkH2p7mx/np6tR 1d2Q== 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=EVteCybYh+/mkcHlUTuZO/qS2bbhbLc9Jj0PcZf93lA=; b=hoMfMy/7lXtRlQeOUmpXJxaugB2DQivnIJuV8RSbkuiCiDuB77stfKp9NEeGKsfIVK deKwP8r/XbR2EzwdgkQV5GpqZM3t6nJiaIs1T+tM+2TaHLtrjTMcTPdcdIYQHl1eCQvz ZzQLWzej7uZWzw3jur2CyXAVn4TqDiA0otTSjse+6L+L5Byl9a0snVqDPMMmJ/P77GXE 0IrbCjS66LmX+oLCcSLYgP9wUQB6giJ5DtP7KZk4ObZMFD9FZHy34bJh/z6bIpxTSh5I Otbuf5i3BQl5ZPH56+Bn2eOw+jFjDM1//gE0q+uNpNBOPZV9nLLWytENz1zEtukW2SNT QmsQ== X-Gm-Message-State: AKGB3mK20lJimK+lGn5BaXpUEoyRj60ZzJYkqRTQXZI6RuD5Rmvyhdd0 dTx5YbMhlX0D5JwTnYK7je9STBJ4 X-Google-Smtp-Source: ACJfBouw2ZPWjJsk2bWkERNtU9LlrYm+PX5qWjRJjjxQ4SZeBky4vuNnOTXckn9qHsNFqpjpeJ5XUQ== X-Received: by 10.107.162.205 with SMTP id l196mr2652083ioe.185.1515007107416; Wed, 03 Jan 2018 11:18:27 -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.26 (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 3/9] crypto: mcryptd - pass through absence of ->setkey() Date: Wed, 3 Jan 2018 11:16:24 -0800 Message-Id: <20180103191630.79917-4-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 mcryptd template is used to wrap an unkeyed hash algorithm, don't install a ->setkey() method to the mcryptd instance. This change is necessary for mcryptd 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/mcryptd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c index 2908382861ee..ace346b976b3 100644 --- a/crypto/mcryptd.c +++ b/crypto/mcryptd.c @@ -534,7 +534,8 @@ static int mcryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, inst->alg.finup = mcryptd_hash_finup_enqueue; inst->alg.export = mcryptd_hash_export; inst->alg.import = mcryptd_hash_import; - inst->alg.setkey = mcryptd_hash_setkey; + if (crypto_hash_alg_has_setkey(halg)) + inst->alg.setkey = mcryptd_hash_setkey; inst->alg.digest = mcryptd_hash_digest_enqueue; err = ahash_register_instance(tmpl, inst);