Re: [Cfrg] Mishandling twist attacks

"D. J. Bernstein" <djb@cr.yp.to> Mon, 01 December 2014 22:37 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 8B2151ACD44 for <cfrg@ietfa.amsl.com>; Mon, 1 Dec 2014 14:37:26 -0800 (PST)
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 Q-PU3CC-Lmrc for <cfrg@ietfa.amsl.com>; Mon, 1 Dec 2014 14:37:25 -0800 (PST)
Received: from calvin.win.tue.nl (calvin.win.tue.nl [131.155.70.11]) by ietfa.amsl.com (Postfix) with SMTP id DF2C91ACD29 for <cfrg@irtf.org>; Mon, 1 Dec 2014 14:37:24 -0800 (PST)
Received: (qmail 6042 invoked by uid 1017); 1 Dec 2014 22:37:44 -0000
Received: from unknown (unknown) by unknown with QMTP; 1 Dec 2014 22:37:44 -0000
Received: (qmail 12123 invoked by uid 1001); 1 Dec 2014 22:37:20 -0000
Date: Mon, 01 Dec 2014 22:37:20 -0000
Message-ID: <20141201223720.12122.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: <201412011735.49243.manfred.lochter@bsi.bund.de>
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/8z3ZcujGRxFSGEBI-uE7C1tjw4c
Subject: Re: [Cfrg] Mishandling twist attacks
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: Mon, 01 Dec 2014 22:37:26 -0000

Lochter, Manfred writes:
> On the other hand this countermeasure is quite dangerous, when applied
> during signature generation.

No. It's true that minimum-length signature nonces with the high bit set
are dangerous, but minimum-length signature nonces _without_ the high
bit set are _also_ dangerous, so blaming the high bit is unreasonable.

The best protection we know is to generate much longer nonces---such as
the 512-bit nonces in Ed25519. Then the system isn't broken by a timing
attack revealing the nonce length. Setting the high bit of such a long
nonce is also perfectly safe.

Of course, an implementor can still get in trouble by (1) reducing these
nonces and then (2) leaking the lengths of the reduced nonces through a
variable-time scalarmult method. So, as another line of defense, we also
choose curves that support simple, fast, constant-time ladders.

---Dan