> -----Original Message----- > From: TLS <[email protected]> On Behalf Of Michael D'Errico > Sent: Thursday, October 08, 2020 1:54 PM > To: TLS List <[email protected]> > 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 compute 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 than 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 bottom-most bits. > In addition, the larger published primes are very similar to the shorter ones, > the shorter ones closely matching truncated versions of the 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 different values; there is no chance that the bit pattern will be trapped in some cul-de-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... _______________________________________________ TLS mailing list [email protected] https://www.ietf.org/mailman/listinfo/tls
