Transcript
Page 1: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Lecture 4 – Message authentication, UF-CMA,

CBC-MAC, CMAC

TEK4500

15.09.2020

HΓ₯kon Jacobsen

[email protected]

Page 2: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

What is cryptography?

2

InternetAlice

Bob

M

AdversarySecurity goals:

β€’ Data privacy: adversary should not be able to read message M

Page 3: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

What is cryptography?

3

InternetAlice

Bob

M

AdversarySecurity goals:

β€’ Data privacy: adversary should not be able to read message M

β€’ Data integrity: adversary should not be able to modify message M

β€’ Data authenticity: message M really originated from Alice

M'

Page 4: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Basic goals of cryptography

4

Message privacyMessage integrity /

authentication

Symmetric keys Symmetric encryptionMessage authentication

codes (MAC)

Asymmetric keys

Asymmetric encryption

(a.k.a. public-key

encryption)

Digital signatures

Page 5: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Motivation

β€’ Goal: integrity, but not privacy

β€’ Examples:

β€’ Protecting OS system files against tampering

β€’ Browser cookies stored by web servers

β€’ Control signals in network management

5

Page 6: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Encryption β‰  integrity

6

"Send Bob $10"

Page 7: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Encryption β‰  integrity

7

0001110 0100 100101101100

1001010 1010 000000001010

1000100 1110 100101100110

"Bob""Send" "$10"

CTR. Dec(𝐾,β‹…)CTR. Enc(𝐾,β‹…)

Page 8: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Encryption β‰  integrity

8

1000100 1110 100101100110

0001110 0100 011001101100

0001110 0100 100101101100

"Send"

"Bob"

"$3850"

"Send" "$10"

"Bob"

CTR. Dec(𝐾,β‹…)CTR. Enc(𝐾,β‹…)

1001010 1010 000000001010

1001010 1010 111100001010

Page 9: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Message authentication – idea

9

𝑀 𝑇

Generate tag 𝑇

𝑀

Verify message-tag pair 𝑀,𝑇

𝑀

Sender Receiver

INVALID

VALID

βŠ₯

Page 10: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Authentication from error-checking codes

10

𝑀 𝑇

𝑇 ← CRC32(𝑀) 𝑇′ ← CRC32(𝑀)

𝑇′ =?𝑇

𝑀

Sender Receiver

𝑀

Page 11: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Keyless message integrity doesn't work

11

𝑀 𝑇

𝑇 ← CRC32(𝑀) 𝑇′ ← CRC32(𝑀′)

𝑇′ =?𝑇

𝑀′

Sender Receiver

𝑀′ 𝑇′

𝑇′ ← CRC32(𝑀′)

𝑀

Page 12: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Message authentication schemes – syntax

β€’ A message authentication scheme Ξ£ = KeyGen, Tag, Vrfy consists of three

algorithms:

β€’ Associated to Ξ£:

β€’ Key space 𝒦

β€’ Message space β„³

β€’ Tag space 𝒯

β€’ KeyGen and Tag may be randomized ($), but Vrfy must be deterministic12

Tag𝑀,𝑇

𝑀 1 / 0

(VALID/INVALID)

KeyGen

Vrfy$

𝐾

$

Correctness requirement: For all

𝐾 ← KeyGen and all 𝑀 ∈ β„³

Vrfy 𝐾,𝑀, Tag 𝐾,𝑀 = 1

Page 13: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

UF-CMA – Unforgability against chosen-message attacks

13

𝑀1, 𝑀2, …

𝑇1, 𝑇2, …

Tag(𝐾,β‹…)

𝑀1β€² , 𝑇1

β€² , 𝑀2β€² , 𝑇2

β€² , …

1/0, 1/0, …

VF(𝐾,β‹…,β‹…)

Challenger

Adversary wins if a pair 𝑀𝑖′, 𝑇𝑖

β€² is valid,

and was not among the pairs 𝑀1, 𝑇1 , 𝑀2, 𝑇2 , …

