Docsity

Importance of Randomness in Cryptography: Secure Sequence Generation, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
1
Random Number Generators
ECE 746: Lecture 11
Need for random bits in cryptography (1)
Secret keys in symmetric-key cryptosystems
User private keys in public key cryptosystems
• starting point of the incremental search for primes
pand qin RSA
• private key xin DSA
• private key xin Diffie-Hellman
Message private keys in randomized public key
schemes
•kin DSA and El-Gamal
System parameters in public key schemes
•p, q, hin DSA
•p, gin Diffie-Hellman
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Importance of Randomness in Cryptography: Secure Sequence Generation and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Random Number Generators

ECE 746: Lecture 11

Need for random bits in cryptography (1)

Secret keys in symmetric-key cryptosystems

User private keys in public key cryptosystems

  • starting point of the incremental search for primes

p and q in RSA

  • private key x in DSA
  • private key x in Diffie-Hellman

Message private keys in randomized public key

schemes

  • k in DSA and El-Gamal

System parameters in public key schemes

  • p , q , h in DSA
  • p , g in Diffie-Hellman

Need for random bits in cryptography (2)

Block padding in encryption

Parameters in security protocols

  • challenges
  • nonces

Initialization vectors

  • IV in CBC, CFB, OFB, CTR

What is a Random Number

Generator?

Working definition (from Bruce Schneier):

The Output:

  1. Looks random (passes statistical tests).
  2. Is unpredictable.
  3. Cannot be reproduced.

Entropy or Uncertainty of X

Possible values of X: x 1 , x 2 , x 3 , …, xN

Corresponding probabilities: p 1 , p 2 , p 3 , …, pN

H(X) = ∑

i=

N

pi log 2 ( )

pi

Hardware-Based Random Bit Generators

Underlying Physical Phenomena

1. Thermal noise from a semiconductor diode or resistor

2. The frequency instability of a free running oscillator

3. Time elapsed between emissions of particles during

radioactive decay

4. Difference in charge between two neighboring metal-insulator

semiconductor capacitors

5. Sound from a microphone or video input from a camera

6. Air turbulence within a sealed disk drive which causes random

fluctuations in disk drive sector read latency times

Block diagram of the Intel RNG

Dual-Oscillator: Principle of Operation

Software-Based Random Bit Generators

Slow

Subject to observation e.g., using trojan horses

Require multiple sources and a complex mixing function

Subject to manipulation e.g., restart of the system

Pros Cons

Inexpensive

Easy to integrate with software

Poor statistical properties

Software-Based Random Bit Generators

Rule of thumb

For every BYTE of data collected at random

there is one BIT of entropy

State

One-way function

Output

One-way function

Random Bit Generator

Seed

Pseudorandom Bit Generator

Next state

Strong Random Bit Generator

State Update

Output generation

State

Hash function

Output

Hash function

Random Bit Generator

Seed

Pseudorandom Bit Generator

Next state

BSAFE 3.x Random Bit Generator

Yji

Sji

Xj

Yji = H(Sji)

Output function:

State update function:

Sj0 = H(S(j-1)i || Xj)

Next state function:

Initialization:

S 00 = 0

Output generation

Sji = (Sj(i-1)+(C⋅i)) mod 2L

State Update

C=H(“”) | 1 (^) L bits

Resistance to Attacks (1)

1. Exhaustive Seeding Search

2. Exhaustive State Search

128 bit state = 3⋅ 1038 different states =

1 bilion computers x 1 bilion states/second x 3⋅ 107 seconds/year x 1013 years

3. Malicious software attack

e.g., reading internal state by a virus

4. Forward tracking

Possible until next re-seeding

Resistance to Attacks (2)

5. Back tracking

Possible back to last re-seeding

6. Controlling seed bytes

7. Cycle shortening

8. Timing attacks

State

3 DES

Output

Random Bit Generator

Seed

Pseudorandom Bit Generator

ANSI X9.17 Random Bit Generator

xi

S

xi = EK(Si ⊕ I)

Output function:

Next state function:

Initialization: S 1 = seed I = EK(D)

64 bits

3 DES

3 DES

Date/time D I

xi = EK(xi ⊕ I)

K

K

K

For DES keys and IVs

State

G

Output

Random Bit Generator

Seed

Pseudorandom Bit Generator

FIPS 186 Random Bit Generator

ki

s

ki = G(t, s)

Output function:

Next state function:

Initialization: s 1 = seed t = efcdab89 98badcfe 10325476 c3d2e1f 67452301

160 bits

t

si+1 = 1+si+ki mod 2b

For message private keys k

1+s+ki mod 2b

Choosing the acceptable boundries (2)

Type I Error

Test rejects sequences that were in fact produced

by a random bit generator.

