From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62025C5DF60 for ; Tue, 5 Nov 2019 17:52:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C69C217F5 for ; Tue, 5 Nov 2019 17:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572976330; bh=p+VFQmkLqCjORwfUsYuCrte2jE7w7TTv8ecEBf5sFgg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=QBj3FxBq4uuQ9Lka82fbGF4mBoy9u3dk6+9SobcfPwRiY4XW2qeNR9BWoYgGmZYmA Qwur0Ue/GC0IfBTqQt6SHXPrechimsOj35c8TKmyskfHXnPJQBeyDlnvWogg8J4CKR /PuYQaUaMaInwPIeNmfnYGAlx6vUjhHmcVbFqK6o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390551AbfKERwJ (ORCPT ); Tue, 5 Nov 2019 12:52:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:38554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390346AbfKERwJ (ORCPT ); Tue, 5 Nov 2019 12:52:09 -0500 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1DB1D20650; Tue, 5 Nov 2019 17:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572976328; bh=p+VFQmkLqCjORwfUsYuCrte2jE7w7TTv8ecEBf5sFgg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=srDrOLLXcIW6gCW3oXZrBlGEV0CAfb6hz8wpyF0zB5fkJqfSCDq2F9LY03JnvrEgx sDKT1bZHpr+8iPIcCDylMkS5Vjsl3QY6li8oE5yiTXO3826kwQscMV2WbszT6NetJc 2zDNDw1mHVRc2B9RyDRzO7q/kW8GqO0b+ok9/poo= Date: Tue, 5 Nov 2019 09:52:06 -0800 From: Eric Biggers To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 28/29] crypto: remove deprecated and unused ablkcipher support Message-ID: <20191105175206.GD757@sol.localdomain> Mail-Followup-To: Ard Biesheuvel , linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" , linux-arm-kernel@lists.infradead.org References: <20191105132826.1838-1-ardb@kernel.org> <20191105132826.1838-29-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191105132826.1838-29-ardb@kernel.org> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Nov 05, 2019 at 02:28:25PM +0100, Ard Biesheuvel wrote: > Now that all users of the deprecated ablkcipher interface have been > moved to the skcipher interface, ablkcipher is no longer used and > can be removed. > > Signed-off-by: Ard Biesheuvel Reviewed-by: Eric Biggers Thanks for doing this! A couple ideas for future cleanups below (which, if done, should go in separate patches rather than in this big one): > @@ -786,9 +683,6 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm) > struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); > struct skcipher_alg *alg = crypto_skcipher_alg(skcipher); > > - if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type) > - return crypto_init_skcipher_ops_ablkcipher(tfm); > - > skcipher->setkey = skcipher_setkey; > skcipher->encrypt = alg->encrypt; > skcipher->decrypt = alg->decrypt; > skcipher->ivsize = alg->ivsize; > skcipher->keysize = alg->max_keysize; Since a crypto_skcipher will now always be paired with a skcipher_alg (rather than an blkcipher or ablkcipher algorithm), we could remove the 'encrypt', 'decrypt', 'ivsize', and 'keysize' fields of crypto_skcipher, and instead always get them from the skcipher_alg. > @@ -182,27 +171,18 @@ static inline u32 skcipher_request_flags(struct skcipher_request *req) > static inline unsigned int crypto_skcipher_alg_min_keysize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_ablkcipher.min_keysize; > - > return alg->min_keysize; > } > > static inline unsigned int crypto_skcipher_alg_max_keysize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_ablkcipher.max_keysize; > - > return alg->max_keysize; > } > > static inline unsigned int crypto_skcipher_alg_walksize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_blocksize; > - > return alg->walksize; > } > > diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h > index 8c5a31e810da..b4655d91661f 100644 > --- a/include/crypto/skcipher.h > +++ b/include/crypto/skcipher.h > @@ -241,9 +241,6 @@ static inline struct skcipher_alg *crypto_skcipher_alg( > > static inline unsigned int crypto_skcipher_alg_ivsize(struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_ablkcipher.ivsize; > - > return alg->ivsize; > } > > @@ -286,9 +283,6 @@ static inline unsigned int crypto_skcipher_blocksize( > static inline unsigned int crypto_skcipher_alg_chunksize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_blocksize; > - > return alg->chunksize; > } Now that these helpers are trivial, they could be removed and we could just dereference the struct skcipher_alg directly. - Eric From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73FDAC5DF62 for ; Tue, 5 Nov 2019 17:52:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4901E21882 for ; Tue, 5 Nov 2019 17:52:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dnZ8/JnY"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="srDrOLLX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4901E21882 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0uoxYv6+f4nkyRcbJ+8qPbIsypCe8ZJIVBephteL7+s=; b=dnZ8/JnYd/Fq8O jQo3Q4TvEUf+ubHuRFqNvFSD4QFU9EHVEIT41hQzHbYHcJ/VQf8nwkbjC5z1pitjh/57tneoc3nsm GDbG6FPC8G/n9IBXj4adTtYsyLqY4DAUwdqqqUVJ8kublC2RVk86v2ahaOJ53D5uzmu0j3E5NqIv6 QHfEadlrDp5tICqUGE+mGwYCChcmtPBsAuEzH9F1tv2y1wG/WVhziTIZroaFdppA/KrzDV9lErCvK 1kWW2F60xOpFR3ZLIwgJX/1/1nD2SxY+by6zZ70odd6tNwJokKgxKG2idXbeHmjSVYN3xZ8kRmAbi QLLRFIyY+ndVmlG4QQiQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iS2zz-0004EW-T2; Tue, 05 Nov 2019 17:52:11 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iS2zw-0004Df-MO for linux-arm-kernel@lists.infradead.org; Tue, 05 Nov 2019 17:52:10 +0000 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1DB1D20650; Tue, 5 Nov 2019 17:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572976328; bh=p+VFQmkLqCjORwfUsYuCrte2jE7w7TTv8ecEBf5sFgg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=srDrOLLXcIW6gCW3oXZrBlGEV0CAfb6hz8wpyF0zB5fkJqfSCDq2F9LY03JnvrEgx sDKT1bZHpr+8iPIcCDylMkS5Vjsl3QY6li8oE5yiTXO3826kwQscMV2WbszT6NetJc 2zDNDw1mHVRc2B9RyDRzO7q/kW8GqO0b+ok9/poo= Date: Tue, 5 Nov 2019 09:52:06 -0800 From: Eric Biggers To: Ard Biesheuvel Subject: Re: [PATCH v3 28/29] crypto: remove deprecated and unused ablkcipher support Message-ID: <20191105175206.GD757@sol.localdomain> Mail-Followup-To: Ard Biesheuvel , linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" , linux-arm-kernel@lists.infradead.org References: <20191105132826.1838-1-ardb@kernel.org> <20191105132826.1838-29-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191105132826.1838-29-ardb@kernel.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191105_095208_768301_A3A50AD7 X-CRM114-Status: GOOD ( 15.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "David S. Miller" , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Herbert Xu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 05, 2019 at 02:28:25PM +0100, Ard Biesheuvel wrote: > Now that all users of the deprecated ablkcipher interface have been > moved to the skcipher interface, ablkcipher is no longer used and > can be removed. > > Signed-off-by: Ard Biesheuvel Reviewed-by: Eric Biggers Thanks for doing this! A couple ideas for future cleanups below (which, if done, should go in separate patches rather than in this big one): > @@ -786,9 +683,6 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm) > struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); > struct skcipher_alg *alg = crypto_skcipher_alg(skcipher); > > - if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type) > - return crypto_init_skcipher_ops_ablkcipher(tfm); > - > skcipher->setkey = skcipher_setkey; > skcipher->encrypt = alg->encrypt; > skcipher->decrypt = alg->decrypt; > skcipher->ivsize = alg->ivsize; > skcipher->keysize = alg->max_keysize; Since a crypto_skcipher will now always be paired with a skcipher_alg (rather than an blkcipher or ablkcipher algorithm), we could remove the 'encrypt', 'decrypt', 'ivsize', and 'keysize' fields of crypto_skcipher, and instead always get them from the skcipher_alg. > @@ -182,27 +171,18 @@ static inline u32 skcipher_request_flags(struct skcipher_request *req) > static inline unsigned int crypto_skcipher_alg_min_keysize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_ablkcipher.min_keysize; > - > return alg->min_keysize; > } > > static inline unsigned int crypto_skcipher_alg_max_keysize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_ablkcipher.max_keysize; > - > return alg->max_keysize; > } > > static inline unsigned int crypto_skcipher_alg_walksize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_blocksize; > - > return alg->walksize; > } > > diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h > index 8c5a31e810da..b4655d91661f 100644 > --- a/include/crypto/skcipher.h > +++ b/include/crypto/skcipher.h > @@ -241,9 +241,6 @@ static inline struct skcipher_alg *crypto_skcipher_alg( > > static inline unsigned int crypto_skcipher_alg_ivsize(struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_ablkcipher.ivsize; > - > return alg->ivsize; > } > > @@ -286,9 +283,6 @@ static inline unsigned int crypto_skcipher_blocksize( > static inline unsigned int crypto_skcipher_alg_chunksize( > struct skcipher_alg *alg) > { > - if (alg->base.cra_ablkcipher.encrypt) > - return alg->base.cra_blocksize; > - > return alg->chunksize; > } Now that these helpers are trivial, they could be removed and we could just dereference the struct skcipher_alg directly. - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel