Re: [Cfrg] square roots

Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Thu, 04 June 2015 16:50 UTC

Return-Path: <ilari.liusvaara@elisanet.fi>
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 402E91B35B9 for <cfrg@ietfa.amsl.com>; Thu, 4 Jun 2015 09:50:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.401
X-Spam-Level:
X-Spam-Status: No, score=-1.401 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, GB_ABOUTYOU=0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-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 poCeVgiIUuQY for <cfrg@ietfa.amsl.com>; Thu, 4 Jun 2015 09:50:32 -0700 (PDT)
Received: from emh03.mail.saunalahti.fi (emh03.mail.saunalahti.fi [62.142.5.109]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E3A231B35B6 for <cfrg@irtf.org>; Thu, 4 Jun 2015 09:50:31 -0700 (PDT)
Received: from LK-Perkele-VII (a91-155-194-207.elisa-laajakaista.fi [91.155.194.207]) by emh03.mail.saunalahti.fi (Postfix) with ESMTP id AA2DE18879B; Thu, 4 Jun 2015 19:50:28 +0300 (EEST)
Date: Thu, 04 Jun 2015 19:50:28 +0300
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
To: David Jacobson <dmjacobson@sbcglobal.net>
Message-ID: <20150604165028.GA20115@LK-Perkele-VII>
References: <C49BFA4F-76B9-48A1-913B-144D606FBBDD@isode.com> <556F8811.2070101@cs.tcd.ie> <20150604065658.GA14531@LK-Perkele-VII> <55705235.6000501@gmail.com> <5570797D.7060209@sbcglobal.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
In-Reply-To: <5570797D.7060209@sbcglobal.net>
User-Agent: Mutt/1.5.23 (2014-03-12)
Sender: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/W8MC9aLcqc-P7sJsgz1hMtNKsdQ>
Cc: "cfrg@irtf.org" <cfrg@irtf.org>
Subject: Re: [Cfrg] square roots
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: Thu, 04 Jun 2015 16:50:33 -0000

On Thu, Jun 04, 2015 at 09:14:53AM -0700, David Jacobson wrote:
> On 6/4/15 6:27 AM, Rene Struik wrote:
> >Hi Ilari:
> >
> >Just curious about your side channel remarks: could you give an example
> >where side channel resistance of sqrt{x} is required? Wouldn't this
> >computation only arise if one were to uncompress points, or can you give
> >another example?
> >
>
> If the field modulus p is congruent to 3 mod 4, one of the square roots of x
> can be computed by x^((p+1)/4) mod p, and the inverse can computed with
> x^(p-2) mod p.  Since the exponent is known, one does not need to worry
> about leaking bits of the exponent.  Underneath that, it is just multiplies
> and adds, and of those leak were are had anyway.

I was talking about l, not p (even ECDH needs constant-time 1/x mod p,
and sqrt(x) mod p pretty much only pops up in point decompression, which
is verification side).


Sqrt(x) mod l: l can be 1 mod 8, even for p 3 mod 4 (e.g. Curve41417).
Fortunately, no signature primitive seems to use sqrt(x) mod l for anything.

1/x mod l: x^(l-2) mod l does work, but is pretty slow (there are more multiples
and each multiply is slower than with 1/x mod p). ECDSA does have this when
signing (it inverts secret k), easily creating side channels when unsafe methods
(e.g. EGCD) are used.



-Ilari