Real-life cryptography Pfeiffer Alain.  Types of PRNG‘s  History  General Structure  User space  Entropy types  Initialization process  Building.

Slides:



Advertisements
Similar presentations
1 KCipher-2 KDDI R&D Laboratories Inc.. ©KDDI R&D Laboratories Inc. All rights Reserved. 2 Introduction LFSR-based stream ciphers Linear recurrence between.
Advertisements

CPU Structure and Function
CS470, A.SelcukStream Ciphers1 CS 470 Introduction to Applied Cryptography Instructor: Ali Aydin Selcuk.
LINEAR FEEDBACK SHIFT REGISTERS, GALOIS FIELDS, AND STREAM CIPHERS Mike Thomsen Cryptography II May 14 th, 2012.
Dan Boneh Stream ciphers Real-world Stream Ciphers Online Cryptography Course Dan Boneh.
Generating Random Numbers
1 University of Southern California Keep the Adversary Guessing: Agent Security by Policy Randomization Praveen Paruchuri University of Southern California.
Input and Output CS 215 Lecture #20.
Digital Kommunikationselektroink TNE027 Lecture 6 (Cryptography) 1 Cryptography Algorithms Symmetric and Asymmetric Cryptography Algorithms Data Stream.
CS457 – Introduction to Information Systems Security Cryptography 1b Elias Athanasopoulos
1 The Fortuna PRNG Niels Ferguson. 2 The problem We need to make “random” choices in cryptographic protocols. Computers are deterministic. Standard “random”
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 15 Implementation Flaws Part 3: Randomness and Timing Issues.
First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown and edited by Archana Chidanandan Cryptographic Tools.
1 Analysis of the Linux Random Number Generator Zvi Gutterman, Benny Pinkas, and Tzachy Reinman.
On the (in)security of the random number generators of Linux and Windows Benny Pinkas, University of Haifa Zvi Gutterman, Leo Dorrendorf, Tzachy Reinman,
Stream Ciphers 1 Stream Ciphers. Stream Ciphers 2 Stream Ciphers  Generalization of one-time pad  Trade provable security for practicality  Stream.
Lecture 23 Symmetric Encryption
Computer Security CS 426 Lecture 3
Encryption Schemes Second Pass Brice Toth 21 November 2001.
CMSC 414 Computer and Network Security Lecture 3 Jonathan Katz.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Pseudorandom Number Generators. Randomness and Security Many cryptographic protocols require the parties to generate random numbers. All the hashing algorithms.
Cryptanalysis. The Speaker  Chuck Easttom  
Entropy of Keys and Password Generation Introduction to entropy Entropy and data compression Predictability of random number generation Entropy and system.
Cryptography and Network Security Chapter 7 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Virtual Memory.
Secure Embedded Processing through Hardware-assisted Run-time Monitoring Zubin Kumar.
Security and Random Number Generators
1 Solid State Storage (SSS) System Error Recovery LHO 08 For NASA Langley Research Center.
I/O – Chapter 8 Introduction Disk Storage and Dependability – 8.2 Buses and other connectors – 8.4 I/O performance measures – 8.6.
Cryptography and Network Security Chapter 7 Fifth Edition by William Stallings.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
CS555Spring 2012/Topic 51 Cryptography CS 555 Topic 5: Pseudorandomness and Stream Ciphers.
Random-Number Generation Andy Wang CIS Computer Systems Performance Analysis.
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Pseudo-random generators Random Number Generating There are three types of generators table look-up generators hardware generators algorithmic (software)
Session 1 Stream ciphers 1.
Description of a New Variable-Length Key, 64-Bit Block Cipher (BLOWFISH) Bruce Schneier BY Sunitha Thodupunuri.
Linear Feedback Shift Register. 2 Linear Feedback Shift Registers (LFSRs) These are n-bit counters exhibiting pseudo-random behavior. Built from simple.
SIA: Secure Information Aggregation in Sensor Networks B. Przydatek, D. Song, and A. Perrig. In Proc. of ACM SenSys 2003 Natalia Stakhanova cs610.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Attacks on PRNGs - By Nupura Neurgaonkar CS-265 (Prof. Mark Stamp)
Recommendations for Randomness in the Operating System Henry Corrigan-Gibbs and Suman Jana Stanford University HotOS XV – 20 May
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Wired Equivalent Privacy (WEP) Chris Overcash. Contents What is WEP? What is WEP? How is it implemented? How is it implemented? Why is it insecure? Why.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
หัวข้อบรรยาย Stream cipher RC4 WEP (in)security LFSR CSS (in)security.
Cryptographic Hash Function. A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value h = H(M). The principal.
Keep the Adversary Guessing: Agent Security by Policy Randomization
Randomness.
Cryptographic hash functions
FIRST REVIEW.
Cryptographic Hash Function
Zahra Ahmadian Recursive Linear and Differential Cryptanalysis of Ultra-lightweight Authentication Protocols Zahra Ahmadian
Cryptographic Hash Functions Part I
Cryptography Lecture 4.
Cryptography Lecture 19.
Cryptography Lecture 15.
Random-Number Generation
Chapter 5: I/O Systems.
Cryptography and Network Security Chapter 7
Additional notes on random variables
Additional notes on random variables
Cryptographic Hash Functions Part I
Cryptography Lecture 4.
Analysis of the Linux Random Number Generator
Cryptography Lecture 3.
Information and Computer Security CPIS 312 Lab 4 & 5
Cryptography Lecture 15.
Presentation transcript:

