Re: [Cfrg] Elliptic Curves - signature scheme: friendliness to low memory implementations (ends on June 3rd)

"D. J. Bernstein" <djb@cr.yp.to> Sat, 23 May 2015 00:41 UTC

Return-Path: <djb-dsn2-1406711340.7506@cr.yp.to>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 13BA41A0399 for <cfrg@ietfa.amsl.com>; Fri, 22 May 2015 17:41:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 2.896
X-Spam-Level: **
X-Spam-Status: No, score=2.896 tagged_above=-999 required=5 tests=[BAYES_50=0.8, HELO_EQ_NL=0.55, HOST_EQ_NL=1.545, UNPARSEABLE_RELAY=0.001] autolearn=no
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 HwPpOtf2LdNR for <cfrg@ietfa.amsl.com>; Fri, 22 May 2015 17:41:43 -0700 (PDT)
Received: from calvin.win.tue.nl (calvin.win.tue.nl [131.155.70.11]) by ietfa.amsl.com (Postfix) with SMTP id 6D2D31A0398 for <cfrg@irtf.org>; Fri, 22 May 2015 17:41:43 -0700 (PDT)
Received: (qmail 31701 invoked by uid 1017); 23 May 2015 00:42:02 -0000
Received: from unknown (unknown) by unknown with QMTP; 23 May 2015 00:42:02 -0000
Received: (qmail 24069 invoked by uid 1000); 23 May 2015 00:41:31 -0000
Date: Sat, 23 May 2015 00:41:31 -0000
Message-ID: <20150523004131.24067.qmail@cr.yp.to>
From: "D. J. Bernstein" <djb@cr.yp.to>
To: cfrg@irtf.org
Mail-Followup-To: cfrg@irtf.org
In-Reply-To: <20150522173119.GG3791@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/BpNAt4KXEEXf5h3_DmLogLpG3TU>
Subject: Re: [Cfrg] Elliptic Curves - signature scheme: friendliness to low memory implementations (ends on June 3rd)
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <http://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <http://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Sat, 23 May 2015 00:41:46 -0000

In crypto there's a long history of bad API designs (in most cases
allegedly motivated by performance) producing neverending security
disasters. Streaming verification APIs are a perfect example: again and
again we see callers spitting out unverified data directly into software
that can't handle it, because that's the simplest way to use the APIs.

How long are the messages that are actually signed in IETF protocols?
For the protocols where the answer is uncontrolled: Do implementations
allow messages that don't fit into memory? How do those implementations
avoid passing along unverified data? For PGP we know that the answer is
"They do pass along unverified data, and this is a security nightmare."

There are other protocols that don't naturally trigger this problem---
they keep lengths under control, and implementations have no trouble
fitting messages into memory. These implementations should be encouraged
to use a simple, high-security, all-in-one verification API, and the
protocols should be encouraged to use a simple, high-security,
all-in-one signature system.

Nico Williams writes:
> Practical considerations intrude.

Specifying a simple, high-security, all-in-one, deterministic,
collision-resilient signature system doesn't stop higher-level protocols
from deciding to use this core system to sign hashes of messages, with
the obvious consequences. (It also doesn't stop them from using the core
system to sign individual packets, as outlined in my previous message,
with obvious performance effects and _hopefully_ no security impact; as
I said before, formal security analysis is needed.)

The core system should nevertheless be the default: the signature system
that's applied directly to messages in all the situations where
compromise isn't necessary.

> Mind you, streaming is a very good thing, and not just in crypto,
> because predictable state costs are very useful in engineering...

If a tiny device is capable of doing the job in one pass, great---but
engineers don't say "You want to sort a gigantic file? Inconceivable!"
Most user-visible computing tasks work with large amounts of data in
ways that simply don't fit a tiny-memory single-pass streaming model.
(Much more is possible with multiple passes.)

What's particularly vicious about the verification example is that at
first glance the job _seems_ to fit a streaming model, but doing the job
_securely_ does _not_ fit a streaming model (unless the algorithm signs
separate packets---which, as you note, is incompatible with the common
practice of giving users separate "signatures"; it requires that the
data flow work with "signed messages", as in the NaCl API). So people
provide streaming APIs for verification, and security disintegrates.

---Dan