Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1761871pxa; Thu, 20 Aug 2020 21:25:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaMiU+HEk+Eswko3z3feg3AiJQ6ZVlcDu2hcfZHzloM+Lu42DppMGHUJg94H7OCC2lZr6x X-Received: by 2002:a17:906:4b0d:: with SMTP id y13mr1088920eju.39.1597983927000; Thu, 20 Aug 2020 21:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597983926; cv=none; d=google.com; s=arc-20160816; b=Spj3sa+DEg7o55xyTBoq9DkEZSiR+G8zDWZljxYyo+1D6APfdtOdCdBs0WssQa/N9o c9ujMLMkrDrcs6Xy24vgGHcDiIp2Zl5MfJbqXXS0lWJEMSdZLnCvgEjpCf1YZNFPx7Rp hGKNTJD8KheGjWhcpWZ/KqPB90Y6wsD0t/yEHXuUYwZ7UrHqXXgVzr+oF0OHsbW855/J 3CXMHx/8/3QZ+s8hF0WG4Ozkmk2czB23EJe1y8IowElZKkXSzESizdj87Hyo8APKDN3z RJYOR3kX98cQnEWJhjjtxkTSttJ0cPuAXtuL+ZeJ4RIqkxSBjuyGg+AgyXkB/iYwNpwH OBiw== 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:message-id:subject:cc:to:from:date; bh=YF7cArMpjrxP7nI5i1WA5/b7rM0iHE85InAWauCbP4E=; b=neT5l5Gfz41eE4qryZZNlfbq3kR2uB0cffR9uSrNuaiS3LPkfs4Zy31PTDLPLOMU82 NjFirLXOavOPjvhcKQf7Uf1zFiy3h8QlDZPIgwJz90JPZ4G8K0uaSefbcBd/rncUuBTf g6U1UA6m1NPNt5GmHeTXWowKf/JVMqBXlLKTWLfjHFuKNSenpdSlqsqK6EPFZYROr1As +yR2TKz5/9Z0tsgjFRouW3DsinGzsadMttabu9mjHxDZlpZl9fBWVgWo9RIw2LOFUt4v 3ZOtO+hXKU4QRiCfx25Nq8v6f9PvsDeFLqk1mw6TZRYkIR3/t4UO3/k+QL2Uka+2fqWe 5qGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p6si394329edx.443.2020.08.20.21.24.50; Thu, 20 Aug 2020 21:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725806AbgHUEYs (ORCPT + 99 others); Fri, 21 Aug 2020 00:24:48 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:49760 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725270AbgHUEYs (ORCPT ); Fri, 21 Aug 2020 00:24:48 -0400 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1k8ybb-0000Nz-SF; Fri, 21 Aug 2020 14:24:45 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 21 Aug 2020 14:24:43 +1000 Date: Fri, 21 Aug 2020 14:24:43 +1000 From: Herbert Xu To: Eric Biggers Cc: lenaptr@google.com, linux-crypto@vger.kernel.org, smueller@chronox.de, ardb@kernel.org, jeffv@google.com Subject: Re: [PATCH v5] crypto: af_alg - add extra parameters for DRBG interface Message-ID: <20200821042443.GA25695@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200813193239.GA2470@sol.localdomain> X-Newsgroups: apana.lists.os.linux.cryptoapi User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Eric Biggers wrote: > > Since proto_ops are almost identical, and only one is used in a given kernel > build, why not just do: > > static struct proto_ops algif_rng_ops = { > ... > #ifdef CONFIG_CRYPTO_USER_API_RNG_CAVP > .sendmsg = rng_sendmsg, > #else > .sendmsg = sock_no_sendmsg, > #endif > ... > }; > > Similarly for .recvmsg(), although I don't understand what's wrong with just > adding the lock_sock() instead... The RNG algorithms do locking anyway, so it's > not like that would regress the ability to recvmsg() in parallel. Also, > conditional locking depending on the kernel config makes it more difficult to > find kernel bugs like deadlocks. I want this to have minimal impact on anyone who's not using it. After all, this is something that only Google is asking for. Anyway, I wasn't looking for a compile-time ops switch, but a run-time one. I think what we can do is move the new newsock->ops assignment in af_alg_accept up above the type->accept call which would then allow it to be overridden by the accept call. After that you could just change newsock->ops depending on whether pctx->entropy is NULL or not in rng_accept_parent. As for the proto_ops duplication I don't think it's that big a deal, but if you're really bothered just create a macro for the identical bits in the struct. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt