Re: [Cfrg] Progress on curve recommendations for TLS WG

Michael Hamburg <> Sun, 17 August 2014 08:20 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id CF5331A0785 for <>; Sun, 17 Aug 2014 01:20:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: 1.556
X-Spam-Level: *
X-Spam-Status: No, score=1.556 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FH_HOST_EQ_D_D_D_D=0.765, FH_HOST_EQ_D_D_D_DB=0.888, HELO_MISMATCH_ORG=0.611, HOST_MISMATCH_NET=0.311, HTML_MESSAGE=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id lckQuGe7kctP for <>; Sun, 17 Aug 2014 01:20:18 -0700 (PDT)
Received: from ( []) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id E39591A0784 for <>; Sun, 17 Aug 2014 01:20:17 -0700 (PDT)
Received: from [] (unknown []) by (Postfix) with ESMTPSA id 1C6DC3AA12; Sun, 17 Aug 2014 01:18:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;; s=sldo; t=1408263530; bh=rIBsXX01kGSNDe2MlTsom1fkOf3yzx0v0MbkMUT4Anw=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=O5IZ5kypiT/k2Gnxz2OHmr43l/f0mvLCDRDHORIIDH/NQiOayBI3AhfxsCmcgHSbZ K0o6DEz5o5mepUXq8Af+tinlnVTDvLPCsgAZ8NWfAuB4GF1naDwcdeT0CtHAHdDD6h /l71Gp34GbDnC7ApVQgHSf4TpTCT3doRL770S1F4=
Content-Type: multipart/alternative; boundary="Apple-Mail=_D450F7EB-8542-44EB-9B15-A4A99E55FFD5"
Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1971.5\))
From: Michael Hamburg <>
In-Reply-To: <>
Date: Sun, 17 Aug 2014 01:20:14 -0700
Message-Id: <>
References: <> <20140808141506.GA24645@LK-Perkele-VII> <> <> <> <> <>
To: Andrey Jivsov <>
X-Mailer: Apple Mail (2.1971.5)
Subject: Re: [Cfrg] Progress on curve recommendations for TLS WG
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Crypto Forum Research Group <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Sun, 17 Aug 2014 08:20:19 -0000

> On Aug 16, 2014, at 11:56 PM, Andrey Jivsov <> wrote:
> I looked at my implementation of modp reduction I did a few years ago for a fixed p. I used Barrett reduction.
> At closer look I don't see why multiply+reduction mod p, for a random but fixed p, is 2n^2 + n. I got a corrected value for Barrett reduction below.

You can reduce one digit at a time.  Eg just cancel the top digit at a cost of one multiply to find the approximate factor plus n to multiply by p, then repeat.  It’s a little easier with Montgomery than with Barrett, since Montgomery always cancels the low digit out exactly.

This is why it’s a pain to reduce with Karatsuba, though.  I don’t know an easy way around it: you either reduce by several digits at a time and pay an extra cost like in your calculations, or you do one at a time but can’t use Karatsuba.

— Mike