blob: 702fb8c7bcf3d4045d61e9e01aec43e5ab6c051d [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright 2017 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_TLS_DECRYPTER_H_
6#define QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_TLS_DECRYPTER_H_
7
8#include <cstdint>
9
QUICHE team2d187972019-03-19 16:23:47 -070010#include "net/third_party/quiche/src/quic/core/crypto/chacha_base_decrypter.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050011#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
12
13namespace quic {
14
15// A ChaCha20Poly1305TlsDecrypter is a QuicDecrypter that implements the
16// AEAD_CHACHA20_POLY1305 algorithm specified in RFC 7539 for use in IETF QUIC.
17//
18// It uses an authentication tag of 16 bytes (128 bits). It uses a 12 bytes IV
19// that is XOR'd with the packet number to compute the nonce.
20class QUIC_EXPORT_PRIVATE ChaCha20Poly1305TlsDecrypter
QUICHE team2d187972019-03-19 16:23:47 -070021 : public ChaChaBaseDecrypter {
QUICHE teama6ef0a62019-03-07 20:34:33 -050022 public:
23 enum {
24 kAuthTagSize = 16,
25 };
26
27 ChaCha20Poly1305TlsDecrypter();
28 ChaCha20Poly1305TlsDecrypter(const ChaCha20Poly1305TlsDecrypter&) = delete;
29 ChaCha20Poly1305TlsDecrypter& operator=(const ChaCha20Poly1305TlsDecrypter&) =
30 delete;
31 ~ChaCha20Poly1305TlsDecrypter() override;
32
33 uint32_t cipher_id() const override;
34};
35
36} // namespace quic
37
38#endif // QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_TLS_DECRYPTER_H_