OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_ |
6 #define NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_ | 6 #define NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // It uses an authentication tag of 12 bytes (96 bits). The fixed prefix | 27 // It uses an authentication tag of 12 bytes (96 bits). The fixed prefix |
28 // of the nonce is four bytes. | 28 // of the nonce is four bytes. |
29 class NET_EXPORT_PRIVATE Aes128Gcm12Encrypter : public QuicEncrypter { | 29 class NET_EXPORT_PRIVATE Aes128Gcm12Encrypter : public QuicEncrypter { |
30 public: | 30 public: |
31 enum { | 31 enum { |
32 // Authentication tags are truncated to 96 bits. | 32 // Authentication tags are truncated to 96 bits. |
33 kAuthTagSize = 12, | 33 kAuthTagSize = 12, |
34 }; | 34 }; |
35 | 35 |
36 Aes128Gcm12Encrypter(); | 36 Aes128Gcm12Encrypter(); |
37 virtual ~Aes128Gcm12Encrypter(); | 37 virtual ~Aes128Gcm12Encrypter() OVERRIDE; |
38 | 38 |
39 // QuicEncrypter implementation | 39 // QuicEncrypter implementation |
40 virtual bool SetKey(base::StringPiece key) OVERRIDE; | 40 virtual bool SetKey(base::StringPiece key) OVERRIDE; |
41 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; | 41 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; |
42 virtual bool Encrypt(base::StringPiece nonce, | 42 virtual bool Encrypt(base::StringPiece nonce, |
43 base::StringPiece associated_data, | 43 base::StringPiece associated_data, |
44 base::StringPiece plaintext, | 44 base::StringPiece plaintext, |
45 unsigned char* output) OVERRIDE; | 45 unsigned char* output) OVERRIDE; |
46 virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, | 46 virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, |
47 base::StringPiece associated_data, | 47 base::StringPiece associated_data, |
(...skipping 12 matching lines...) Expand all Loading... |
60 unsigned char nonce_prefix_[4]; | 60 unsigned char nonce_prefix_[4]; |
61 | 61 |
62 #if defined(USE_OPENSSL) | 62 #if defined(USE_OPENSSL) |
63 ScopedEVPAEADCtx ctx_; | 63 ScopedEVPAEADCtx ctx_; |
64 #endif | 64 #endif |
65 }; | 65 }; |
66 | 66 |
67 } // namespace net | 67 } // namespace net |
68 | 68 |
69 #endif // NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_ | 69 #endif // NET_QUIC_CRYPTO_AES_128_GCM_12_ENCRYPTER_H_ |
OLD | NEW |