Re: [TLS] DH generator 2 problem?

Dan Brown <> Fri, 09 October 2020 17:11 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id E4E9D3A0D1E; Fri, 9 Oct 2020 10:11:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -3.299
X-Spam-Status: No, score=-3.299 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id FODsxz9v9IEC; Fri, 9 Oct 2020 10:11:29 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 6B57B3A0D21; Fri, 9 Oct 2020 10:11:27 -0700 (PDT)
Received: from pps.filterd ( []) by ( with SMTP id 099H9I0P061532; Fri, 9 Oct 2020 13:11:24 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; h=from : to : subject : date : message-id : references : in-reply-to : content-type : mime-version; s=corp19; bh=A96v2ZOysHJB0HGEi8LlwPkt+QFDRFiua27+HsQlSAg=; b=sHYYLzFyt9r1JcIkKM0bFah4TXnOa23vBzvhKd6OjVLCy8kMqv1lF4HrvIJMWYnHBHhC G9haaYxtRGaGZE+Aq035/Hjvb7ZylaB1Wuf40dlUewduKte4O20P+tf3RbuQ8iYBIg/4 BC0HabHOjB+0CGGBfulTBE8JKhC843nZ+NE7/qDXo1L520Tq7zkUCoppeMV4V7QGEoRL wvrxeHGbWLROPswhYdIjpG6rpW89YHeMYmGNjHIJ/KUwx8u/pc93wBMgQlGArtADV7ax b/4ZJRqdB45IZHTWokFY6GjVGwfHbSUIfe4Odk+xDbxc8iL8j/SKWrfl+WIbykfS5pCY QA==
Received: from ( []) by with ESMTP id 3429jhhuq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 09 Oct 2020 13:11:24 -0400
Received: from ( by ( with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Fri, 9 Oct 2020 13:11:23 -0400
Received: from ([fe80::ac8d:3541:704c:478a]) by ([fe80::ac8d:3541:704c:478a%5]) with mapi id 15.01.2044.006; Fri, 9 Oct 2020 13:11:23 -0400
From: Dan Brown <>
To: "Scott Fluhrer (sfluhrer)" <>, "Michael D'Errico" <>, TLS List <>
Thread-Topic: [TLS] DH generator 2 problem?
Thread-Index: AQHWnZwZhaKJlgLOrU+o5xOQwr3ljKmOVMEAgAElhkA=
Date: Fri, 9 Oct 2020 17:11:23 +0000
Message-ID: <>
References: <> <>
In-Reply-To: <>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
x-originating-ip: []
Content-Type: multipart/signed; micalg=2.16.840.; protocol="application/x-pkcs7-signature"; boundary="----=_NextPart_000_00B6_01D69E3D.AEBBDF70"
MIME-Version: 1.0
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-09_09:2020-10-09, 2020-10-09 signatures=0
Archived-At: <>
Subject: Re: [TLS] DH generator 2 problem?
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 09 Oct 2020 17:11:32 -0000

Dear Michael,

Your concern that special primes in Diffie--Hellman might be weaker has some
truth: the famous and ingenious special number field sieve (SNFS) works
against primes with special structure.  See 
for a recent application (which, as an extra wrinkle, is also able to hide
the special structure). 

Therefore, applied cryptography like TLS already uses vetted primes in
Diffie--Hellman, with careful guidance from cryptographers such as those in
CFRG, which specialize in such fundamentals.  (Full disclosure: I proposed
some primes for DH to the CFRG list (for reductionist security), but never
followed through with an I-D.)

Scott explains below very well, as one'd expect, why the generator choice
should generally not matter (random self-reducibility).

Best regards,


> -----Original Message-----
> From: TLS <> On Behalf Of Scott Fluhrer (sfluhrer)
> Sent: Thursday, October 8, 2020 3:09 PM
> To: Michael D'Errico <>om>; TLS List <>
> Subject: Re: [TLS] DH generator 2 problem?
> > -----Original Message-----
> > From: TLS <> On Behalf Of Michael D'Errico
> > Sent: Thursday, October 08, 2020 1:54 PM
> > To: TLS List <>
> > Subject: [TLS] DH generator 2 problem?
> >
> > Using finite-field Diffie-Hellman with a generator of 2 is probably
> > not the best choice.  Unfortunately all of the published primes (RFCs
> > 2409, 3526, and
> > 7919) use 2 for the generator.  Any other generator would likely be
> > (not sure how much?) more secure.
> No, that is known to be not true.
> In particular, if you can compute discrete logs to the base 2, you can
> discrete logs to any base (except in the cases where 2 generates an
> anomalously small subgroup, which is not the case in the above groups).
> Here's how it works; suppose you were given the problem of solving the
> discrete log problem g^x = h, for some g, h.  Then, if you can solve
discrete logs
> to base 2, you would solve these two problems:
> 2^y = g
> 2^z = h
> Once you have solved those two problems, then you have x = y z^-1 mod p-1.
> It's a little more complex if g, h is not in the subgroup that 2
generates, but not
> that much more (unless, as above, the size of that subgroup is far smaller
> p-1).
> >
> > The problem is that 2^X consists of a single bit of value 1 followed
> > by a huge string of zeros.  When you then reduce this modulo a large
> > prime number, there will be a pattern in the bits which may help an
> > attacker discern the value of X.  This is further helped by the fact
> > that all of the published primes have 64 bits of 1 in the topmost and
> most bits.
> > In addition, the larger published primes are very similar to the
> > shorter ones, the shorter ones closely matching truncated versions of
> larger primes.
> >
> > If you were to manually perform the modulo-P operation yourself, you
> > would add enough zeros to the end of P until the topmost bit is just
> > to the right of the 1 bit from 2^X, and then you'd subtract.  This bit
> > pattern will always be the same, no matter the value of X.  In
> > particular, the top 64 bits disappear since they're all one.
> > Continuing the mod-P operation, you adjust the number of zeros after
> > the prime P and then subtract again, reducing the size of the operand.
> > The pattern of bits again will be the same, regardless of the value of
X, the
> only difference being the number of trailing zeros.
> Actually, for these group, the value of 2^x mod p can take on (p-1)/2
> values; there is no chance that the bit pattern will be trapped in some
> sac, as you appear to be suggesting...
> >
> > I have not looked at the cyclic patterns which happen as you do this,
> > but I wouldn't be surprised to find that the "new" primes based on e
> > (RFC 7919) have easier-to-spot bit patterns than those based on pi.
> I would be surprised; do you have some reason that would suggest why bits
> derived from the binary expansion of 'e' would be somehow qualitatively
> different from bits derived from the binary expansion of 'pi'?
> >
> > This is speculation of course.
> Might I suggest you learn a bit of number theory to go along with your
> speculation?
> >
> > Should we define some new DH parameters which use a different
> > generator?  Maybe the primes are fine....
> If the prime is fine, so is the generator...

This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.