Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8028653ybn; Tue, 1 Oct 2019 01:57:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwE5OFtQl2LLRBTu1owFg8FgswnfD5xBTFyZO97sfX4D+o5HX7WgwwJOLijpjGTQHHU/8f/ X-Received: by 2002:a17:906:3443:: with SMTP id d3mr23290274ejb.156.1569920264811; Tue, 01 Oct 2019 01:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569920264; cv=none; d=google.com; s=arc-20160816; b=NVQEEWrSncj4P3hPmkzEhRGDcm1zYqMsmLaRf/XY7C/8dGYELhFeN7qVBDM4sjjoTg rDLo/e6prBd4VUkMBwL3czTUOjt/BuakYsvERMfPCXBZq3yH196hTfQVYQ7dJOPMvrK8 laLPYIhW4ORxPXXe6oyfiHys0p4/TIoLFqTx55HCQgI0N/Wu1FtrO9JkALVVSbk4tIoK tHhPalpMldg9Zl2d4D+1ZFFi2ewL0qENZ/ttjmYzrlaS3p3dxRp1Uv1ajm2NdX1nmwgP UOTIb8xq14CXDYzsmTNu4HWHFwOMSsiUraUuSzXQkuVAQ824v/UkT1MXa75goDW6ml+I DbMA== 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=rveAeMH6nUFyX5FAstmiBHjqBY6vb+FrCceaPqrZxk4=; b=qwt2XbTlE4orVZDEh3vhjP1ktAOVHxs23ogmn4qhv1lDQN1U1a2yRzwAaGB2cgQvaH AMr/7Ht0GseDPAToaXCw7Zm24J0go5HL5hdlRLz0XpZ3w0EQy2MrSD+SpcbjUe1ujxVg qEVrvGgJhFKfawOr+otjmPhB77D6wyC0VXf6HeLUXfaDSeFJOVY8GPid+TtkYyvabI2A YbG4LXptN7FfhYsZnWJgOWAy2m3R+foImlatZEysfEoLpPW8Gvq2DctE4D0KazfCbZMW dkXjMknwanlYkNyvg2cHCivC5UPaXRHj77o+Tp+0KaRbjI2OSQ0Ow11IhaB6XrN8+XJX Gyvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="y+iE/NUt"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si7733454eja.69.2019.10.01.01.57.12; Tue, 01 Oct 2019 01:57:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="y+iE/NUt"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729776AbfJAI4i (ORCPT + 99 others); Tue, 1 Oct 2019 04:56:38 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:47046 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729642AbfJAI4i (ORCPT ); Tue, 1 Oct 2019 04:56:38 -0400 Received: by mail-wr1-f67.google.com with SMTP id o18so14403139wrv.13 for ; Tue, 01 Oct 2019 01:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rveAeMH6nUFyX5FAstmiBHjqBY6vb+FrCceaPqrZxk4=; b=y+iE/NUt/TozRmqNM2IRjQjT0A9MNjIyxcU4CVljJRq18FbRdjN6KbsQwjS0n9JXir XYoB9mrKTgiurrdZaubQnqtQmwVpJsDB+YUHfJmH+LmFrZ8QFtifXmroC4+isLCfUQWS 6LPYIl+EOEFSuBE0cYDZkpDOBdZa3L1QtyOLb9/juFyIgwjRZJWKvAhcwSsLwWw8ErLF idbV3P9PujoXG8LnEzDPWPwCjRTAiUXJPNBhzXlCBx1XmBi0t2uV2nSRXRCYsrH1PnSB Cb6dCg/3UoHlwyIKbciCosAVBQemhPQVTmHNbIGOvo6WsH3WY5dRcgtl+btGFHPDjbiS KtzA== 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=rveAeMH6nUFyX5FAstmiBHjqBY6vb+FrCceaPqrZxk4=; b=iDEh8r4QcdCvrJM0zNfyzTkle+Rb7d/6q0nCdCXTmYqcgOxW2eUtNWG7431giVUdt0 9L9osggCQ4MTUgSiXXSoZPPY3SnjwXtdbZ5MOqO/THXCcGmmk8MjV4XEPYohSsvfort9 y6+XFqbQ5OsRkOrFcXss7r6DpcQaSm8l+ZyQosxJtnSS98qnpcdL1UPJDlyeUjV06LUW arNIOFoJy1BT8uQjdvkBxXOfxNlUu9H+xFvmLtG3orO4gb4ZUv6IlchIELp5khTZT4nQ efSjr5jP3DmFhwi9ZPCW25ZJkrpjE/TqKshgfZnPcnJm8uafzgYWhHvR8+hUtHX33YqY 5O0A== X-Gm-Message-State: APjAAAWhPMVNlJIH5mRdZNx1JI5CMkUDyYYqRydBlx+aQ6jIhCa7QkwX 0Cgasq/IGCQh4lOlkKB6PlILVISKImMkABymEZIw6w== X-Received: by 2002:adf:f406:: with SMTP id g6mr16011124wro.325.1569920195413; Tue, 01 Oct 2019 01:56:35 -0700 (PDT) MIME-Version: 1.0 References: <20190925161255.1871-1-ard.biesheuvel@linaro.org> In-Reply-To: From: Ard Biesheuvel Date: Tue, 1 Oct 2019 10:56:23 +0200 Message-ID: Subject: Re: [RFC PATCH 00/18] crypto: wireguard using the existing crypto API To: "Jason A. Donenfeld" Cc: Andy Lutomirski , Linux Crypto Mailing List , linux-arm-kernel , Herbert Xu , David Miller , Greg KH , Linus Torvalds , Samuel Neves , Dan Carpenter , Arnd Bergmann , Eric Biggers , Will Deacon , Marc Zyngier , Catalin Marinas 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, 27 Sep 2019 at 09:21, Jason A. Donenfeld wrote: > > Hey Andy, > > Thanks for weighing in. > > > inlining. I'd be surprised for chacha20. If you really want inlining > > to dictate the overall design, I think you need some real numbers for > > why it's necessary. There also needs to be a clear story for how > > exactly making everything inline plays with the actual decision of > > which implementation to use. > > Take a look at my description for the MIPS case: when on MIPS, the > arch code is *always* used since it's just straight up scalar > assembly. In this case, the chacha20_arch function *never* returns > false [1], which means it's always included [2], so the generic > implementation gets optimized out, saving disk and memory, which I > assume MIPS people care about. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux.git/tree/lib/zinc/chacha20/chacha20-mips-glue.c?h=jd/wireguard#n13 > [2] https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux.git/tree/lib/zinc/chacha20/chacha20.c?h=jd/wireguard#n118 > > I'm fine with considering this a form of "premature optimization", > though, and ditching the motivation there. > > On Thu, Sep 26, 2019 at 11:37 PM Andy Lutomirski wrote: > > My suggestion from way back, which is at > > least a good deal of the way toward being doable, is to do static > > calls. This means that the common code will call out to the arch code > > via a regular CALL instruction and will *not* inline the arch code. > > This means that the arch code could live in its own module, it can be > > selected at boot time, etc. > > Alright, let's do static calls, then, to deal with the case of going > from the entry point implementation in lib/zinc (or lib/crypto, if you > want, Ard) to the arch-specific implementation in arch/${ARCH}/crypto. > And then within each arch, we can keep it simple, since everything is > already in the same directory. > > Sound good? > Yup. I posted something to this effect - I am ironing out some wrinkles doing randconfig builds (with Arnd's help) but the general picture shouldn't change.