Page 14: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

UF-CMA – Unforgability against chosen-message attacks

14

Definition: The UF-CMA-advantage of an

adversary 𝐴 is

𝐀𝐝𝐯Σuf–cma 𝐴 = Pr 𝐄𝐱𝐩Σ

uf–cma 𝐴 β‡’ 1

𝑀1, 𝑀2, …

𝑇1, 𝑇2, …

Tag(𝐾,β‹…)

𝑀1β€² , 𝑇1

β€² , 𝑀2β€² , 𝑇2

β€² , …

1/0, 1/0, …

VF(𝐾,β‹…,β‹…)

Challenger 𝐄𝐱𝐩Σuf–cma 𝐴

1. 𝐾←$Ξ£. KeyGen

2. 𝑆 ← [ ]3. π‘€π‘œπ‘› ← 0

4. 𝐴Tag𝐾 β‹… , VF𝐾(β‹…,β‹…)

5. return π‘€π‘œπ‘›

Tag𝐾(𝑀)---------------------------------1. 𝑇 ← Ξ£. Tag(𝐾,𝑀)

2. 𝑆. add 𝑀, 𝑇

3. return 𝑇

VF𝐾(𝑀, 𝑇)---------------------------------1. 𝑑 ← Ξ£. Vrfy(𝐾,𝑀, 𝑇)2. if 𝑑 = 1 and 𝑀,𝑇 βˆ‰ 𝑆 then:3. π‘€π‘œπ‘› ← 14. return 𝑑

Page 15: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

UF-CMA – Unforgability against chosen-message attacks

15

𝐄𝐱𝐩Σuf–cma 𝐴

1. 𝐾←$Ξ£. KeyGen

2. 𝑆 ← [ ]3. π‘€π‘œπ‘› ← 0

4. 𝐴𝐾Tag𝐾 β‹… , VF𝐾(β‹…,β‹…)

5. return π‘€π‘œπ‘›

Tag𝐾(𝑀)---------------------------------1. 𝑇 ← Ξ£. Tag(𝐾,𝑀)

2. 𝑆. add 𝑀, 𝑇

3. return 𝑇

VF𝐾(𝑀, 𝑇)---------------------------------1. 𝑑 ← Ξ£. Vrfy(𝐾,𝑀, 𝑇)2. if 𝑑 = 1 and 𝑀,𝑇 βˆ‰ 𝑆 then:3. π‘€π‘œπ‘› ← 14. return 𝑑

𝑀1, 𝑀2, …

𝑇1, 𝑇2, …

Tag(𝐾,β‹…)

𝑀1β€² , 𝑇1

β€² , 𝑀2β€² , 𝑇2

β€² , …

1/0, 1/0, …

VF(𝐾,β‹…,β‹…)

Challenger

𝐀𝐝𝐯Σuf–cma 𝐴 β‰ˆ 1 = adversary is doing well

𝐀𝐝𝐯Σuf–cma 𝐴 β‰ˆ 0 = adversary is doing poorly

Definition: The UF-CMA-advantage of an

adversary 𝐴 is

𝐀𝐝𝐯Σuf–cma 𝐴 = Pr 𝐄𝐱𝐩Σ

uf–cma 𝐴 β‡’ 1

Page 16: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Properties of UF-CMA definition

β€’ UF-CMA security implies:

β€’ Hard to recover 𝐾

β€’ Hard to do selective forgery: forge a tag on a specific

message chosen by the adversary

β€’ Hard to forge a new tag on an old message (and tag)

β€’ If each message has a unique tag ⟹ forgery must be on a

new message

β€’ Tag lengths must be long enough!

β€’ Suppose 𝑇 = 10; then adversary who simply guesses 𝑇

has advantage 𝐀𝐝𝐯Σuf–cma 𝐴 =

1

210β‰ˆ

1

1000

β€’ Does not give protection against replay attacks

β€’ Message counters

β€’ Nonces

β€’ Timestamps

16

𝐄𝐱𝐩Σuf–cma 𝐴

