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 QUICHE_EXPORT ChaCha20Poly1305Decrypter : public ChaChaBaseDecrypter { 23 public: 24 enum { 25 kAuthTagSize = 12, 26 }; 27 28 ChaCha20Poly1305Decrypter(); 29 ChaCha20Poly1305Decrypter(const ChaCha20Poly1305Decrypter&) = delete; 30 ChaCha20Poly1305Decrypter& operator=(const ChaCha20Poly1305Decrypter&) = 31 delete; 32 ~ChaCha20Poly1305Decrypter() override; 33 34 uint32_t cipher_id() const override; 35 QuicPacketCount GetIntegrityLimit() const override; 36 }; 37 38 } // namespace quic 39 40 #endif // QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_DECRYPTER_H_ 41