PQWire Guard
PQWire Guard
1
“Cryptographically opinionated”
• No “crypto agility”
• Fixed suite of cryptographic primitives:
• X25519 as Diffie-Hellman routine
• ChaCha20-Poly1305 as AEAD
• Blake2s for hashing and keyed hashing
• HKDF for key derivation
2
“Cryptographically opinionated”
• No “crypto agility”
• Fixed suite of cryptographic primitives:
• X25519 as Diffie-Hellman routine
• ChaCha20-Poly1305 as AEAD
• Blake2s for hashing and keyed hashing
• HKDF for key derivation
• Focus today: the WireGuard handshake
• Authenticate parties to each other
• Establish a session key to encrypt payload data
2
“Cryptographically opinionated”
• No “crypto agility”
• Fixed suite of cryptographic primitives:
• X25519 as Diffie-Hellman routine
• ChaCha20-Poly1305 as AEAD
• Blake2s for hashing and keyed hashing
• HKDF for key derivation
• Focus today: the WireGuard handshake
• Authenticate parties to each other
• Establish a session key to encrypt payload data
2
Diffie-Hellman reminder
Alice Bob
A ← ga B ← gb
3
Diffie-Hellman reminder
3
4
“In the past, people have said, maybe it’s 50 years away, it’s a dream,
maybe it’ll happen sometime. I used to think it was 50. Now I’m thinking
like it’s 15 or a little more. It’s within reach. It’s within our lifetime. It’s
going to happen.”
—Mark Ketchen (IBM), Feb. 2012, about quantum computers
5
Post-quantum crypto
Definition
Post-quantum crypto is (asymmetric) crypto that resists attacks using
classical and quantum computers.
6
Post-quantum crypto
Definition
Post-quantum crypto is (asymmetric) crypto that resists attacks using
classical and quantum computers.
5 main directions
• Lattice-based crypto (PKE and Sigs)
• Code-based crypto (mainly PKE)
• Multivariate-based crypto (mainly Sigs)
• Hash-based signatures (only Sigs)
• Isogeny-based crypto (so far, mainly PKE)
6
NISTPQC
7
State of NIST PQC
8
State of NIST PQC
8
State of NIST PQC
8
State of NIST PQC
8
State of NIST PQC
8
What now?
9
What now?
9
What now?
9
What now?
. . . or is it?
9
The WireGuard handshake (basic idea: “4DH”)
10
The WireGuard handshake (high-level)
Initiator Responder
1: (eski , epki ) ← DH.Gen()
2:
$
sidi ← {0, 1}32
3: ltk ← AEAD.Enc(κ3 , 0, spki , H3 )
4: now ← Timestamp()
5: time ← AEAD.Enc(κ4 , 0, H4 , now)
6: m1 ← MAC(H(lbl3 ∥ spkr ), type ∥ 03 ∥ sidi ∥ epki ∥ ltk ∥ time)
7: m2 ← MAC(cookie, type ∥ 03 ∥ sidi ∥ epki ∥ ltk ∥ time ∥ m1)
8: InitHello ← type ∥ 03 ∥ sidi ∥ epki ∥ ltk ∥ time ∥ m1 ∥ m2
InitHello
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→
RespHello
←−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
• Key confidentiality
• Entity authentication
12
Handshake security
• Key confidentiality
• Entity authentication
• Key uniqueness
• Identity hiding
• Replay attack resistance
• Unknown key-share (UKS) attack resistance
• DoS attack resistance (early reject)
12
WireGuard security proofs
13
Post-quantum security of WireGuard
14
PQ-WireGuard – our goals
15
PQ-WireGuard – our goals
15
PQ-WireGuard – the idea
16
Diffie-Hellman
Alice Bob
A ← ga B ← gb
17
Diffie-Hellman
Alice Bob
A ← ga B ← gb
17
KEMs: as close as you’ll get to DH
Initiator Responder
pk
(ct, K) ← KEM.Enc(pk)
ct
K ← KEM.Dec(ct, sk)
18
KEMs: as close as you’ll get to DH∗
Initiator Responder
pk
(ct, K) ← KEM.Enc(pk)
ct
K ← KEM.Dec(ct, sk)
18
What can KEMs (not) do?
Initiator Responder
19
A first approach with KEMs
Initiator Responder
epk , c1
−−−−−−−−−−−−−−−−−−−−−−−−−i −−−−−−−−−−−−−−−−−−−−−−−→
c2 , c3
←−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
k1 ← CCAKEM.Dec(sskr , c1 )
k2 ← CCAKEM.Dec(sski , c2 )
k3 ← CPAKEM.Dec(eski , c3 )
20
What are we lacking?
DoS resistance
• First initiator message is unauthenticated
• Solution: Use (optional) pre-shared key for early rejects
21
What are we lacking?
DoS resistance
• First initiator message is unauthenticated
• Solution: Use (optional) pre-shared key for early rejects
“MEX” resistance
• Some security also if all RNGs are insecure
• Static-static DH for confidentiality from long-term keys
• Solution: Use “NAXOS trick”
21
What are we lacking?
DoS resistance
• First initiator message is unauthenticated
• Solution: Use (optional) pre-shared key for early rejects
“MEX” resistance
• Some security also if all RNGs are insecure
• Static-static DH for confidentiality from long-term keys
• Solution: Use “NAXOS trick”
UKS-attack resistance
• WireGuard does not hash public keys into session key
• UKS resistance derived from static-static DH
• Solution: Use default PSK as H(spki ⊕ spkr )
21
(Most of) the PQ-WireGuard handshake
Initiator Responder
1: (eski , epki ) ← CPAKEM.Gen()
2: sidi ← {0, 1}32
$
3: ri ← {0, 1}λ
4: (ct1, shk1) ← CCAKEM.Enc(spkr , KDF1 (σi , ri ))
5: ltk ← AEAD.Enc(κ3 , 0, H(spki ), H3 )
6: now ← Timestamp()
7: time ← AEAD.Enc(κ4 , 0, H4 , now)
8: m1 ← MAC(H(lbl3 ∥ spkr ), type ∥ 03 ∥ sidi ∥ epki ∥ ct1 ∥ ltk ∥ time)
9: m2 ← MAC(cookie, type ∥ 03 ∥ sidi ∥ epki ∥ ct1 ∥ ltk ∥ time ∥ m1)
10: InitHello ← type ∥ 03 ∥ sidi ∥ epki ∥ ct1 ∥ ltk ∥ time ∥ m1 ∥ m2
InitHello
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→
Initiator Responder
19: conf ← AEAD.Enc(κ10 , 0, H10 , ∅)
20: m1 ← MAC(H(lbl3 ∥ spkr ), type ∥ 03 ∥ sidi ∥ sidr ∥ conf)
21: m2 ← MAC(cookie, type ∥ 03 ∥ sidi ∥ sidr ∥ conf ∥ m1)
22: InitConf ← type ∥ 03 ∥ sidi ∥ sidr ∥ conf ∥ m1 ∥ m2
InitConf
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→
23
PQ-WireGuard security proofs
• Computational:
• Based on Dowling and Paterson (2018)
• Proof in the eCK-PFS-PSK model
• Standard model proof
• Symbolic:
• Based on Donenfeld and Milner (2017)
• Uses the Tamarin prover
• Cover all desired security properties
24
Instantiation
25
Instantiation
25
Instantiation
25
Dagger
26
Dagger
26
Dagger
26
Implementation and Evaluation
27
Implementation and Evaluation
27
Implementation and Evaluation
27
Results
28
More online
Paper:
https://cryptojedi.org/papers/#pqwireguard
Code:
https://cryptojedi.org/crypto/#pqwireguard
29