| 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_AEAD_BASE_ENCRYPTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_AEAD_BASE_ENCRYPTER_H_ |
| 6 #define NET_QUIC_CRYPTO_AEAD_BASE_ENCRYPTER_H_ | 6 #define NET_QUIC_CRYPTO_AEAD_BASE_ENCRYPTER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "net/quic/crypto/quic_encrypter.h" | 9 #include "net/quic/crypto/quic_encrypter.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #else | 33 #else |
| 34 AeadBaseEncrypter(CK_MECHANISM_TYPE aead_mechanism, | 34 AeadBaseEncrypter(CK_MECHANISM_TYPE aead_mechanism, |
| 35 PK11_EncryptFunction pk11_encrypt, | 35 PK11_EncryptFunction pk11_encrypt, |
| 36 size_t key_size, | 36 size_t key_size, |
| 37 size_t auth_tag_size, | 37 size_t auth_tag_size, |
| 38 size_t nonce_prefix_size); | 38 size_t nonce_prefix_size); |
| 39 #endif | 39 #endif |
| 40 virtual ~AeadBaseEncrypter(); | 40 virtual ~AeadBaseEncrypter(); |
| 41 | 41 |
| 42 // QuicEncrypter implementation | 42 // QuicEncrypter 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 Encrypt(base::StringPiece nonce, | 45 virtual bool Encrypt(base::StringPiece nonce, |
| 46 base::StringPiece associated_data, | 46 base::StringPiece associated_data, |
| 47 base::StringPiece plaintext, | 47 base::StringPiece plaintext, |
| 48 unsigned char* output) OVERRIDE; | 48 unsigned char* output) override; |
| 49 virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, | 49 virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, |
| 50 base::StringPiece associated_data, | 50 base::StringPiece associated_data, |
| 51 base::StringPiece plaintext) OVERRIDE; | 51 base::StringPiece plaintext) override; |
| 52 virtual size_t GetKeySize() const OVERRIDE; | 52 virtual size_t GetKeySize() const override; |
| 53 virtual size_t GetNoncePrefixSize() const OVERRIDE; | 53 virtual size_t GetNoncePrefixSize() const override; |
| 54 virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const OVERRIDE; | 54 virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const override; |
| 55 virtual size_t GetCiphertextSize(size_t plaintext_size) const OVERRIDE; | 55 virtual size_t GetCiphertextSize(size_t plaintext_size) const override; |
| 56 virtual base::StringPiece GetKey() const OVERRIDE; | 56 virtual base::StringPiece GetKey() const override; |
| 57 virtual base::StringPiece GetNoncePrefix() const OVERRIDE; | 57 virtual base::StringPiece GetNoncePrefix() const override; |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // Make these constants available to the subclasses so that the subclasses | 60 // Make these constants available to the subclasses so that the subclasses |
| 61 // can assert at compile time their key_size_ and nonce_prefix_size_ do not | 61 // can assert at compile time their key_size_ and nonce_prefix_size_ do not |
| 62 // exceed the maximum. | 62 // exceed the maximum. |
| 63 static const size_t kMaxKeySize = 32; | 63 static const size_t kMaxKeySize = 32; |
| 64 static const size_t kMaxNoncePrefixSize = 4; | 64 static const size_t kMaxNoncePrefixSize = 4; |
| 65 | 65 |
| 66 #if !defined(USE_OPENSSL) | 66 #if !defined(USE_OPENSSL) |
| 67 struct AeadParams { | 67 struct AeadParams { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #if defined(USE_OPENSSL) | 101 #if defined(USE_OPENSSL) |
| 102 ScopedEVPAEADCtx ctx_; | 102 ScopedEVPAEADCtx ctx_; |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(AeadBaseEncrypter); | 105 DISALLOW_COPY_AND_ASSIGN(AeadBaseEncrypter); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace net | 108 } // namespace net |
| 109 | 109 |
| 110 #endif // NET_QUIC_CRYPTO_AEAD_BASE_ENCRYPTER_H_ | 110 #endif // NET_QUIC_CRYPTO_AEAD_BASE_ENCRYPTER_H_ |
| OLD | NEW |