43
SipHash: a fast short-input PRF Jean-Philippe Aumasson, Daniel J. Bernstein

SipHash: a fast short-input PRF - Aumasson

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SipHash: a fast short-input PRF - Aumasson

SipHash: a fast short-input PRF

Jean-Philippe Aumasson, Daniel J. Bernstein

Page 2: SipHash: a fast short-input PRF - Aumasson

SipHash: a fast short-input MAC

Jean-Philippe Aumasson, Daniel J. Bernstein

Page 3: SipHash: a fast short-input PRF - Aumasson

UMAC (Black, Halevi, Krawczyk, Krovetz, Rogaway; 2000)

http://fastcrypto.org/umac/update.pdf

1 cycle/byte on a Pentium III !

Page 4: SipHash: a fast short-input PRF - Aumasson

UMAC(m) = H(k1, m) ⊕ AES(k2, n)

Page 5: SipHash: a fast short-input PRF - Aumasson

UMAC’s universal hash

Polynomial-evaluation using 64-bit multipliers with Horner’s rule

Page 6: SipHash: a fast short-input PRF - Aumasson

UMAC fast C implementation

2000+ LoC

(without AES)

Not portable

Page 7: SipHash: a fast short-input PRF - Aumasson

http://fastcrypto.org/umac/2004/src/umac.c

Page 8: SipHash: a fast short-input PRF - Aumasson

UMAC uses a PRG to expand the key to 33280 bits

Page 9: SipHash: a fast short-input PRF - Aumasson

RFC4418 replaces UMAC’s PRG with an AES-based KDF...

Page 10: SipHash: a fast short-input PRF - Aumasson

… and uses AES and this KDF in a “Pad-Derivation Function”

Page 11: SipHash: a fast short-input PRF - Aumasson

Not so simple

Page 12: SipHash: a fast short-input PRF - Aumasson

SipHash

Simple ARX round function

Simple JH-like message injection

No key expansion

No external primitive

No state between messages

Page 13: SipHash: a fast short-input PRF - Aumasson

SipHash initialization

256-bit state v0 v1 v2 v3

128-bit key k0 k1

v0 = k0 ⊕ 736f6d6570736575

v1 = k1 ⊕ 646f72616e646f6d

v2 = k0 ⊕ 6c7967656e657261

v3 = k1 ⊕ 7465646279746573

Page 14: SipHash: a fast short-input PRF - Aumasson

SipHash initialization

256-bit state v0 v1 v2 v3

128-bit key k0 k1

v0 = k0 ⊕ “somepseu”

v1 = k1 ⊕ “dorandom”

v2 = k0 ⊕ “lygenera”

v3 = k1 ⊕ “tedbytes”

Page 15: SipHash: a fast short-input PRF - Aumasson

SipHash compression

Message parsed as 64-bit words m0, m1, …

v3 ⊕= m0

c iterations of SipRound

v0 ⊕= m0

Page 16: SipHash: a fast short-input PRF - Aumasson

SipHash compression

Message parsed as 64-bit words m0, m1, …

v3 ⊕= m1

c iterations of SipRound

v0 ⊕= m1

Page 17: SipHash: a fast short-input PRF - Aumasson

SipHash compression

Message parsed as 64-bit words m0, m1, …

v3 ⊕= m2

c iterations of SipRound

v0 ⊕= m2

Page 18: SipHash: a fast short-input PRF - Aumasson

SipHash compression

Message parsed as 64-bit words m0, m1, …

Etc.

Page 19: SipHash: a fast short-input PRF - Aumasson

SipRound

Page 20: SipHash: a fast short-input PRF - Aumasson

SipHash finalization

v2 ⊕= 255

d iterations of SipRound

Return v0 ⊕ v1 ⊕ v2 ⊕ v3

Page 21: SipHash: a fast short-input PRF - Aumasson

SipHash-2-4 hashing 15 bytes

