Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4090933pxk; Tue, 8 Sep 2020 10:24:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC03jAPdOAIyAACSSRpnqm73GziS8X6E75773vXvIoXRpi/+BDY8bXJ+G1aarGEQI4NJO9 X-Received: by 2002:a17:906:6a84:: with SMTP id p4mr27946926ejr.374.1599585873112; Tue, 08 Sep 2020 10:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599585873; cv=none; d=google.com; s=arc-20160816; b=jSYy7LKo2xQ99zJdhMPDgf3DGMy2R/Fj/c50MnccqVkIpmgAO/mpHNfuWsXyy+9IGK KzusZPmwDW0rRrQIRK5HsPbbbqNcMOxHkwWkdS7aQMvgKfaqXkIbtKTqvcv9TJUh+dOh hIt3sTSwq1BRPsuruB2jAW4Y/U/KdyONUrJ/CFF9z6kOpQDqJkcuxGVVm6abL0PzoL+h heSAo3ftmxb1mgTnDMgAcl5ilXSyMJL9kHOfu/AJYYZSHk7NbHgeG/vtke/DisRSj8zs 7S8TNmFUGM3aXnKDjBdf08J2XuYqwA1xcTedhg9CCly6X/4s8EbWter1VS6JgS/bHxpN ZgaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tQgwthE20ie07HsCAy63SL8xGyWY/CUmpluNdtYksmo=; b=PnZn4PF+NBGBZTQgGAmJTJhz4rW5OZFAIvFYU10rs9Ju8YOw3/6b5WPSN2/neGfnmW 2cP+mnHBc13Ks0OguPsIhcs4LX03ugVma3aNBjFj0UHQVMaYg3mkhUhkKPqosUI1nPlP ir3ERcoLKrl/KPBjl9N+AKLBM1UiIWsAUHN0EZ9lIUJHFAZQmYkjG6kx/uhC+YYoa+f0 90o828y1AGPtca9zd7kSxbaZmvjV7y4cMWn5NocPK79IYs7R8yq7MvU9OoSkwDYVHBFg MbjRBiH6vCH90ERBOIybDUMk4c/JFmBWDztvzaZ65YSa1bFHcx9tKYB+Kk4PhRMvfrT1 cGdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BvG5P4kR; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si973245eje.378.2020.09.08.10.24.07; Tue, 08 Sep 2020 10:24:33 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=BvG5P4kR; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728347AbgIHRXr (ORCPT + 99 others); Tue, 8 Sep 2020 13:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731860AbgIHRXh (ORCPT ); Tue, 8 Sep 2020 13:23:37 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C815C061573 for ; Tue, 8 Sep 2020 10:23:37 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id m1so16136486ilj.10 for ; Tue, 08 Sep 2020 10:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tQgwthE20ie07HsCAy63SL8xGyWY/CUmpluNdtYksmo=; b=BvG5P4kR7VUz5JTKW56rDPSCOJ4bHNyvflIawe6IWBSjmiz394QJLzYkqAvvpuTeU/ or7I+EcKzxWgw076NipX2ZihN96KFf989nTxdLtqbZoCXsnjs0gqEMiTRMCrr7eEWJF6 Af/cIZ+nuyPNonmVEy/ZCOWvA/kVWSFVBT7ejU1gopNuJVk0UIuI8h0AT/4F/0ed7bOa x5W9yICdkjKJTxsXvLlPjQ6M5KsR4mksHrj0gMk2H1kTotUwLaCVe/bDlXn1omWb//2E iLsgHDZCq/isFi2qWHS4EKCILq45lfQ7MEeFj1PDwLCyn1oEAfhyXXMgFQK2etvqzSgr 6Ayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tQgwthE20ie07HsCAy63SL8xGyWY/CUmpluNdtYksmo=; b=C0Y2GLDHJBsVzXbsmW0eIIxR6LxMdsbtKI1RXijnEklb0nbDF+aV3dZmw4AxIs0BEB E3t/gfROHYF05M/lZc2Lr4Bj7JbiiQOSpSfrL18ayP7cYCe0v5bV0BjYWEwLCkKQQoZ8 ttzAxT74JXL+GMjidcBDYfRs4Sc4sbg/5bBIzTxHb+P4OpPDlMsk2NGZzECHbKARG7XX 15K+YespFaOG2WpluXhg7kRVngQzfCHeUvnuMUwxhvSnp/PrvDBlmCfGnqOihNzjQGKU 4cnEtiEjCneUyaIna1gmpLyPe1JJNQyqzMokHu4xbK7Eh8fOLkPcZsmZkqCcVMYS2GqZ VbMQ== X-Gm-Message-State: AOAM531dYxpqFO8REHpdjsSpj2Y/ZvDnIzzklf14QTLm8M9SIeKySiwU mBMLAZ7+YabC2tmg12lEJxRDs/41pEU4NkM08AQY7Q== X-Received: by 2002:a92:de45:: with SMTP id e5mr26227633ilr.102.1599585816388; Tue, 08 Sep 2020 10:23:36 -0700 (PDT) MIME-Version: 1.0 References: <20200813193239.GA2470@sol.localdomain> <20200821042443.GA25695@gondor.apana.org.au> In-Reply-To: <20200821042443.GA25695@gondor.apana.org.au> From: Elena Petrova Date: Tue, 8 Sep 2020 18:23:25 +0100 Message-ID: Subject: Re: [PATCH v5] crypto: af_alg - add extra parameters for DRBG interface To: Herbert Xu Cc: Eric Biggers , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Stephan Mueller , Ard Biesheuvel , Jeffrey Vander Stoep Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, 21 Aug 2020 at 05:24, Herbert Xu wrote: > > 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. Ack, done in v6. > 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. I didn't create a macro to avoid complicating the code. Thanks, Elena