OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef GFE_QUIC_CRYPTO_BASE_HKDF_H_ | |
agl
2013/02/21 15:00:43
I'm not sure whether we are changing the include g
ramant (doing other things)
2013/02/21 22:46:59
QUIC has included guards. Thanks for the catch.
D
| |
6 #define GFE_QUIC_CRYPTO_BASE_HKDF_H_ | |
Ryan Sleevi
2013/02/21 17:48:31
Yes, this header should be fixed
ramant (doing other things)
2013/02/21 22:46:59
Done.
| |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/string_piece.h" | |
13 #include "build/build_config.h" | |
14 #include "crypto/crypto_export.h" | |
15 | |
16 namespace crypto { | |
17 | |
18 // HKDF implements the key derivation function specified in RFC 5869 (using | |
19 // SHA-256) and outputs key material, as needed by QUIC. | |
Ryan Sleevi
2013/02/21 17:48:31
This seems fairly specific to QUIC, in the client/
ramant (doing other things)
2013/02/21 22:46:59
Will like to leave this to agl@ (because it is API
| |
20 class CRYPTO_EXPORT HKDF { | |
21 public: | |
22 // secret: the input secret. | |
23 // salt: the public salt. | |
24 // info: an (optional) label to distinguish different uses of HKDF. | |
25 // key_bytes_to_generate: the number of bytes of key material to generate. | |
26 // iv_bytes_to_generate: the number of bytes of IV to generate. | |
Ryan Sleevi
2013/02/21 17:48:31
Can you please provide comments on these that expl
ramant (doing other things)
2013/02/21 22:46:59
agl@: added some comments from RFC 5869. What do y
wtc
2013/02/25 22:18:00
I copied the current usage from TLS, which conside
| |
27 HKDF(const base::StringPiece& secret, | |
28 const base::StringPiece& salt, | |
29 const base::StringPiece& info, | |
30 size_t key_bytes_to_generate, | |
31 size_t iv_bytes_to_generate); | |
32 virtual ~HKDF(); | |
33 | |
34 base::StringPiece client_write_key() const { | |
35 return client_write_key_; | |
36 } | |
37 base::StringPiece client_write_iv() const { | |
38 return client_write_iv_; | |
39 } | |
40 base::StringPiece server_write_key() const { | |
41 return server_write_key_; | |
42 } | |
43 base::StringPiece server_write_iv() const { | |
44 return server_write_iv_; | |
45 } | |
46 | |
47 private: | |
48 std::vector<uint8> output_; | |
49 | |
50 base::StringPiece client_write_key_; | |
51 base::StringPiece server_write_key_; | |
52 base::StringPiece client_write_iv_; | |
53 base::StringPiece server_write_iv_; | |
54 }; | |
55 | |
56 } // namespace crypto | |
57 | |
58 #endif // GFE_QUIC_CRYPTO_BASE_HKDF_H_ | |
OLD | NEW |