1. 𝐾←$Ξ£. KeyGen

2. 𝑆 ← [ ]; π‘€π‘œπ‘› ← 0

3. 𝐴𝐾Tag𝐾 β‹… , VF𝐾(β‹…,β‹…)

4. returnπ‘€π‘œπ‘›

Tag𝐾(𝑀)---------------------------------1. 𝑇 ← Ξ£. Tag(𝐾,𝑀)

2. 𝑆. add 𝑀, 𝑇

3. return 𝑇

VF𝐾(𝑀, 𝑇)---------------------------------1. 𝑑 ← Ξ£. Vrfy(𝐾,𝑀, 𝑇)2. if 𝑑 = 1 and 𝑀,𝑇 βˆ‰ 𝑆 then:3. π‘€π‘œπ‘› ← 14. return 𝑑

𝐀𝐝𝐯Σuf–cma 𝐴 = Pr 𝐄𝐱𝐩Σ

uf–cma 𝐴 β‡’ 1

Page 17: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Message authentication codes (MACs)

β€’ Special class of message authentication schemes:

Ξ£. Tag ∢ 𝒦 Γ—β„³ β†’ 𝒯 is a deterministic function

Ξ£. Vrfy ∢ 𝒦 Γ—β„³ Γ— 𝒯 β†’ 0,1 simply recomputes tag and compares:

Ξ£. Vrfy 𝐾,𝑀, 𝑇 =def

1, if 𝑇 = Ξ£. Tag(𝐾,𝑀)0, otherwise

β€’ Most common in practice

β€’ MAC ⟹ unique tags ⟹ forgeries must be on new messages

17

Page 18: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PRFs are good MACs

18

𝑀

𝐹𝐾

𝑇

Alg Ξ£PRF. Tag 𝐾,𝑀---------------------------------1. if 𝑀 βˆ‰ 0,1 𝑖𝑛 then2. return βŠ₯3. return 𝐹𝐾(𝑀)

Alg Ξ£PRF. Vrfy 𝐾,𝑀, 𝑇---------------------------------1. 𝑇′ ← 𝐹𝐾 𝑀

2. return 𝑇′ =?𝑇

𝐹 ∢ 0,1 π‘˜ Γ— 0,1 𝑖𝑛 β†’ 0,1 π‘œπ‘’π‘‘

Theorem: If 𝐹 is a secure PRF then Ξ£PRF is UF-CMA secure for fixed-length messages 𝑀 ∈ 0,1 𝑖𝑛

Detailed: for any UF-CMA adversary 𝐴 against Ξ£PRF asking 𝑣 Vrfy queries, there is a PRF-

adversary 𝐡 against 𝐹 such that

𝐀𝐝𝐯ΣPRFuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐹

prf𝐡 +

𝑣

2π‘œπ‘’π‘‘

PRF

Page 19: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PRFs are good MACs – proof sketch

Theorem: For any UF-CMA adversy 𝐴, asking 𝑣 Vrfy queries, there is a PRF-adversary 𝐡 such that

𝐀𝐝𝐯ΣPRFuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐹

prf𝐡 +

𝑣

2π‘œπ‘’π‘‘

𝑀

𝐹𝐾

𝑇

𝑀

𝜌

𝑇

β‰ˆPRF-security

πœŒβ†$Func 𝑖𝑛, π‘œπ‘’π‘‘

Page 20: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PRFs are good MACs – proof sketch

Theorem: For any UF-CMA adversy 𝐴, asking 𝑣 Vrfy queries, there is a PRF-adversary 𝐡 such that

𝐀𝐝𝐯ΣPRFuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐹

prf𝐡 +

𝑣

2π‘œπ‘’π‘‘

𝑀

𝐹𝐾

𝑇

𝑀

𝜌

𝑇

β‰ˆPRF-security

πœŒβ†$Func 𝑖𝑛, π‘œπ‘’π‘‘

Page 21: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PRFs are good MACs – proof sketch

