| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NULL_DECRYPTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_NULL_DECRYPTER_H_ |
| 6 #define NET_QUIC_CRYPTO_NULL_DECRYPTER_H_ | 6 #define NET_QUIC_CRYPTO_NULL_DECRYPTER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" |
| 9 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 10 #include "net/quic/crypto/quic_decrypter.h" | 14 #include "net/quic/crypto/quic_decrypter.h" |
| 11 | 15 |
| 12 namespace net { | 16 namespace net { |
| 13 | 17 |
| 14 class QuicDataReader; | 18 class QuicDataReader; |
| 15 | 19 |
| 16 // A NullDecrypter is a QuicDecrypter used before a crypto negotiation | 20 // A NullDecrypter is a QuicDecrypter used before a crypto negotiation |
| 17 // has occurred. It does not actually decrypt the payload, but does | 21 // has occurred. It does not actually decrypt the payload, but does |
| 18 // verify a hash (fnv128) over both the payload and associated data. | 22 // verify a hash (fnv128) over both the payload and associated data. |
| 19 class NET_EXPORT_PRIVATE NullDecrypter : public QuicDecrypter { | 23 class NET_EXPORT_PRIVATE NullDecrypter : public QuicDecrypter { |
| 20 public: | 24 public: |
| 21 NullDecrypter(); | 25 NullDecrypter(); |
| 22 ~NullDecrypter() override {} | 26 ~NullDecrypter() override {} |
| 23 | 27 |
| 24 // QuicDecrypter implementation | 28 // QuicDecrypter implementation |
| 25 bool SetKey(base::StringPiece key) override; | 29 bool SetKey(base::StringPiece key) override; |
| 26 bool SetNoncePrefix(base::StringPiece nonce_prefix) override; | 30 bool SetNoncePrefix(base::StringPiece nonce_prefix) override; |
| 27 bool DecryptPacket(QuicPacketNumber packet_number, | 31 bool DecryptPacket(QuicPacketNumber packet_number, |
| 28 const base::StringPiece& associated_data, | 32 const base::StringPiece& associated_data, |
| 29 const base::StringPiece& ciphertext, | 33 const base::StringPiece& ciphertext, |
| 30 char* output, | 34 char* output, |
| 31 size_t* output_length, | 35 size_t* output_length, |
| 32 size_t max_output_length) override; | 36 size_t max_output_length) override; |
| 33 base::StringPiece GetKey() const override; | 37 base::StringPiece GetKey() const override; |
| 34 base::StringPiece GetNoncePrefix() const override; | 38 base::StringPiece GetNoncePrefix() const override; |
| 35 | 39 |
| 36 const char* cipher_name() const override; | 40 const char* cipher_name() const override; |
| 37 uint32 cipher_id() const override; | 41 uint32_t cipher_id() const override; |
| 38 | 42 |
| 39 private: | 43 private: |
| 40 bool ReadHash(QuicDataReader* reader, uint128* hash); | 44 bool ReadHash(QuicDataReader* reader, uint128* hash); |
| 41 uint128 ComputeHash(const base::StringPiece data1, | 45 uint128 ComputeHash(const base::StringPiece data1, |
| 42 const base::StringPiece data2) const; | 46 const base::StringPiece data2) const; |
| 43 | 47 |
| 44 DISALLOW_COPY_AND_ASSIGN(NullDecrypter); | 48 DISALLOW_COPY_AND_ASSIGN(NullDecrypter); |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 } // namespace net | 51 } // namespace net |
| 48 | 52 |
| 49 #endif // NET_QUIC_CRYPTO_NULL_DECRYPTER_H_ | 53 #endif // NET_QUIC_CRYPTO_NULL_DECRYPTER_H_ |
| OLD | NEW |