Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp562035img; Thu, 21 Mar 2019 04:20:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJF5zRejvxdznz2arQpvRUu/DQV0uD0/KRKtDjHXMdHxujKj8IPmdqHkATaoCJvlSHgqX8 X-Received: by 2002:a63:e653:: with SMTP id p19mr2875545pgj.284.1553167257489; Thu, 21 Mar 2019 04:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553167257; cv=none; d=google.com; s=arc-20160816; b=T3FeSs1bo0VRBJpcSZ5q4S7Y3dC4uETddbljCkh9qMHSAjAOgmY8c03rsknqUuLeig Cz91fiJRQRbQ8BcLeVVwG9XArPeZujQaXRRD1SFZ6sgzAXRotajTd/lfz5Zm4J2HIOSh 842m60s5tO4d8ANEZwGRqsS9e4DGRx5rbeRzdY9Wbi9JbZoLGzcEFBX3gssok2NimFQz KrtBlMC3cpMiQ7r+cERjR8H5CbtszKOoPzYCVsuo+ssBP+Fb0t2XmdJnuxx323+kLnYV NgyprVYXsC5g3c3bAc0IpXuEnB1SLvGZankVYZoHb7+a1xxtaFVfqw+l+Zq85X+RppH4 8J7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=77RzxiyUqXCUM2P+qtK6FIGHoRNyE/MxjxAr8Vk0Djk=; b=GJJ2Urg2B68wyoy418sAu1OuEOkC/X7V3vldhiLQIsF2ASsdABC5PedFJlDvxGJ7++ nNmjT7pfrWSaRZTvKNJ5OM6EnL03YKJ7H4B79tuETQlRH/+nPQBYKg6/JxWcpSQaXjlo F31EeW1g+BARMLMwzRhZIyx+CfeB+zcRlVLhq4+uIL00Bmw2d50BUA/lavGFs5IZui5E mliHPzMuZx9+W+zokBBCq6qWZWSZcDrnKevcAbZwQrgsHJ/EfhyAKYD+Omzyx/1AYF2Y NfT0UCzXi+3WJqxM9UqdMrpXV7LygTyJ6ShbJfD4Leme3h7MhRH4TZDEjM0qdKvtBSyK UwGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si3908352pgi.487.2019.03.21.04.20.42; Thu, 21 Mar 2019 04:20:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727986AbfCULTc (ORCPT + 99 others); Thu, 21 Mar 2019 07:19:32 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:36196 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727823AbfCULTb (ORCPT ); Thu, 21 Mar 2019 07:19:31 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1h6vjG-0005yU-SL; Thu, 21 Mar 2019 19:19:22 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1h6vjC-0003EC-Lc; Thu, 21 Mar 2019 19:19:18 +0800 Date: Thu, 21 Mar 2019 19:19:18 +0800 From: Herbert Xu To: Vitaly Chikunov Cc: David Howells , Mimi Zohar , Dmitry Kasatkin , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 02/11] crypto: akcipher - check the presence of callback before the call Message-ID: <20190321111918.4kr7vdgz23xzjwed@gondor.apana.org.au> References: <20190301175918.29694-1-vt@altlinux.org> <20190301175918.29694-3-vt@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190301175918.29694-3-vt@altlinux.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 01, 2019 at 08:59:09PM +0300, Vitaly Chikunov wrote: > Because with introduction of EC-RDSA and change in workings of RSA in > regard to sign/verify, akcipher could have not all callbacks defined, > check the presence of callbacks before calling them to increase > robustness. > > Signed-off-by: Vitaly Chikunov > --- > include/crypto/akcipher.h | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > > diff --git a/include/crypto/akcipher.h b/include/crypto/akcipher.h > index 2d690494568c..f537fad1989f 100644 > --- a/include/crypto/akcipher.h > +++ b/include/crypto/akcipher.h > @@ -268,7 +268,10 @@ static inline unsigned int crypto_akcipher_maxsize(struct crypto_akcipher *tfm) > { > struct akcipher_alg *alg = crypto_akcipher_alg(tfm); > > - return alg->max_size(tfm); > + if (alg->max_size) > + return alg->max_size(tfm); > + else > + return 0; > } Please do these checks at registration time instead and provide default implementations as needed. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt