Re: [Cfrg] Balloon-Hashing or Argon2i.

Bill Cox <waywardgeek@gmail.com> Wed, 17 August 2016 07:52 UTC

Return-Path: <waywardgeek@gmail.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AB77412B064 for <cfrg@ietfa.amsl.com>; Wed, 17 Aug 2016 00:52:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SKzno6Ax5Wk7 for <cfrg@ietfa.amsl.com>; Wed, 17 Aug 2016 00:52:55 -0700 (PDT)
Received: from mail-yb0-x229.google.com (mail-yb0-x229.google.com [IPv6:2607:f8b0:4002:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6C52812B058 for <cfrg@irtf.org>; Wed, 17 Aug 2016 00:52:55 -0700 (PDT)
Received: by mail-yb0-x229.google.com with SMTP id d10so31452888ybi.1 for <cfrg@irtf.org>; Wed, 17 Aug 2016 00:52:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XapcpEcGP3HPAjogMaHoYDfsto5Oas8bd4xDk1PzHCM=; b=DjSnvMvP6+imRDEeipihLlCXkqu2Ry6coO4E6onsaA5uK+KR3TZMWkLJiFVXLPeDHS She6OtWn5mkLsPncMAN7m6Dk9Fm0NUHIw9bYBdJSPrGoyVJa6qiEpB3LeJ0PcZJukJq8 /pblhVWSLOuR0lHt5ssWeS2UTQwXVy+G75RWGKj7blu/zb3OZnPlYAWX+2jiBCbSEsN2 bGYXjKIguJryBD1CqCEJn4mzAQCmkqOG3jGWNAyq5cFSW72bNTGuR2bFAp0gUcuF3Sbg TrpvCHH5T89ZCgNjjr2p/dVY7iAYKo6L6maa2StPV3uUYvo+Vw1zAD/OtDlX0MXmUms1 +nOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XapcpEcGP3HPAjogMaHoYDfsto5Oas8bd4xDk1PzHCM=; b=bOmDd6OTuXVbnBEcPHIwonZz+tDnk9diGPkFNnigljB9HzC/jT5iOvptQ66Pe/zQVt GiPQfm38dkZe+n5xx2QhacU+JsfuTScvAGjjn8xy7epKHSvfOSZQ6NFEQf02KfP0jJwF UbZjGCo7T6ACOhEzu63L4UGqkELJHjEx+/QhnM2gcOqaCQ8CLr7MI7VKLVTc4+IGkrFc zIfZ6+dBP/4J990ouWwuJYzXO3uHbgPe9ymZ/TBmkIPjGJoo9bgKXXULl8C1TQW/YUPk BrGbnWJgXWwFfSBu83bqcUSXQFSxm+46QoEw4oyyE2tss5NOIfjLcR2ivUOqyaYTi6FV 9MRg==
X-Gm-Message-State: AEkoouusmZ5l7D5zBMR4D9T62BDrPtU3+4/AQshMTfdXn/0fQCOK10EjTxKCzSPS0M1e5Ox73xYVR/BEj+59Jg==
X-Received: by 10.37.47.196 with SMTP id v187mr25169369ybv.11.1471420374553; Wed, 17 Aug 2016 00:52:54 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.53.17 with HTTP; Wed, 17 Aug 2016 00:52:53 -0700 (PDT)
In-Reply-To: <f5101446-b8b5-9fb7-9336-2007c4f5c331@ist.ac.at>
References: <CAMgMiWfPZUA4wzPw+T43R8KeVq1va8qshp2Oa24AhhX2SAgTmw@mail.gmail.com> <CAOLP8p6E-Y7a9WK6DCTqT_NYEiD03p4i_z0T_S_Xhr291=zyhg@mail.gmail.com> <f5101446-b8b5-9fb7-9336-2007c4f5c331@ist.ac.at>
From: Bill Cox <waywardgeek@gmail.com>
Date: Wed, 17 Aug 2016 00:52:53 -0700
Message-ID: <CAOLP8p4t6huOCichOtpgdPvBWv7b6oXuPJgysCYym3SccF5mNA@mail.gmail.com>
To: Joel Alwen <jalwen@ist.ac.at>
Content-Type: multipart/alternative; boundary="001a1140b5f4bd9868053a3fc0cb"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/5SjB7EMbeY3qGK784ETpj0Y0aGQ>
Cc: IRTF CFRG <cfrg@irtf.org>
Subject: Re: [Cfrg] Balloon-Hashing or Argon2i.
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Aug 2016 07:52:58 -0000

On Tue, Aug 16, 2016 at 3:32 PM, Joel Alwen <jalwen@ist.ac.at> wrote:

> Hi Bill,
>
> First, thanks for all the details. I greatly appreciate hearing about
> the perspective of someone working closely with hardware about this stuff.
>

I enjoy it, too.  I hope I can help.  I believe I made some mistakes above
(I make a lot of them).

Let me see if I understood correctly.
>
> So one thing you saying is that if we want to talk about total energy
> consumption we should really be including the cost of read/write to memory.
>

I think so.  The concept of energy per read/write captures the idea that
moving data is what takes significant energy, not keeping it in one place.
However, this model breaks when scaling memory size.  Power per read/write
grows roughly as the square root of memory size, as does the distance the
data travels.

One way to incorporate this into the PROM model (at least for all
> algorithms we've ever considered in it) is to change the definition of R
> so that it also includes that energy consumption. In particular data is
> only ever read/written in conjunction with one call to the compression
> function. However if we do this then my understanding is your saying
> then R >> n.
>

In the context of R >> n or R << n, if I understand correctly, n represents
the energy for storing n blocks of memory 1 tick, and R is the power of
computing H.  In a "low power" process, leakage power will be insignificant
for on-chip SRAM, and it is typically pretty low in DRAM modules.  I think
this equation will look different when read/write power is added, and I
think leakage power can be probably dropped, assuming we're using a
low-power process like we see in BitCoin mining ASICs.

To me that sounds like (assuming for a second that energy consumption is
> what matters most) the adversary cares primarily about using an
> algorithm that minimize the number of calls to the compression function.
> So then the optimal algorithm is always going to be the honest one for
> pretty much any iMHF I can think of so then really there isn't a lot to
> be done here...
>

There are cases where power is reduced when reducing memory usage in a TMTO
attack.  The simple deep TMTO against Scrypt yields a 4X reduction in naive
At cost (max memory used times total computations of H).  Cutting the
memory by 4X in a TMTO attack reduces memory power per read/write by about
2X, in addition to reducing the number of read/writes.  There is certainly
room for reducing power here against Scrypt by reducing memory.  However, I
see less room in attacks against Balloon hashing and Argon2i-B (for tcost
>=3), though I thought the same thing about Argon2i-A and was wrong.


> One thing I want to add is that the way "Energy-complexity" in the PROM
> is defined has the following property. If we use
>
>          R = area-core / area-storing-one-block
>
> which is roughly how we actually set R in our experiments in the recent
> paper, then
>
>       Energy-complexity =< AT-complexity per instance
>

Looks right to me.


> Moreover, I think the gap between the two is relatively small.
> Especially if R is set to be large enough to account for the area not
> just of a core but also the routing needed per core. Though, in this
> case, your previous comments on how ASIC routing scales implies one
> should probably also have R scale with the the number of parallel cores.
>

Yes, I think it needs to scale as the square root of the number of parallel
cores.  I'd just do a rule-of-thumb check to get a WAG for the routing
power.  I've never been able to route data on a chip using less than 1pF
per cm.  The last chip I worked on was a minimum of 2.5pF per cm, so
assuming 1pF/cm is probably close enough.  Given that, and the bits per
block is all you need to get a WAG for routing power, which could be added
to R.

BTW, if we know the exact paths data will need to be routed over, as we do
in Argon2i-B then we can run a place-and-route algorithm to assign
computation nodes in the DAG to cores to minimize the distance data is
routed while keeping the cores working in parallel.  This can significantly
reduce routing power.

Security Statements in the PROM
> -------------------------------
> So with that in mind a statement of the form:
>
>        "No algorithm can compute F() with less than X energy-complexity
> in the PROM model."
>
> is then really also making a statement about the amortized AT-complexity
> of an adversary. My understanding is that the consensus in various works
> (including the scrypt paper, the Catena paper and the cryptanalysis of
> various MHFs be Biryukov and Khovratovich) is that large AT complexity
> is indeed a desirable defence.


I agree.  If you prove either a high AT cost, or a high power cost, that
counts as "provably secure" to me, though to be competitive, the algorithm
would still need a lot of optimizations for the various defenses such as
those that were considered in the PHC.

In fact, in the former works bounding
> area for just the memory components is actually already a good defence.
> While in the latter (and most of the PROM works) we also take into
> account the area of the cores on chip. So with this in mind I believe
> such "security statements" in the PROM remain of interest.
>

I agree.  I look forward to future results.

Bill