xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/crypto/aes_128_gcm_decrypter.cc (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 #include "quiche/quic/core/crypto/aes_128_gcm_decrypter.h"
6 
7 #include "openssl/aead.h"
8 #include "openssl/tls1.h"
9 #include "quiche/quic/platform/api/quic_flag_utils.h"
10 #include "quiche/quic/platform/api/quic_flags.h"
11 
12 namespace quic {
13 
14 namespace {
15 
16 const size_t kKeySize = 16;
17 const size_t kNonceSize = 12;
18 
19 }  // namespace
20 
Aes128GcmDecrypter()21 Aes128GcmDecrypter::Aes128GcmDecrypter()
22     : AesBaseDecrypter(EVP_aead_aes_128_gcm, kKeySize, kAuthTagSize, kNonceSize,
23                        /* use_ietf_nonce_construction */ true) {
24   static_assert(kKeySize <= kMaxKeySize, "key size too big");
25   static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big");
26 }
27 
~Aes128GcmDecrypter()28 Aes128GcmDecrypter::~Aes128GcmDecrypter() {}
29 
cipher_id() const30 uint32_t Aes128GcmDecrypter::cipher_id() const {
31   return TLS1_CK_AES_128_GCM_SHA256;
32 }
33 
34 }  // namespace quic
35