35
1 High-Speed True Random Number Generation with Logic Gates Only Markus Dichtl Jovan Golić

High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

1

High-Speed True Random NumberGeneration with Logic Gates Only

Markus DichtlJovan Golić

Page 2: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

2

Being One Year Late

You should have heard this talk at CHES 2006, but …

Page 3: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

3

Why We Need Random Numbers fromLogic Gates

Many cryptographic protocols need random numbers (key generation, seeding pseudo random number generators, random nonces, protection against side channel attacks ...)

Analogue components are cumbersome on digital chips, so random number generators using digital logic only are preferable

Page 4: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

4

Most Popular Random Number Generators Based on Logic Gates

Ring oscillators (ROs)

Devices exploiting metastability of digital circuits like flip-flops

Page 5: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

5

Jovan Golić‘s Great Invention

Jovan Golić found that making the feedback in a RO-like design more complex made the behaviour of the oscillators much more complex

He suggested two different circuits:• FIROs (Fibonacci Ring Oscillators)• GAROs (Galois Ring Oscillators)and specified certain requirements for them

(e. g., how to avoid fixed points)

Page 6: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

6

Reference for FIROs and GAROs

J. Dj. Golić , “New Methods for Digital Generation and Postprocessing of Random Data,” IEEE Trans. Computers, vol. 55(10), pp. 1217-1229, Oct. 2006

Page 7: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

7

FIRO

Page 8: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

8

GARO

Page 9: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

9

Hardware Used for Experiments

Most experiments: Xilinx Spartan-3 Starter Kit based on Xilinx FPGA

XC3S200-4FT256C

Some experiments with CMOS chips 74HCTXX

Output voltages were recorded by a LeCroyWavepro 7200 oscilloscope

Page 10: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

10

Example of FIRO Output

(Feedback polynomial x15+x14+x7+x6+x5+x4+x2+1)

Page 11: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

11

The Problem to Solve

As FIROs and GAROs are similar to LFSRs, although they operate asynchronously, and LFSRs have good pseudo random properties, the question is:

Is the complex behaviour truly random or pseudo random?

How can we distinguish that?

Page 12: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

12

The Solution

To solve the problem of distinguishing between pseudo randomness and true randomness, we go back to the definition:

When restarting many times from the same conditions, pseudo randomness leads to identical behaviour for each restart, true randomness does not!

Page 13: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

13

A Restarting TRNG

H. Bock, M. Bucci, R. Luzzi, “An Offset-Compensated Oscillator-based Random Bit Source for Security Applications”, CHES 2004

M. Bucci, R. Luzzi, “Design of Testable Random Bit Generators,” CHES 2005

proposed restarting a RO to avoid a complicated deterministic beating pattern between fast and slow frequencies in a RO and restarting a random number generator to obtain statistically independent output bits, respectively

Page 14: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

14

A Restarting FIRO

Page 15: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

15

FIRO Restarts from Identical States (I)

Page 16: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

16

FIRO Restarts from Identical States (II)

Page 17: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

17

FIRO Restarts from Identical States (III)

Page 18: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

18

Standard Deviation of 1000 FIRO Restarts

0.2

0.4

0.6

0.8

1

1.2

1.4

Time in ns after restartStan

dard

dev

iatio

n of

out

put v

olta

ge in

V

Page 19: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

19

Restarting a RO (length 3) 100 Times

1

1.25

1.5

1.75

2

2.25

2.5

Volta

ge

in V

495 500 505

Time in nsafter restart

Page 20: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

20

Standard Deviation of 1000 RO Restarts

Page 21: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

21

Extracting Random Bits

Up to now we just considered “analogue“ random voltages, but we want randombits

How to extract them?

Page 22: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

22

A RO Based TRNG Considered “State of the Art“ by one CHES 2007 Reviewer

Schellekens, Preneel, Verbauwhede: “FPGA Vendor Agnostic True Random Number Generator,” FPL 2006, August 2006

based on

Sunar, Martin, Stinson: “A Provably Secure True RandomNumber Generator with Built-in Tolerance to Active Attacks,“ IEEE Trans. Computers, vol. 56(1), pp. 109-119, Jan. 2007

Page 23: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

23

The Schellekens, Preneel, Verbauwhede Design

Enormous power consumption and gate count

Page 24: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

24

4 Reasons why this Fails

• Based on a completely unrealistic assumption on jitter, thata RO has a perfect built-in clock and that jitter occurs onlyaround the transitions of this clock

• The 210 ROs are implicitly assumed to be statisticallyindependent. My experiments show they are not (coupling)

• No chip can compute the XOR at the speed required. For the Leuven FPGA design, the XOR of 210 ROs would havean average frequency of 69.9 GHz (70 transitions per gate delay)

• Even if the XOR could be computed, it could not besampled, because the setup- and hold-times are violated(On average, 23.8 transitions in 0.17 ns, while the signal must be constant)

Page 25: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

25

Lissajous-like Figure for 2 ROs (Length 13)on the Same FPGA Board

Page 26: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

26

Lissajous-like Figure for 2 ROs (Length 13)on Two FPGA Boards

Page 27: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

27

Direct Sampling of FIROs/GAROs

Page 28: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

28

Sampling with Intermediate Toggling Flip-Flop

Page 29: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

29

Restarting or Continuous Operation?

Restarting: Needs time for transitory voltages to settle down. But, output bits are guaranteed to be statistically independent, so postprocessing is easy

Continuous FIRO or GARO operation:Independence plausible for reasonable sampling rates. Statistical tests may be fooled by pseudo randomness

Page 30: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

30

Autocorrelation for Continuously Running FIRO

25 50 75 100

0.2

0.4

0.6

0.8

1

Time in ns

Page 31: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

31

Speeds Achieved on FPGA

Restarting FIRO (run for 60 ns, stop for 40 ns, sampled with intermediate toggling flip-flop): 7.14 Mbit/s (Probability of 1: 51.62 %)

Continuously running FIRO (with toggling FF):12.5 Mbit/s (Probability of 1: 51.92 %)

Page 32: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

32

Squeezing Out Almost Twice the Speed

When we sample both directly and with theintermediate T-flop-flip, we double the raw datarate to 14.28 Mbits/s

The two bits from one run are (weakly) dependent, but the pairs from different runs are independent

Suitable postprocessing can get almost all theShannon entropy, which was 1.933 for each pair

The theoretical output data rate is thus 13.8 Mbits/s

Page 33: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

33

Power Consumption

• For FIRO of length 15 on CMOS ICs 74HCTXX :3 to 4 times the power consumption of a RO (depending on feedback)

• Higher power consumption than RO, but the FIRO entropy rate is orders of magnitude higher

Page 34: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

34

Why FIROs and GAROs are so Good

• The number of logical transitions per time is proportional to the length, as opposed to RO, so longer FIROS and GAROs produce more jitter than ROs

• The complex feedback spreads small random variations quickly over the whole design and makes randomness easier to extract by sampling

• The complex high-frequency output signal could produce frequent metastability effects in the sampling flip-flop

Page 35: High-Speed True Random Number Generation with Logic Gates Only · 2008-01-08 · True Random Number Generator,” FPL 2006, August 2006 based on Sunar, Martin, Stinson: “A Provably

35

Conclusions

• FIROs and GAROs are by far the most efficient known way to produce true random numbers with digital gates only

• Restarting makes the true randomness property testable

• Understanding in detail how the randomness is produced in FIROs and GAROs is a worthwhile topic for further research