by cperciva · 10y ago · 0 comments
The issue here is that we need a trusted source of "nothing up my sleeve" numbers: https://en.wikipedia.org/wiki/Nothing_up_my_sleeve_number
This is why the RFC 3526 groups use primes derived from Pi: https://tools.ietf.org/html/rfc3526
I'm sure that it would be difficult to tamper with the results of lotteries held all over the world. But it's even harder to tamper with the value of Pi.
What the authors propose here is much better. The methodology and protocol for transforming the seed digits is agreed to ("committed") ahead of time, before the digits are known, and only later are the numbers generated.
You don't need lotteries to break this logjam. You just demand the minimal parameters that satisfy the security a/o performance considerations for your problem. LaMacchia and Costello did this for NUMS without even needing recourse to constants: they just start with the target security level, find the minimal prime for that security level, and then the minimal suitable (given, for instance, SafeCurves) d for an Edwards curve.
† My friend Peter found it: http://pi.nersc.gov/cgi-bin/pi.cgi?word=BADA55&format=hex --- so: justify the binary offset "2733181964". :)
For example they could choose Pi and say that the following are the official NUMSN for each order of magnitude: 1, 41, 592, 6535, 89793, 238462, 6433832, ... and if a number is needed with a specific property (e.g. 40 digits and prime) than the nearest number to a NUMSN is the official NUMSN for that purpose.
Then any future standard that used a constant they claimed was a NUMSN but wasn't complaint with RFC 31415: Procedures of Generating Constants would be suspicious.
Pi has not been proven to be normal, so you can't be completely sure that you could always find any particularly long (backdoored) sequence.
The problem is that there are lots of small choices involved in picking "nothing up my sleeve" numbers and deriving data from them. Each small choice may seem trivial in isolation, but taken together, the parameter space is so large that you can derive virtually anything from "nothing up my sleeve" numbers.
Bernstein et al. made a point of exactly this in the paper https://bada55.cr.yp.to/bada55-20140722.pdf by deriving the string "BADA55" from "nothing up my sleeve" numbers.
We begin with 17 natural constants: π, e, Euler gamma, √2, √3, √5, √7, log(2), (1 + √5)/2, ζ(3), ζ(5), sin(1), sin(2), cos(1), cos(2), tan(1), and tan(2). We extend this list by including reciprocals. We then convert to constants between 0 and 1 in three different ways: take the fractional part; divide by 256 and discard any minus sign; or take all bits starting from the most significant (i.e., divide by an appropriate power of 2), again discarding any minus sign. Removing duplicates produces 73 starting seeds.
For the hash function, we are using the 10 variants of Keccak listed above. As length for each seed, we use either 20, 32, 48, 64, or 128 bytes, or the block size of the Keccak configuration (6 choices). The seed is either stored in big-endian or little-endian format (2 choices). In order to update the seed during the generation procedure, we are using a counter of length either 0 (i.e., the seed itself is incremented), 2, 3, 4, or 8 bytes (5 choices), either at the beginning or at the end of the seed (2 choices). We either truncate the seed to the right length or round it to the right length (2 choices); note that in many cases these are identical. Finally, we are using several different ways to update the counter between generation of a and b and to choose the order of generating a and b (8 choices). All in all, we have 73 · 10 · 6 · 2 · 5 · 2 · 2 · 8 = 1401600 possible configurations, mostly different, with a high probability to find a procedure that produces the desired vulnerability.
They ended up using picky encoding of cos(1) and a counter that ticked 184 times, and they got a = 0x7144BA12CE8A0C3BEFA053EDBADA555A42391AC64F052376E041C7D4AF23195EBD 8D83625321D452E8A0C3BB0A048A26115704E45DCEB346A9F4BD9741D14D49.
It's not like they simply got a=BADA55... from pi.
If someone uses 1/pi, the first question they face is going to be "why not pi". If you need a series of values, sqrt(p) is reasonable, but if you're just looking for one value then using sqrt(17) is going to look suspicious.
What about bit order, byte order?
What about them? Primes don't have bit or byte orderings. They're just integers.
If you say "I generated this prime by taking Pi, writing it as a series of bytes, permuting those bytes, and then interpreting those as an integer", people will be very suspicious.
ARIA uses 1/π (indeed, why not pi?)
MD5 uses sin(n) (why not cos(n) or sqrt(n)?)
SHA-1 and SHA-2 use square roots and cube roots of small primes (why not sin(n) or pi?)
DFC uses e.
NewDES uses the United States Declaration of Independence.
RC5 uses both e and the golden ratio.
BLAKE uses "a table of 16 constant words which are the leading 512 or 1024 bits of the fractional part of π". (Here you see how things like bit or byte order can give you more choices.)
Pi & friends are all well and good when all you're doing is filling out a few initial bitfield states in a pipeline, but when you're designing a highly complicated process by which to deterministically produce a safe but "random" curve, the process of designing that process itself is going to have some unjustified choices in it. The meta-algorithm, if you like, could have been designed to produce a specific result given the input pi.
Publishing & rigidly defining the method before choosing the seed would seem to alleviate all possibility of foul play.
Except, how do you know the seed was not secretly chosen first? There are probably ways around that again, but this rabbit hole is deep.