<<

Additional Block Modes

21 April 2021 Lecture 4

Slide Credits: Steve Zdancewic (UPenn)

21 April 2021 SE 425: Communication and Information Security 1 Topics for Today

• Additional Modes • OFB • CTR • GCM • Other ciphers and modes

• Sources: HAC 7.2.2, 9.1-9.4, 12.6.1

21 April 2021 SE 425: Communication and Information Security 2 Output Feedback Mode (OFB) • Make the solely dependent on the IV and • Remove all chaining dependencies • Creates a from a block cipher • No need for a separate decryption algorithm

21 April 2021 SE 425: Communication and Information Security 3 OFB Properties • Identical plaintexts: identical blocks result when the same plaintext is enciphered under the same key and IV. • The IV must be changed if the key is to be reused.

• Error Propagation: One or more bit errors in any ciphertext character 푐푗 affects the decipherment of only that character in the precise bit position(s) 푐푗 is in error, causing the corresponding plaintext bit(s) to be complemented.

• Error recovery: OFB recovers from ciphertext bit errors, but can’t self-synchronize after loss of ciphertext bits, which destroys alignment

• Throughput: Since keystream is independent of plaintext or ciphertext, it may be pre-computed.

21 April 2021 SE 425: Communication and Information Security 4 Counter Mode (CTR)

• A simplification of OFB in which 퐼푉 = 0 and the input blocks 퐼푗+1 = 퐼푗 + 1 rather than using feedback

Properties: • Avoids problem of repeating IV (if encrypting IV many times eventually leads to it recurring) • Allows random access decryption • Ciphertext block 𝑖 need not be decrypted to decrypt block 𝑖 + 1

21 April 2021 SE 425: Communication and Information Security 5 A look ahead

• Modern cipher modes combine encryption with authentication: • Authenticated Encryption with Associated Data (AEAD)

• We’ll talk about this later after Message Authentication Codes (MAC) • HMAC • Encrypt and then MAC • Galois Counter Mode (GCM)

21 April 2021 SE 425: Communication and Information Security 6 Using GCM

퐾 푐, ℎ, 푡, 퐼푉 퐸푛푐 퐾퐸푛푐 GMAC mode: 푚푠𝑔 is empty and ℎ isn’t empty → computes a MAC on ℎ

1. Wants to send 푚푠𝑔 with secrecy and integrity 7. GCM Decrypts 2. Wants to send ℎ with integrity only 푝 = 퐷퐾퐸푛푐,ℎ,푡,퐼푉{푐} 3. Sets Additional Authentication Data 퐴퐴퐷 = ℎ 8. If 퐷 doesn’t return FAIL: 4. Chooses tag length 푙푒푛 (128 bits) 푝 == 푚푠𝑔 and unchanged 5. Chooses unique 퐼푉 (96 bits) ℎ is unchanged

6. GCM Encrypts (푐, 푡) = 퐸퐾퐸푛푐,퐴퐴퐷,퐼푉 푚푠𝑔 GCM gives two outputs (푡 is 푙푒푛 bits)

21 April 2021 SE 425: Communication and Information Security 7 GCM Notes (from NIST)

• Uniqueness of IV is critical: Using same IV twice with same key leads to compromise • Using 96 bit IV is recommended, longer or shorter ones are hashed

• Short tags are bad: 128 bits is recommended. • 32 bit tags can only be used for tens of bytes per key • 64 bit tags can only be used for millions of bytes per key (few 푀퐵푠)

• Don’t use a key more than 232 times no matter what

• GCM can encrypt up to 64 GB per message securely

21 April 2021 SE 425: Communication and Information Security 8 Other Ciphers and Modes

Block Ciphers Stream Ciphers • (IoT) • ChaCha20 / Salsa20 • (IoT) • HC-256 • CAST-256 •

• Other Modes: • Cipher Feedback (CFB) • CCM (Counter with CBC- MAC) • Ciphertext Stealing (CTS)

21 April 2021 SE 425: Communication and Information Security 9 Conclusion

• Block Cipher Modes and Attacks

21 April 2021 SE 425: Communication and Information Security 10