Real-life cryptography Pfeiffer Alain

 Types of PRNG‘s  History  General Structure  User space  Entropy types  Initialization process  Building Blocks  Security requirements  Conclusion

 Non-cryptographic deterministic: Should not be used for security (Mersenne Twister)  Cryptographically secure: Algorithm with properties that make it suitable for the use in cryptography (Fortuna)  Entropy inputs: Produces bits non- deterministically as the internal state is frequently refreshed with unpredictable data from one or several external entropy sources (LPRNG)

 Part of the Linux Kernel since 1994  Written by Ts‘o  Modified by Mackall  +/ lines of C code

 Internal states:  Input pool (128, 32-bit words = 4096 bits)  Blocking pool (32, 32 bit words = 1024 bits)  Nonblocking pool (1024 bits)  Output function: Sha-1  Mixing function: Linear mixing function ≠ hash  Entropy Counter:  Decremented when bits are extracted  Incremented when new bits are collected

 /dev/random  Reads from blocking pool  Limits the number of generated bits  Blocked when not enough entropy  Resumed when new entropy in input pool  /dev/urandom  Reads from nonblocking  Generates random bits WITHOUT blocking  Writing the data does NOT change the entropy counter!!!  Get_random_bytes()  Kernel space  Reads random bytes from nonblocking pool

 Backbone of security  Injected:  Into generator for initialization  Through updating mechanism  Usable independently  Does NOT rely on physical non-deterministic phenomena  Hardware RNGs ▪ Available for user space ▪ NOT mixed into LPRNG  Entropy gathering daemon: ▪ Collects the outputs ▪ Feeds them into LPRNG

 Reliable Entropy:  User inputs (Keyboard, Mouse)  Disk timings  Interrupt timings are NOT reliable:  Regular interrupts  Miss-use of the „IRQF_SAMPLE_RANDOM“ flag

 „num“ value (Type of event, 32 bits)  Mouse (12 bits)  Keyboard (8 bits)  Interrupts (4 bits)  Hard drive (3 bits)  CPU „cycle“  Max: 32 bits  AVG: 15 bits  „jiffies“ count (32 bits)  Kernel counter of timer interrupts (avg. 3 – 4 Bits)  Frequency 100 – 1000 ticks/sec  The generator never assumes max entropy.

1. Unknown distribution: Inputs vary a lot 2. Unknown correlation: Correlations between inputs are likely 3. Large sample space: Hard to keep track of 2 32 Jiffies values. 4. Limited time: Estimation happens after interrupts, so they must be fast. 5. Estimation at runtime: Estimation for every input! 6. Unknown knowledge of the attacker

Not much entropy in Linux boot process!  At Shutdown:  Generates data from /dev/urandom  Save into file  At Startup:  Writes the saved data to /dev/random  Mixes the data to: ▪ Blocking pool ▪ Nonblocking pool without changing the counter!

1. Mixing Function 2. Entropy Estimator 3. Output Function 4. Entropy Extraction

  …

1. Mixes 1 byte after each other 2. Extend it to 32-bit word 3. Rotate it by Linear shifting (LFSR) into the pool  No entropy gets lost