Theorem: For any UF-CMA adversy 𝐴, asking 𝑣 Vrfy queries, there is a PRF-adversary 𝐡 such that

𝐀𝐝𝐯ΣPRFuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐹

prf𝐡 +

𝑣

2π‘œπ‘’π‘‘

𝑀

𝐹𝐾

𝑇

𝑀

𝜌

𝑇

β‰ˆPRF-security

𝑀′

𝜌

𝑇′

Pr 𝜌 𝑀′ = 𝑇′ =1

2π‘œπ‘’π‘‘

Page 22: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PRFs are good MACs – proof sketch

Theorem: For any UF-CMA adversy 𝐴, asking 𝑣 Vrfy queries, there is a PRF-adversary 𝐡 such that

𝐀𝐝𝐯ΣPRFuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐹

prf𝐡 +

𝑣

2π‘œπ‘’π‘‘

𝑀

𝐹𝐾

𝑇

𝑀

𝜌

𝑇

β‰ˆPRF-security

𝑀1β€²

𝜌

𝑇1β€²

𝑀2β€²

𝜌

𝑇2β€²

𝑀𝑣′

πœŒβ‹―

𝑇𝑣′

Pr 𝜌 𝑀1β€² = 𝑇1

β€² ∨ β‹―βˆ¨ 𝜌 𝑀𝑣′ = 𝑇𝑣

β€² = 𝑣 β‹…1

2π‘œπ‘’π‘‘β‰€

𝑖=1

𝑣

Pr[𝜌 𝑀𝑖′ = 𝑇𝑖

β€²]

Pr 𝜌 𝑀′ = 𝑇′ =1

2π‘œπ‘’π‘‘

𝑀′

𝜌

𝑇′

Page 23: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PRFs are good MACs – proof sketch

𝑀

𝐹𝐾

𝑇

𝑀

𝜌

𝑇

β‰ˆPRF-security

𝑀1β€²

𝜌

𝑇1β€²

𝑀2β€²

𝜌

𝑇2β€²

𝑀𝑣′

πœŒβ‹―

𝑇𝑣′

Theorem: For any UF-CMA adversy 𝐴, asking 𝑣 Vrfy queries, there is a PRF-adversary 𝐡 such that

𝐀𝐝𝐯ΣPRFuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐹

prf𝐡 +

𝑣

2π‘œπ‘’π‘‘

Pr 𝜌 𝑀1β€² = 𝑇1

β€² ∨ β‹―βˆ¨ 𝜌 𝑀𝑣′ = 𝑇𝑣

β€² = 𝑣 β‹…1

2π‘œπ‘’π‘‘β‰€

𝑖=1

𝑣

Pr[𝜌 𝑀𝑖′ = 𝑇𝑖

β€²]

Page 24: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

MACs for long messages

24

Page 25: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Attempt 1

25

𝑀1

Tag𝐾

𝑀2 𝑀3 𝑀4

Tag𝐾 Tag𝐾 Tag𝐾

𝑇1 𝑇2 𝑇3 𝑇4

𝑇 = 𝑇1||𝑇2||𝑇3||𝑇4

𝑀

Page 26: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Attempt 1 – an attack

26

𝑀1

Tag𝐾

𝑀3 𝑀2 𝑀4

Tag𝐾 Tag𝐾 Tag𝐾

𝑇1 𝑇3 𝑇2 𝑇4

𝑇 = 𝑇1||𝑇3||𝑇2||𝑇4

Page 27: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Attempt 2

27

𝑀1

Tag𝐾

𝑀2 𝑀3 𝑀4

𝑀

𝑇

Page 28: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Attempt 2 – an attack

28

𝑀1

Tag𝐾

𝑀3 𝑀2 𝑀4

𝑇

Page 29: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Attempt 3

29

1||𝑀1

Tag𝐾

2||𝑀2 3||𝑀3 4||𝑀4

Tag𝐾 Tag𝐾 Tag𝐾

𝑇1 𝑇2 𝑇3 𝑇4

