summaryrefslogtreecommitdiff
path: root/chromium/net/quic/crypto/aes_128_gcm_12_encrypter.h
blob: 2b432fbc262e5e32bc19b29cc6217ae4892ed046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_
#define NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_

#include "net/quic/crypto/aead_base_encrypter.h"

namespace net {

// An Aes128Gcm12Encrypter is a QuicEncrypter that implements the
// AEAD_AES_128_GCM_12 algorithm specified in RFC 5282. Create an instance by
// calling QuicEncrypter::Create(kAESG).
//
// It uses an authentication tag of 12 bytes (96 bits). The fixed prefix
// of the nonce is four bytes.
class NET_EXPORT_PRIVATE Aes128Gcm12Encrypter : public AeadBaseEncrypter {
 public:
  enum {
    // Authentication tags are truncated to 96 bits.
    kAuthTagSize = 12,
  };

  Aes128Gcm12Encrypter();
  ~Aes128Gcm12Encrypter() override;

#if !defined(USE_OPENSSL)
 protected:
  // AeadBaseEncrypter methods:
  void FillAeadParams(base::StringPiece nonce,
                      base::StringPiece associated_data,
                      size_t auth_tag_size,
                      AeadParams* aead_params) const override;
#endif

 private:
  DISALLOW_COPY_AND_ASSIGN(Aes128Gcm12Encrypter);
};

}  // namespace net

#endif  // NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_