Linear feedback shifting register (LFSR) over Galois field: GF(2 32 ) with Feedback Polynomial: Q(X) = α 3 (P(X) – 1) + 1 where  Primitive element: α  Size of the pool: P(X)  Input Pool: P(X) = X 128 +X 103 +X 76 +X 51 +X 25 +X+1  Output Pool: P(X) = X 32 +X 26 +X 20 +X 14 +X 7 +X+1  Input pool period: 2 92*32 -1 ≠ 2 128*32 -1  Output pool period: 2 26*32 -1 ≠ 2 32*32 -1

 Input Pool: P(X) = X 128 +X 103 +X 76 +X 51 +X 25 +X+1  Output Pool: P(X) = X 32 +X 26 +X 20 +X 14 +X 7 +X+1  P(X) is NOT irreducible!  But by changing one feedback position  Input Pool: P(X) = X 128 +X 104 +X 76 +X 51 +X 25 +X+1  Output Pool: P(X) = X 32 +X 26 +X 19 +X 14 +X 7 +X+1  P(X) is irreducible But NOT primitive!  However by changing α to:  α 2 (X 32 +X 26 +X 23 +X 14 +X 7 +X+1)  α 4  α 7  …  P(X) is irreducible AND primitive!  Periods: 2 128*32 -1 & 2 32*32 -1

 Function L 1 :  {0,1} 8  {0,1} 32 ▪ Rotates ▪ Multiplication in GF(2 32 )  Feedback function L 2 : ({0,1} 32 ) 5  {0,1} 32

 Random variables:  Identically distributed  Different (single) source  Sample space: D where |D| >> 2  Jiffies count: ᵹ i [1] at time i  Estimator with input T i :  Logarithm function:  Outcome:

 To compute  We must know:  Time t i-1  Jiffies count: ᵹ i-1 [1] where [1] = event 1  Jiffies count: ᵹ i-1 [2] where [2] = event 2  Property: invariant under a permutation  Permutation:  Distribution q:  Distribution p:  H(p) ≠ H(q), since it uses the value of a given element and not its probability!

 Transfer: Input pool  output pool  Generate data from output pool  Uses Sha-1 hash  Feedback phase  Extraction phase

 Sha-1  Get all pool bytes (32-bit word)  Produce 5-word hash  Send it to ▪ Mixing function ▪ Extraction phase  Mixing function  Get the 5-word hash  Mix it back  Shift 20 times (20 words = 640 bits)

 Sha-1  Initial value (Hash)  Get (16) Pool-words ▪ Overlap with last word from the feedback function ▪ Overlap with 3 first words of the output pool  Produce 5-word hash  Fold in half  Extract w 0 xor w 1 xor w 2 xor w 3 xor w 4  Produce 10 byte output

 Random Variable: X  Rényi Entropy: H 2 (X)  Hash function:  Random choice of the hash: G  IF  H 2 (X) ≥ r  G: uniformly distributed  Entropy is close to r bits

 LPRNG fixed hash function:  Assumptions:  Each element has size of  Attacker knows all permutations  Universal hash function:  If the pool contains:  k bits of Rényi entropy  m ≤ k  Entropy close to m bits:

 Sound entropy estimation:  Estimate the amount entropy correctly  Guarantee that an attacker who knows the input can NOT guess the output!  Pseudo randomness:  Impossible to compute the: ▪ Internal state ▪ Future outputs  Unable to recover: ▪ Internal state ▪ Future outputs with partial knowledge of the entropy

 Samples: N = 7M  Empirical frequency:  Estimators:  LPRNG entropy:  Shannon entropy:  Min-entropy:  Rényi entropy:  Results:

 Sha-1: one-way function  Adversary can NOT recover the content of ▪ output pool ▪ input pool if he only knows the outputs!  Folding: Avoids recognizing patterns  Output of the hash is NOT directly recognizable  Secure if the internal state is NOT compromised!

 Backtracking resistance: An attacker with knowledge of the current state should NOT be able to recover previous outputs!  Prediction resistance: An attacker should NOT be able to predict future outputs with enough future entropy inputs!

 Forward security: Knowledge of the initial state does NOT provide information on previous states. Even if the state was not refreshed by new entropy inputs.  Backtracking provided by: One-way output function  Backward security: Adversary who knows the internal state is able predict  Outputs  Future outputs because the Output function is deterministic… (Bad!)  Prediction provided by: Reseed the internal state between requests!

 Attacker knows:  Input pool  Output pool  Attacker knows the previous states EXCEPT the 160 bits which were fed back.  BUT without additional knowledge an generic attack would have: ▪ overhead ▪ 2 80 solutions

 Transferring k bits of entropy means that after:  Generating data from UNKNOWN S1  Mixing S1 to the KNOWN S2  Guessing the NEW S2 would cost on average 2 k-1 trials for the attacker!  Collecting k bits of entropy means that after:  Processing unknown data from KNOWN S1  Guessing the NEW S1 would cost on average 2 k-1 trials for the observer!

 1. Attacker:  Knows the output pool  Does NOT know the input pool  2. Attacker knows  Input pool  Output pool

Enough entropy (k >= 64 bits)?  Yes! ▪ Transferring k bits from input ▪ Attacker looses k bits of knowledge ▪ NO output before k bits are mixed  Generic attack (2 k-1 ): k bits resistance!  No! ▪ NO bits are transferred ▪ Attacker keeps knowledge ▪ NO output before k bits are sent from input  Generic attack (2 k-1 ): k bits resistance!

 //k = 64 bits  Collect k bits of entropy (2 k-1 guessings)  If (counter >= k bits) then  counter--  Else  counter++  transfer k bits from input  64 bits resistance

 Good level of security  Mixing function could be improved!  Newer hash-function could be used (Sha-3)