𝑇 = 𝑇1||𝑇2||𝑇3||𝑇4

𝑀

Page 30: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Attempt 3 – an attack

30

1||𝑀1

Tag𝐾

2||𝑀2β€² 3||𝑀3 4||𝑀4

Tag𝐾 Tag𝐾 Tag𝐾

𝑇1 𝑇2β€² 𝑇3 𝑇4

𝑇 = 𝑇1||𝑇2β€²||𝑇3||𝑇4

𝑀 = 𝑀1||𝑀2||𝑀3||𝑀4

TagK𝑇1||𝑇2||𝑇3||𝑇4

𝑀′ = 𝑀1β€² ||𝑀2

β€² ||𝑀3β€² ||𝑀4

β€²TagK

𝑇1β€²||𝑇2

β€²||𝑇3β€²||𝑇4

β€²

Page 31: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CBC-MAC

31

𝑀1

𝐸𝐾

𝑀2 𝑀3 𝑀4

𝐸𝐾 𝐸𝐾 𝐸𝐾

𝑀

𝑇

Page 32: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CBC-MAC – security

β€’ CBC-MAC is secure if you only MAC messages of length 4 β‹… 𝑛

β€’ CBC-MAC is secure if you only MAC messages of length 23 β‹… 𝑛

β€’ CBC-MAC is not secure if you MAC messages of lengths 4 β‹… 𝑛 and 23 β‹… 𝑛

32

Theorem: If 𝐸 ∢ 0,1 π‘˜ Γ— 0,1 𝑛 β†’ 0,1 𝑛 is a secure block cipher, then for

any fixed β„“ CBC-MAC is UF-CMA secure for messages 𝑀 ∈ 0,1 ℓ⋅𝑛.

Page 33: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CBC-MAC – pitfalls; variable-length messages

33

𝑀

𝐸𝐾

𝑇

𝑀

𝐸𝐾

π‘€βŠ•π‘‡

𝐸𝐾

𝑇

CBC. Tag 𝐾,𝑀||π‘€βŠ• 𝑇 = 𝐸𝐾 𝐸𝐾 𝑀 βŠ• π‘€βŠ•π‘‡

= 𝐸𝐾 𝑇 βŠ• π‘€βŠ•π‘‡

= 𝐸𝐾 𝑀

= 𝑇

𝐀𝐝𝐯CBC–MACuf–cma 𝐴 = 1

Page 34: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CBC-MAC vs. CBC$-encryption

34

𝑀1

𝐸𝐾

𝑇

𝑀2

𝐸𝐾

𝑀3

𝐸𝐾

𝑀4

𝐸𝐾

𝐼𝑉 𝑀1

𝐸𝐾

𝑀2

𝐸𝐾

𝑀3

𝐸𝐾

𝐢0 𝐢1 𝐢2 𝐢3

CBC-MAC CBC$-encryption

Page 35: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CBC$-MAC – pitfalls; randomized IV

35

𝐼𝑉

𝑇

𝑀1

𝐸𝐾

𝑀2

𝐸𝐾

𝑀3

𝐸𝐾

𝐼𝑉

0𝑛

𝑇

𝐸𝐾

𝑀2

𝐸𝐾

𝑀3

𝐸𝐾

0𝑛

𝑀1βŠ•πΌπ‘‰

Page 36: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Allowing variable-length messages

β€’ Want to support different-length messages simultaneously

β€’ Want to MAC messages of length 4 β‹… 𝑛 and 23 β‹… 𝑛

β€’ Could use different keys for each length ⟹ not practical

β€’ Want to support message not a multiple of the block length

β€’ Padding needed

36

𝑀1 𝑀2 1000

𝑀1 𝑀2 𝑀1 𝑀2 100000000

𝑀1 𝑀2

Page 37: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CBC-MAC for variable-length messages

37

|𝑀|

𝐸𝐾

𝑀1 𝑀2 𝑀3

𝐸𝐾 𝐸𝐾 𝐸𝐾

𝑀

