Hash-based Signatures
Andreas Hülsing Eindhoven University of Technology
Executive School on Post-Quantum Cryptography July 2019, TU Eindhoven
Hash-based Signatures Andreas Hlsing Eindhoven University of - - PowerPoint PPT Presentation
Hash-based Signatures Andreas Hlsing Eindhoven University of Technology Executive School on Post-Quantum Cryptography July 2019, TU Eindhoven Post-Quantum Signatures Lattice, MQ, Coding Signature and/or key sizes 2 y
Andreas Hülsing Eindhoven University of Technology
Executive School on Post-Quantum Cryptography July 2019, TU Eindhoven
Lattice, MQ, Coding Signature and/or key sizes Runtimes Secure parameters
02/07/2019 PAGE 2
... 1
3 1 4 2 3 2 2 3 2 3 4 1 2 1 2 1 1
y x x x x x x y x x x x x x y
https://huelsing.net
[Mer89]
02/07/2019 PAGE 3
Post quantum Only secure hash function Security well understood Fast
https://huelsing.net
02/07/2019 PAGE 4
Intractability Assumption Digital signature scheme Cryptographic hash function
RSA, DH, SVP, MQ, …
https://huelsing.net
(aka. keyed functions)
𝐼: {0,1}𝑜× {0,1}𝑛→ {0,1}𝑜 𝐼𝑙 𝑦 = 𝐼(𝑙, 𝑦) Require 𝑛 ≥ 𝑜 and 𝐼𝑙 𝑦 is „efficient“ 𝐼𝑙 {0,1}𝑛 {0,1}𝑜
02/07/2019 https://huelsing.net 6
𝐼: {0,1}𝑜× {0,1}𝑛→ {0,1}𝑜 𝑙 ←𝑆 {0,1}𝑜 𝑦 ←𝑆 {0,1}𝑛 𝑧𝑑 = 𝐼𝑙 𝑦 Success if 𝐼𝑙 𝑦∗ = 𝑧𝑑
𝑧𝑑, 𝑙 𝑦∗
02/07/2019 https://huelsing.net 7
𝐼: {0,1}𝑜× {0,1}𝑛→ {0,1}𝑜 𝑙 ←𝑆 {0,1}𝑜 Success if 𝐼𝑙 𝑦1
∗ = 𝐼𝑙 𝑦2 ∗ and
𝑦1
∗ ≠ 𝑦2 ∗
𝑙 (𝑦1
∗, 𝑦2 ∗)
02/07/2019 https://huelsing.net 8
𝐼: {0,1}𝑜× {0,1}𝑛→ {0,1}𝑜 𝑙 ←𝑆 {0,1}𝑜 𝑦𝑑 ←𝑆 {0,1}𝑛 Success if 𝐼𝑙 𝑦𝑑 = 𝐼𝑙 𝑦∗ and 𝑦𝑑 ≠ 𝑦∗
𝑦𝑑, 𝑙 𝑦∗
Decisional version: Does a valid response exist?
02/07/2019 https://huelsing.net 9
𝐼: {0,1}𝑜× {0,1}𝑛→ {0,1}𝑜 𝑙 ←𝑆 {0,1}𝑜 𝑐 ←𝑆 {0,1} If 𝑐 = 1 𝑦 ←𝑆 {0,1}𝑛 𝑧𝑑 ← 𝐼𝑙(𝑦) else 𝑧𝑑 ←𝑆 {0,1}𝑜
𝑧𝑑, 𝑙 𝑐*
02/07/2019 https://huelsing.net 10
If 𝑐 = 1 𝑙 ←𝑆 {0,1}𝑜 = 𝐼𝑙 Else ←𝑆 𝐺
𝑛,𝑜
𝐼: {0,1}𝑜× {0,1}𝑛→ {0,1}𝑜
1𝑜 g 𝑐 𝑦 𝑧 = (𝑦) 𝑐*
02/07/2019 https://huelsing.net 11
looking at internals)
considered insecure
02/07/2019 https://huelsing.net 12
Classically:
𝑇𝑣𝑑𝑑𝐵
𝑃𝑋 = 1
2𝑜
𝑇𝑣𝑑𝑑𝐵
𝑃𝑋 = 2 2𝑜
guess 𝑇𝑣𝑑𝑑𝐵
𝑃𝑋 = 𝑟+1 2𝑜
Θ(2𝑜)
02/07/2019 https://huelsing.net 13
Quantum:
Θ(2𝑜/2)
(Disclaimer: Currently only proof for 2𝑛 ≫ 2𝑜)
02/07/2019 https://huelsing.net 14
OW SPR CR UD* PRF* Classical Θ(2𝑜) Θ(2𝑜) Θ(2𝑜/2) Θ(2𝑜) Θ(2𝑜) Quantum Θ(2𝑜/2) Θ(2𝑜/2) Θ(2𝑜/3) Θ(2𝑜/2) Θ(2𝑜/2)
* conjectured, no proof
02/07/2019 https://huelsing.net 15
02/07/2019 16
Collision-Resistance 2nd-Preimage- Resistance One-way Pseudorandom
Assumption / Attacks
stronger / easier to break weaker / harder to break
https://huelsing.net
02/07/2019 17
2004 2005 2008
MD5
Collisions (theo.)
SHA1
Collisions (theo.)
MD5
Collisions (practical!) 2017
MD5 & SHA-1
No (Second-) Preimage Attacks!
SHA1
Collisions (practical!)
https://huelsing.net
Message M = b1,…,bm, OWF H = n bit SK PK Sig
02/07/2019
sk1,0 sk1,1 skm,0 skm,1 pk1,0 pk1,1 pkm,0 pkm,1
H H H H H H
sk1,b1 skm,bm * Mux b1 Mux b2 Mux bm
https://huelsing.net 19
𝑞𝑙, 1𝑜 SIGN 𝑡𝑙 𝑁 (𝜏, 𝑁) (𝜏∗, 𝑁∗) Success if 𝑁∗ ≠ 𝑁 and Verify 𝑞𝑙, 𝜏∗, 𝑁∗ = Accept
02/07/2019 https://huelsing.net 20
Theorem: If H is one-way then LD-OTS is one-time eu-cma- secure.
02/07/2019 https://huelsing.net 21
02/07/2019 22
OTS
OTS OTS OTS OTS OTS OTS OTS H H H H H H H H H H H H H H H PK
SIG = (i=2, , , , , )
OTS
SK
https://huelsing.net
Theorem: MSS is eu-cma-secure if OTS is a one-time eu-cma secure signature scheme and H is a random element from a family of collision resistant hash functions.
02/07/2019 https://huelsing.net 23
02/07/2019 https://huelsing.net 24
Message M = b1,…,bm, OWF H = n bit SK PK Sig
sk1,0 sk1,1 skm,0 skm,1 pk1,0 pk1,1 pkm,0 pkm,1
H H H H H H
sk1,b1 skm,bm *
Mux
b1
Mux
b2
Mux
bn
02/07/2019 https://huelsing.net 25
Verification:
We can do better!
SIG = (i=2, , , , , )
02/07/2019 https://huelsing.net 26
Message M = b1,…,bm, OWF H = n bit
sk1,0 sk1,1 skm,0 skm,1 pk1,0 pk1,1 pkm,0 pkm,1
H H H H H H
sig1,0 *
Mux
b1 sig1,1
Mux
¬b1 sigm,0
Mux
bm sigm,1
Mux
¬bm
Sig PK SK
02/07/2019 https://huelsing.net 27
Verification:
Steps 1 + 2 together verify
SIG = (i=2, , , , , )
02/07/2019 https://huelsing.net 28
Message M = b1,…,bm, OWF H SK: sk1,…,skm,skm+1,…,sk2m PK: H(sk1),…,H(skm),H(skm+1),…,H(sk2m) Encode M: M‘ = M||¬M = b1,…,bm,¬b1,…,¬bm (instead of b1, ¬b1,…,bm,¬bm ) ski , if bi = 1 Sig: sigi = H(ski) , otherwise
Checksum with bad performance!
02/07/2019 https://huelsing.net 29
Message M = b1,…,bm, OWF H SK: sk1,…,skm,skm+1,…,skm+1+log m PK: H(sk1),…,H(skm),H(skm+1),…,H(skm+1+log m) Encode M: M‘ = b1,…,bm,¬ 1
𝑛 𝑐𝑗
ski , if bi = 1 Sig: sigi = H(ski) , otherwise IF one bi is flipped from 1 to 0, another bj will flip from 0 to 1
02/07/2019 https://huelsing.net 30
Function family: 𝐼: {0,1}𝑜× {0,1}𝑜→ {0,1}𝑜 𝑙 ←𝑆 {0,1}𝑜 Parameter 𝑥 Chain: 𝑑𝑗 𝑦 = 𝐼 𝑑𝑗−1 𝑦 = 𝐼 ∘ 𝐼 ∘ ⋯ ∘ 𝐼(𝑦)
c0(x) = x 𝑑1(𝑦) = 𝐼𝑙(𝑦) 𝒅𝒙−𝟐(𝑦)
i-times
02/07/2019 https://huelsing.net 31
Winternitz parameter w, security parameter n, message length m, function family ℎ Key Generation: Compute 𝑚, sample 𝐼𝑙
c0(skl ) = skl c1(skl ) pkl = cw-1(skl ) c0(sk1) = sk1 c1(sk1) pk1 = cw-1(sk1)
02/07/2019 https://huelsing.net 32
M b1 b2 b3 b4
… … … … … … …
bm‘
bm‘+1 bm‘+2
… … bl C c0(skl ) = skl pkl = cw-1(skl ) c0(sk1) = sk1 pk1 = cw-1(sk1) σ1=cb1(sk1) σl =cbl (skl )
Signature: σ = (σ1, …, σl )
02/07/2019 https://huelsing.net 33
b1 b2 b3 b4
… … … … … … …
bm‘
bm‘+1 bl 1+2
… … bl pkl pk1
Signature: σ = (σ1, …, σl )
σ1 σl 𝒅𝟐 (σ1) 𝒅𝟑(σ1) 𝒅𝟒(σ1) 𝒅𝒙−𝟐−𝒄𝟐 (σ1) 𝒅𝒙−𝟐−𝒄𝒎 (σl )
=? =?
Verifier knows: M, w
02/07/2019 https://huelsing.net 34
For 𝑦 ∈ 0,1 𝑜 define 𝑑0 𝑦 = 𝑦 and
𝑗)
02/07/2019 https://huelsing.net 35
Theorem (informally):
W-OTS is strongly unforgeable under chosen message attacks if 𝐼 is a collision resistant family of undetectable one-way functions. W-OTS+ is strongly unforgeable under chosen message attacks if 𝐼 is a 2nd-preimage resistant family of undetectable one-way functions. W-OTS+ is strongly unforgeable under chosen message attacks if 𝐼 is a 2nd-preimage resistant and decisional 2nd-preimage resistant family of functions.
02/07/2019 https://huelsing.net 36
Tree: Uses bitmasks Leafs: Use binary tree with bitmasks OTS: WOTS+ Message digest: Randomized hashing Collision-resilient
H
bi
H
02/07/2019 https://huelsing.net 38
Uses multiple layers of trees
(= Building first tree on each layer)
Θ(2ℎ) → Θ(𝑒 ⋅ 2ℎ/𝑒)
worst-case signing times Θ(ℎ/2) → Θ(ℎ/2𝑒)
02/07/2019 https://huelsing.net 39
be one-way
(w=16) leads > 260 ∙ 67 ≈ 266 images.
forgery (at least massively reduces complexity)
probability Θ
𝑟 2𝑜−66 conventional
and Θ
𝑟2 2𝑜−66 quantum
quantum)
https://huelsing.net 41 02/07/2019
[HRS16]
description and „input“ take
(uniqueness in key pair)
(uniqueness among key pairs)
02/07/2019 https://huelsing.net 42
[HRS16]
description and „input“ take
(uniqueness in key pair)
(uniqueness among key pairs)
02/07/2019 https://huelsing.net 43
𝐔𝐢 𝑄, 𝑈, 𝑁 → 𝑁𝐸 P: Public parameters (one per key pair) T: Tweak (one per hash call) M: Message MD: Message Digest Security properties are determined by instantiation
27.06.2019 https://huelsing.net 44
security
secure
02/07/2019 https://huelsing.net 46
XMSS SS / / XMSS SS-T Im Imple lementatio ion
C Implementation, using OpenSSL [HRS16]
Sign (ms) Signature (kB) Public Key (kB) Secret Key (kB) Bit Security classical/ quantum Comment
XMSS 3.24 2.8 1.3 2.2 236 / 118 h = 20, d = 1, XMSS-T 9.48 2.8 0.064 2.2 256 / 128 h = 20, d = 1 XMSS 3.59 8.3 1.3 14.6 196 / 98 h = 60, d = 3 XMSS-T 10.54 8.3 0.064 14.6 256 / 128 h = 60, d = 3
Intel(R) Core(TM) i7 CPU @ 3.50GHz XMSS-T uses message digest from Internet-Draft All using SHA2-256, w = 16 and k = 2
02/07/2019 https://huelsing.net 47
02/07/2019 https://huelsing.net 48
XMSS
BM = SHA2(pad(PP)||TW+1), MD= SHA2(pad(K)||MSG ⊕ BM)
were random,
& BM as above (modeling those SHA2 invocations as RO)
revision
LMS
SHA2 is QRO
compression function is RO
27.06.2019 https://huelsing.net 49
signatures at same security level
the security properties of the used hash function
27.06.2019 https://huelsing.net 50
... back-up ... multi-threading ... load-balancing
02/07/2019 https://huelsing.net 52
[NY89,Gol87,Gol04]
Goldreich’s approach [Gol04]: Security parameter 𝜇 = 128 Use binary tree as in Merkle, but...
collisions (e.g., height h = 2𝜇 = 256).
(= Hypertree with 𝑒 = ℎ),
generated pseudorandomly.
02/07/2019 PAGE 54
OTS OTS OTS OTS OTS OTS OTS OTS OTS
https://huelsing.net
leaves to sign messages
02/07/2019 https://huelsing.net 55
Message M = b1,…,bn, OWF H = n bit SK PK Sig
02/07/2019 57
sk1,0 sk1,1 skn,0 skn,1 pk1,0 pk1,1 pkn,0 pkn,1
H H H H H H
sk1,b1 skn,bn * Mux b1 Mux b2 Mux bn
https://huelsing.net
Message M, OWF H, CRHF H’ = n bit Parameters t=2a,k, with m = ka (typical a=16, k=32) SK PK
02/07/2019 58
sk1 sk2 skt-1 skt pk1 pk1 pkt-1 pkt
H H H H H H
*
https://huelsing.net
Message M, OWF H, CRHF H’ = n bit Parameters t=2a,k, with m = ka (typical a=16, k=32)
02/07/2019 59
b1 b2 ba
bar
M H’
i1 ik
*
https://huelsing.net
Message M, OWF H, CRHF H’ = n bit Parameters t=2a,k, with m = ka (typical a=16, k=32)
02/07/2019 60
sk1 sk2 skt-1 skt pk1 pk1 pkt-1 pkt
H H H H H H
* b1 b2 ba ba+1 bka-2 bka-1
bka
i1 ik
ski1 skik Mux Mux
SK PK
H’(M)
https://huelsing.net
𝑘 𝑗 for 𝑠
messages 𝑛𝑡𝑘, 1 ≤ 𝑘 ≤ 𝑠, hard to find 𝑛𝑡𝑠+1 ≠ 𝑛𝑡𝑘 such that 𝑁𝑠+1
𝑗
∈ ⋃1 ≤𝑘≤𝑠𝑁
𝑘 𝑗.
𝑠𝑙 𝑢 𝑙
→ Security shrinks with each signature!
02/07/2019 61 https://huelsing.net
Using HORS with MSS requires adding PK (tn) to MSS signature. HORST: Merkle Tree on top of HORS-PK
02/07/2019 63 https://huelsing.net
+ (pseudo-)random index
02/07/2019 https://huelsing.net 64
Joint work with Jean-Philippe Aumasson, Daniel J. Bernstein, Christoph Dobraunig, Maria Eichlseder, Scott Fluhrer, Stefan-Lukas Gazdag, Panos Kampanakis, Stefan Kölbl, Tanja Lange, Martin M. Lauridsen, Florian Mendel, Ruben Niederhagen, Christian Rechberger, Joost Rijneveld, Peter Schwabe
66
https://huelsing.net
02/07/2019
68
... ... ... ... ...
https://huelsing.net
02/07/2019
(and optionally non-deterministic randomness)
(idx||𝐒) = 𝑄𝑆𝐺(𝐓𝐋. prf, 𝑁) md = 𝐼msg (𝐒, PK, 𝑁)
𝐒 = 𝑄𝑆𝐺(𝐓𝐋. prf, OptRand, 𝑁) (md||idx) = 𝐼msg (𝐒, PK, 𝑁)
69 02/07/2019 https://huelsing.net
Improves FORS security
Attacks can target „weakest“ HORST key pair
Every hash query also selects FORS key pair
70 02/07/2019 https://huelsing.net
71 02/07/2019
NEW! NEW! NEW!
https://huelsing.net
72 02/07/2019 https://huelsing.net
02/07/2019 https://huelsing.net 73
02/07/2019 https://huelsing.net 74
Thanks to the Fish/Picnic team for slides
02/07/2019 https://huelsing.net 75
02/07/2019 https://huelsing.net 76
02/07/2019 https://huelsing.net 77
with low #AND-gates
(Fish), or
QROM (Picnic)
02/07/2019 https://huelsing.net 78
available with XMSS & LMS
SPHINCS+ & Picnic in second round
02/07/2019 https://huelsing.net 79
For references & further literature see https://huelsing.net/wordpress/?page_id=165
02/07/2019 https://huelsing.net 80
(Mer89)
L0 L1 L2 L3 . . . L7
= h
v = h = 3 v = 2 v = 1 v = 0
02/07/2019 https://huelsing.net 83
TreeHash(v,i) 1: Init Stack, N1, N2 2: For j = i to i+2v-1 do 3: N1 = LeafCalc(j) 4: While N1.level() == Stack.top().level() do 5: N2 = Stack.pop() 6: N1 = ComputeParent( N2, N1 ) 7: Stack.push(N1) 8: Return Stack.pop()
02/07/2019 https://huelsing.net 84
Li Li+1 . . . Li+2v-1
TreeHash(v,i)
02/07/2019 https://huelsing.net 85
Eff ffici iciency?
Key generation: Every node has to be computed once. cost = 2h leaves + 2h-1 nodes => optimal Signature: One node on each level 0 <= v < h. cost 2h-1 leaves + 2h-1-h nodes. Many nodes are computed many times! (e.g. those on level v=h-1 are computed 2h-1 times)
02/07/2019 https://huelsing.net 86
[BDS08]
Motiv tivatio ion
(fo (for all ll Tre ree Tra raversal Algo lgorit ithms) No Storage: Signature: Compute one node on each level 0 <= v < h. Costs: 2h-1 leaf + 2h-1-h node computations. Example: XMSS with SHA2-256 and h = 20
Store whole tree: 2hn bits. Example: h=20, n=256; storage: 228bits = 32MB Idea: Look for time-memory trade-off!
02/07/2019 https://huelsing.net 88
02/07/2019 https://huelsing.net 89
02/07/2019 https://huelsing.net 90
Observatio ion 1
Same node in authentication path is recomputed many times! Node on level v is recomputed for 2v successive paths. Idea: Keep authentication path in state.
Result Storage: h nodes Time: ~ h leaf + h node computations (average) But: Worst case still 2h-1 leaf + 2h-1-h node computations!
02/07/2019 https://huelsing.net 91
Observatio ion 2
When new left node in authentication path is needed, its children have been part
02/07/2019 https://huelsing.net 92
i
) 1 ( i A
) 2 1 (
1
v
i A
v = 2
02/07/2019 https://huelsing.net 93
Resu sult lt
Storing nodes all left nodes can be computed with one node computation / node
2 h
02/07/2019 https://huelsing.net 94
Observatio ion 3
Right child nodes on high levels are most costly. Computing node on level v requires 2v leaf and 2v-1 node computations. Idea: Store right nodes on top k levels during key generation. Result Storage: 2k-2 n bit nodes Time: ~ h-k leaf + h-k node computations (average) Still: Worst case 2h-k-1 leaf + 2h-k-1-(h-k) node computations!
02/07/2019 https://huelsing.net 95
02/07/2019 https://huelsing.net 96
In Intu tuit itio ion
Observation:
Idea: Distribute computation to achieve average runtime in worst case. Focus on distributing computation of leaves
02/07/2019 https://huelsing.net 97
TreeHash.init(v,i) 1: Init Stack, N1, N2, j=i, j_max = i+2v-1 2: Exit TreeHash.update() 1: If j <= j_max 2: N1 = LeafCalc(j) 3: While N1.level() == Stack.top().level() do 5: N2 = Stack.pop() 6: N1 = ComputeParent( N2, N1 ) 7: Stack.push(N1) 8: Set j = j+1 9: Exit
One leaf per update
02/07/2019 https://huelsing.net 98
Dist istrib ibute Co Computatio ion
Concept
part of authentication path.
02/07/2019 https://huelsing.net 99
Dist istrib ibute Co Computatio ion
Worst Case Runtime Before: 2h-k-1 leaf and 2h-k-1-(h-k) node computations. With distributed computation: (h-k)/2 + 1 leaf and 3(h-k-1)/2 + 1 node computations.
Single stack of size h-k nodes for all TreeHash instances. + One node per TreeHash instance. = 2(h-k) nodes
02/07/2019 https://huelsing.net 100
BD BDS S Perf rform rmance
Storage:
n bit nodes
Runtime:
(h−k)/2+1 leaf and 3(h−k−1)/2+1 node computations.
k
k h h 2 2 3 2 3
02/07/2019 https://huelsing.net 101