TLS 1.3 specifies these three ciphersuites:
- TLS_AES_128_GCM_SHA256
- TLS_AES_256_GCM_SHA384
- TLS_CHACHA20_POLY1305_SHA256
all of them both feature authenticated cipher modes and and a hashing algorithm at the end. What is the purpose of these?
TLS 1.3 specifies these three ciphersuites:
all of them both feature authenticated cipher modes and and a hashing algorithm at the end. What is the purpose of these?
While AES-GCM and ChaCha20-Poly1305 use AEAD cipher modes, and thus do not require a MAC on the encrypted data, there are still some parts of the TLS protocol which require a hash function.
The first is for handshake validation. When the Finished message is sent, it contains a hash of all the previous handshake messages sent, which allows TLS to validate that handshake messages sent before the key exchange weren't tampered with. The hash function used here is the one specified in the cipher suite. You can read about this in RFC 8446 Section 4.4.4.
The second is for key derivation. While the session master key is exchanged or agreed upon via ECDHE or a similar mechanism, this master key isn't directly used for encryption or authenticity verification. Instead, a PRF based on a HMAC is used to derive keys for various purposes (e.g. encryption), and the underlying hash of that HMAC is specified in the cipher suite. You can read about this in RFC8446 Appendix E.1.1 and in more detail in RFC 5246 Section 5.