𝑇

What if you append the length of 𝑀 at the end rather than at the beginning?

Theorem: If 𝐸 is a secure PRP then length-prepended CBC-MAC is UF-CMA secure

Page 38: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

ECBC-MAC

38

𝑀1

𝐸𝐾1

𝑀2 𝑀3

𝐸𝐾1𝐸𝐾1

𝑀3 pad

𝐸𝐾2

𝑇

𝑀1

𝐸𝐾1

𝑀2

𝐸𝐾1𝐸𝐾1

𝐸𝐾3

𝑇𝐾1, 𝐾2, 𝐾3

Page 39: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

FCBC-MAC

39

𝑀1

𝐸𝐾1

𝑇

𝑀2 𝑀3

𝐸𝐾1𝐸𝐾2

𝑀1

𝐸𝐾1

𝑇

𝑀2

𝐸𝐾1𝐸𝐾3

𝑀3 pad

𝐾1, 𝐾2, 𝐾3

Page 40: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

XCBC-MAC

40

𝑀1

𝐸𝐾1

𝑇

𝑀2 𝑀3

𝐸𝐾1𝐸𝐾1

𝑀1

𝐸𝐾1

𝑇

𝑀2

𝐸𝐾1𝐸𝐾1

𝑀3 pad

𝐾3𝐾2

𝐾1, 𝐾2, 𝐾3

Page 41: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CMAC a.k.a. One-key MAC (OMAC)

41

𝑀1

𝐸𝐾

𝑇

𝑀2 𝑀3

𝐸𝐾 𝐸𝐾

𝑀1

𝐸𝐾

𝑇

𝑀2

𝐸𝐾 𝐸𝐾

𝑀3 pad

𝐾3𝐾2

𝐾2 = 2 ⋇ 𝐸𝐾 0𝑛

𝐾3 = 4 ⋇ 𝐸𝐾 0𝑛

Page 42: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CMAC

β€’ 1 𝐸-call per message block + 1 𝐸-call to derive 𝐾2, 𝐾3

β€’ Fully sequential

β€’ Cannot utilize parallel AES cores

β€’ Only one key

β€’ Standardized by NIST

42

𝐾2 = 2 ⋇ 𝐹𝐾 0𝑛

𝐾3 = 4 ⋇ 𝐹𝐾 0𝑛

Page 43: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CMAC security

β€’ Example:

β€’ 𝐸 = AES (𝑛 = 128)

β€’ Number of Tag-queries: π‘ž = 240 β‰ˆ 1 trillion queries

β€’ Max 𝑛-bit blocks per message: β„“ = 216 β‰ˆ 1 MB

β€’ Number of Vrfy-queries: 𝑣 = 240

β€’ 𝐀𝐝𝐯𝐸prp

𝐡 β‰ˆ 0

43

Theorem: If 𝐸 ∢ 0,1 π‘˜ Γ— 0,1 𝑛 β†’ 0,1 𝑛 is a secure PRP then CMAC is UF-CMA secure.

