1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_DECRYPTER_H_ 6 #define QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_DECRYPTER_H_ 7 8 #include <cstdint> 9 10 #include "quiche/quic/core/crypto/chacha_base_decrypter.h" 11 #include "quiche/quic/platform/api/quic_export.h" 12 13 namespace quic { 14 15 // A ChaCha20Poly1305Decrypter is a QuicDecrypter that implements the 16 // AEAD_CHACHA20_POLY1305 algorithm specified in RFC 7539, except that 17 // it truncates the Poly1305 authenticator to 12 bytes. Create an instance 18 // by calling QuicDecrypter::Create(kCC20). 19 // 20 // It uses an authentication tag of 12 bytes (96 bits). The fixed prefix of the 21 // nonce is four bytes. 22 class QUIC_EXPORT_PRIVATE ChaCha20Poly1305Decrypter 23 : public ChaChaBaseDecrypter { 24 public: 25 enum { 26 kAuthTagSize = 12, 27 }; 28 29 ChaCha20Poly1305Decrypter(); 30 ChaCha20Poly1305Decrypter(const ChaCha20Poly1305Decrypter&) = delete; 31 ChaCha20Poly1305Decrypter& operator=(const ChaCha20Poly1305Decrypter&) = 32 delete; 33 ~ChaCha20Poly1305Decrypter() override; 34 35 uint32_t cipher_id() const override; 36 QuicPacketCount GetIntegrityLimit() const override; 37 }; 38 39 } // namespace quic 40 41 #endif // QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_DECRYPTER_H_ 42