xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/crypto/aes_128_gcm_12_decrypter.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 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_AES_128_GCM_12_DECRYPTER_H_
6 #define QUICHE_QUIC_CORE_CRYPTO_AES_128_GCM_12_DECRYPTER_H_
7 
8 #include <cstdint>
9 
10 #include "quiche/quic/core/crypto/aes_base_decrypter.h"
11 #include "quiche/quic/platform/api/quic_export.h"
12 
13 namespace quic {
14 
15 // An Aes128Gcm12Decrypter is a QuicDecrypter that implements the
16 // AEAD_AES_128_GCM_12 algorithm specified in RFC 5282. Create an instance by
17 // calling QuicDecrypter::Create(kAESG).
18 //
19 // It uses an authentication tag of 12 bytes (96 bits). The fixed prefix
20 // of the nonce is four bytes.
21 class QUICHE_EXPORT Aes128Gcm12Decrypter : public AesBaseDecrypter {
22  public:
23   enum {
24     // Authentication tags are truncated to 96 bits.
25     kAuthTagSize = 12,
26   };
27 
28   Aes128Gcm12Decrypter();
29   Aes128Gcm12Decrypter(const Aes128Gcm12Decrypter&) = delete;
30   Aes128Gcm12Decrypter& operator=(const Aes128Gcm12Decrypter&) = delete;
31   ~Aes128Gcm12Decrypter() override;
32 
33   uint32_t cipher_id() const override;
34 };
35 
36 }  // namespace quic
37 
38 #endif  // QUICHE_QUIC_CORE_CRYPTO_AES_128_GCM_12_DECRYPTER_H_
39