Page 22: SipHash: a fast short-input PRF - Aumasson

Family SipHash-c-d

Fast proposal: SipHash-2-4

Conservative proposal: SipHash-4-8

Weaker versions for cryptanalysis:

SipHash-1-0, SipHash-2-0, etc.

SipHash-1-1, SipHash-2-1, etc.

Etc.

Page 23: SipHash: a fast short-input PRF - Aumasson

(Many) short inputs?

Page 24: SipHash: a fast short-input PRF - Aumasson
Page 25: SipHash: a fast short-input PRF - Aumasson

Hash tables

h = {} # empty table

h[‘foo’] = ‘bar’ # insert ‘bar’

Print h[‘foo’] # lookup

Non-crypto functions to produce ‘foo’:

for (; nKeyLength > 0; nKeyLength -=1) {

hash = ((hash << 5) + hash) + *arKey++;

}

Page 26: SipHash: a fast short-input PRF - Aumasson

Hash flooding attacks

Multicollisions forcing worst-case complexity of Θ(n2), instead of Θ(n)

[when table implemented as linked lists]

Page 27: SipHash: a fast short-input PRF - Aumasson

djbdns/cache.c, 1999

Page 28: SipHash: a fast short-input PRF - Aumasson

USENIX 2003

Vulnerabilities in Perl, web proxy, IDS

Page 29: SipHash: a fast short-input PRF - Aumasson

CCC 2011

Affected: PHP, ASP.net, Python, etc.

Page 30: SipHash: a fast short-input PRF - Aumasson
Page 31: SipHash: a fast short-input PRF - Aumasson

How short?

OpenDNS cache: 27 bytes on average

Ruby on Rails web application: <20 bytes

Page 32: SipHash: a fast short-input PRF - Aumasson

Why SipHash?

Minimizes hash flooding

→ impact limited to sqrt(communication)

Well-defined security goal (PRF)

Competitive in speed with non-crypto hashes

Page 33: SipHash: a fast short-input PRF - Aumasson

How fast?

SipHash-2-4 on an AMD Athlon II Neo

Long data: 1.44 cycles/byte

Byte length 8 16 32 64

Cycles (per byte)

123 (15.38)

134 (8.38)

158 (4.25)

204 (3.19)

Page 34: SipHash: a fast short-input PRF - Aumasson
Page 35: SipHash: a fast short-input PRF - Aumasson
Page 36: SipHash: a fast short-input PRF - Aumasson

amd64; K10 45nm; 2010 AMD Phenom II X6 1090T

Page 37: SipHash: a fast short-input PRF - Aumasson

x86; K10 45nm; 2010 AMD Phenom II X6 1090T

Page 38: SipHash: a fast short-input PRF - Aumasson

Cryptanalysis

Page 39: SipHash: a fast short-input PRF - Aumasson

Generic attacks

≈ 2128 key recovery

≈ 2192 state recovery

≈ 2128 internal-collision forgeries

≈ 2s forgery attack with success probability 2s-64

Page 40: SipHash: a fast short-input PRF - Aumasson

Characteristic verified with ARXtools

http://www.di.ens.fr/~leurent/arxtools.html

Page 41: SipHash: a fast short-input PRF - Aumasson

Proof of insecurity

SipRound( 0 ) = 0

That is, SipRound is not ideal

Therefore SipHash is insecure

Page 42: SipHash: a fast short-input PRF - Aumasson

Proof of simplicity

June 20: paper published online

June 28: 18 third-party implementations

C (Floodyberry, Boßlet, Neves); C# (Haynes) Cryptol (Lazar); Erlang, Javascript, PHP (Denis) Go (Chestnykh); Haskell (Hanquez); Java, Ruby (Boßlet); Lisp (Brown);

Page 43: SipHash: a fast short-input PRF - Aumasson

More on SipHash: http://131002.net/siphash

Thanks to all implementers!