Detailed: (Nandi '09) For any UF-CMA adversary making π‘ž Tag-queries, each of max length ℓ𝑛-bit blocks, and 𝑣 Vrfy-queries, there is a PRP-adversary 𝐡 such that

𝐀𝐝𝐯CMACuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐸

prp𝐡 +

5 β‹… β„“ β‹… π‘ž2

2𝑛+

𝑣

2𝑛

𝐀𝐝𝐯AES–MACuf–cma 𝐴 ≀

5 β‹… 216 β‹… 240 2

2128+

240

2128β‰ˆ

23+16+80

2128=

1

229

Page 44: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CMAC security

β€’ Example:

β€’ 𝐸 = DES (𝑛 = 64)

β€’ Number of Tag-queries: π‘ž = 240 β‰ˆ 1 trillion queries

β€’ Max 𝑛-bit blocks per message: β„“ = 216 β‰ˆ 1 MB

β€’ Number of Vrfy-queries: 𝑣 = 240

β€’ 𝐀𝐝𝐯𝐸prp

𝐡 β‰ˆ 0

44

Theorem: If 𝐸 ∢ 0,1 π‘˜ Γ— 0,1 𝑛 β†’ 0,1 𝑛 is a secure PRP then CMAC is UF-CMA secure.

Detailed: (Nandi '09) For any UF-CMA adversary making π‘ž Tag-queries, each of max length ℓ𝑛-bit blocks, and 𝑣 Vrfy-queries, there is a PRP-adversary 𝐡 such that

𝐀𝐝𝐯CMACuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐸

prp𝐡 +

5 β‹… β„“ β‹… π‘ž2

2𝑛+

𝑣

2𝑛

𝐀𝐝𝐯DES–CMACuf–cma 𝐴 ≀

5 β‹… 216 β‹… 240 2

264+240

264β‰ˆ

23+16+80

264= 235

Prob. > 𝟏!

Page 45: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

CMAC security

β€’ Example:

β€’ 𝐸 = DES (𝑛 = 64)

β€’ Number of Tag-queries: π‘ž = 216 β‰ˆ 65,000 queries

β€’ Max 𝑛-bit blocks per message: β„“ = 210 β‰ˆ 1 kB

β€’ Number of Vrfy-queries: 𝑣 = 240

β€’ 𝐀𝐝𝐯𝐸prp

𝐡 β‰ˆ 0

45

Theorem: If 𝐸 ∢ 0,1 π‘˜ Γ— 0,1 𝑛 β†’ 0,1 𝑛 is a secure PRP then CMAC is UF-CMA secure.

Detailed: (Nandi '09) For any UF-CMA adversary making π‘ž Tag-queries, each of max length ℓ𝑛-bit blocks, and 𝑣 Vrfy-queries, there is a PRP-adversary 𝐡 such that

𝐀𝐝𝐯CMACuf–cma 𝐴 ≀ 𝐀𝐝𝐯𝐸

prp𝐡 +

5 β‹… β„“ β‹… π‘ž2

2𝑛+

𝑣

2𝑛

𝐀𝐝𝐯DES–CMACuf–cma 𝐴 ≀

5 β‹… 210 β‹… 216 2

264+240

264β‰ˆ

23+10+32

264=

1

219

Page 46: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PMAC

46

𝑀1

𝐸𝐾

𝛾1 ⋇ 𝐿

𝑀2

𝐸𝐾

𝛾2 ⋇ 𝐿

𝑀3

𝐸𝐾

𝛾3 ⋇ 𝐿

𝑀4 pad

𝐸𝐾

𝑇

𝛽 ⋇ 𝐿 (if |pad| = 0)

𝐿 = 𝐹𝐾 0𝑛

𝛾𝑖 = Gray codes

Page 47: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

PMAC properties

β€’ Fully parallelizable

β€’ Incremental

β€’ One key

β€’ UF-CMA secure

β€’ …not used in practice

47

PMAC 𝐾,𝑀1||𝑀2|| … ||𝑀1000 = 𝑇

PMAC 𝐾,𝑀1||𝑀2β€² || … ||𝑀1000 = 𝐸𝐾 𝐸𝐾

βˆ’1 𝑇 βŠ• 𝑇2 βŠ•π‘‡2β€²

𝑇2 = 𝐸𝐾 𝑀2 βŠ•π›Ύ2 ⋇ 𝐿

𝑇2β€² = 𝐸𝐾 𝑀2

β€² βŠ•π›Ύ2 ⋇ 𝐿

𝑇2𝑇2β€²

Page 48: Lecture 4 Message authentication, UF-CMA, CBC-MAC, CMAC

Summary

β€’ UF-CMA the right security notion for message integrity

β€’ Does not cover replay attacks

β€’ PRFs are good MACs

β€’ But usually of short (fixed) input length

β€’ CBC-MAC good MAC for messages of a single fixed length

β€’ CMAC upgrades CBC-MAC to variable-length messages

48


Recommended