Likely to occur for large values of the significance level α.

Type II Error

Test accepts sequences even if they were not produced

by a random bit generator.

Likely to occur for small values of the significance level α.

FIPS 140-1 statistical tests (2)

2. Poker test

A. Divide the 20,000 bit streams into 5,000 contiguous 4-bit segments. Count the number of occurences of each of the 16 possible 4-bit values. Denote the number of occurances of particular value i by ni 0 ≤ i ≤ 15. B. Evaluate

X =

∑ i=

15 ni^2 - 5000

C. The test is passed if 1.03 < X < 57.

FIPS 140-1 statistical tests (3)

3. Runs test

A. Run - maximal sequence of consecutive 1’s or 0’s which is a part of a sample string

Example: 0110 1111 01 000 1

Block - run of 1’s Gap - run of 0’s

block of length 4

gap of length 3 B. The test is passed if the number of occurances of blocks and gaps of respective lengths are each within the following interval 1 2,315-2, 2 1,114-1, 3 527- 723 4 240- 384 5 103- 6+ 103-

Length of run

Required interval

FIPS 140-1 statistical tests (4)

4. Long run test

A. A long run is defined to be a run of length 34 or more (of either zeros or ones)

B. The test is passed if there are NO long runs

Maurer’s Universal Statistical Test

1 2 3 4 5 6 7 8 9 ….. Q-1 Q

Q initial L-bit blocks Q ≥ 10 ⋅ 2 L

K remaining L-bit blocks (^) K ≥ 1000 ⋅ 2 L

T[j] last occurance of the block corresponding to integer j initialized using first Q blocks of the sample sequence

Ai number of positions since the last occurance of block bi Ai = i - T[bi] defined for Q+1 ≤ i ≤ Q+K, e.g., AQ+5 = (Q+5)-(Q-1)=

Q+1 Q+2 Q+3 Q+4 Q+5 Q+6 Q+7 Q+8 Q+9 ….. Q+K-1 Q+K

Maurer’s Universal Statistical Test

Xu = ∑ i=Q+

Q+K lg 2 Ai

K

A. Evaluate

B. Accept if

t 1 < Xu < t 2

t 1 = μ - γσ

t 2 = μ + γσ

μ = μ(L) given in tables σ = σ(L, K, Q) given in tables γ - number of standard deviations Xu is allowed to deviate from the mean, e.g., for a rejection rate 0.001 γ = 3.

Maurer’s Universal Statistical Test Tables of means and variances

NIST RNG Test Suite

**1. The Frequency (Monobit) Test,

  1. Frequency Test within a Block,
  2. The Runs Test,
  3. Test for the Longest-Run-of-Ones in a Block,**
  4. The Binary Matrix Rank Test,
  5. The Discrete Fourier Transform (Spectral) Test,
  6. The Non-overlapping Template Matching Test,
  7. The Overlapping Template Matching Test, 9. Maurer's "Universal Statistical" Test,
  8. The Lempel-Ziv Compression Test,
  9. The Linear Complexity Test,
  10. The Serial Test,
  11. The Approximate Entropy Test, 14.The Cumulative Sums (Cusums) Test,
  12. The Random Excursions Test, and
  13. The Random Excursions Variant Test.

NIST Special Publication (SP) 800- http://csrc.nist.gov/rng/

TRNG Market Survey

  • Establish Evaluation Criteria for Comparing

TRNGs

  • Conduct a Market Survey for Commercially

Available TRNG Implementations

  • Evaluate Products
  • Identify Entropy Sources

“How Would a System Designer Choose a TRNG

and What Product Would They Select?”

by Mike Dugan, ECE 746, Spring 2005

Evaluation Criteria

  1. Statistical Verification Testing
    • NIST SP 800-
    • DIEHARD
    • Crypt-X
    • FIPS 140-
  2. Rated Speed (Mbps)
  3. Size - Dependant on Form Factor

Evaluation Criteria (cont)

  1. Form Factor (Embedded or Stand-Alone)
  2. Amount of Self-Test Verification
  3. Power Requirements
  4. Price
  5. Operating Temperature

“Entropy Source Not Considered in The Evaluation

Because This is Transparent to the End User”

Market Survey

Embedded Stand alone SafeNet's SafeXcel IP TRNG EIP-75a Protego R200 (USB) SafeNet's SafeXcel IP TRNG EIP-75b Protego R210 (USB) Protegeo R300 SMT Protego R230 (USB) Infineon TPM - Used on Intel P4 MB ComScire J1000KU (USB) IQ Quantique Quantis OEM Zrandom (USB) ID Quantique - Quantis (PCI) 1 or 4 chip ID Quantique - Quantis (USB) Orion Products (RS-232) HG324 made by "random.com" (RS-232) Araneus Alea I (USB)