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_DECRYPTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_AES_128_GCM_12_DECRYPTER_H_ |
6 #define NET_QUIC_CRYPTO_AES_128_GCM_12_DECRYPTER_H_ | 6 #define NET_QUIC_CRYPTO_AES_128_GCM_12_DECRYPTER_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 Aes128Gcm12Decrypter : public QuicDecrypter { | 29 class NET_EXPORT_PRIVATE Aes128Gcm12Decrypter : public QuicDecrypter { |
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 Aes128Gcm12Decrypter(); | 36 Aes128Gcm12Decrypter(); |
37 virtual ~Aes128Gcm12Decrypter(); | 37 virtual ~Aes128Gcm12Decrypter() OVERRIDE; |
38 | 38 |
39 // Returns true if the underlying crypto library supports AES GCM. | 39 // Returns true if the underlying crypto library supports AES GCM. |
40 static bool IsSupported(); | 40 static bool IsSupported(); |
41 | 41 |
42 // QuicDecrypter implementation | 42 // QuicDecrypter implementation |
43 virtual bool SetKey(base::StringPiece key) OVERRIDE; | 43 virtual bool SetKey(base::StringPiece key) OVERRIDE; |
44 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; | 44 virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; |
45 virtual bool Decrypt(base::StringPiece nonce, | 45 virtual bool Decrypt(base::StringPiece nonce, |
46 base::StringPiece associated_data, | 46 base::StringPiece associated_data, |
47 base::StringPiece ciphertext, | 47 base::StringPiece ciphertext, |
(...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_DECRYPTER_H_ | 69 #endif // NET_QUIC_CRYPTO_AES_128_GCM_12_DECRYPTER_H_ |
OLD | NEW |