Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: crypto/hkdf.h

Issue 12326029: Porting of HKDF changes from server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac build fix# 2 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/hkdf.cc » ('j') | crypto/hkdf.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/hkdf.h
diff --git a/crypto/hkdf.h b/crypto/hkdf.h
new file mode 100644
index 0000000000000000000000000000000000000000..19065032a88d48bb2f999ab989801b9d0b57f1c5
--- /dev/null
+++ b/crypto/hkdf.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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
+#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.
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/string_piece.h"
+#include "build/build_config.h"
+#include "crypto/crypto_export.h"
+
+namespace crypto {
+
+// HKDF implements the key derivation function specified in RFC 5869 (using
+// 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
+class CRYPTO_EXPORT HKDF {
+ public:
+ // secret: the input secret.
+ // salt: the public salt.
+ // info: an (optional) label to distinguish different uses of HKDF.
+ // key_bytes_to_generate: the number of bytes of key material to generate.
+ // 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
+ HKDF(const base::StringPiece& secret,
+ const base::StringPiece& salt,
+ const base::StringPiece& info,
+ size_t key_bytes_to_generate,
+ size_t iv_bytes_to_generate);
+ virtual ~HKDF();
+
+ base::StringPiece client_write_key() const {
+ return client_write_key_;
+ }
+ base::StringPiece client_write_iv() const {
+ return client_write_iv_;
+ }
+ base::StringPiece server_write_key() const {
+ return server_write_key_;
+ }
+ base::StringPiece server_write_iv() const {
+ return server_write_iv_;
+ }
+
+ private:
+ std::vector<uint8> output_;
+
+ base::StringPiece client_write_key_;
+ base::StringPiece server_write_key_;
+ base::StringPiece client_write_iv_;
+ base::StringPiece server_write_iv_;
+};
+
+} // namespace crypto
+
+#endif // GFE_QUIC_CRYPTO_BASE_HKDF_H_
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/hkdf.cc » ('j') | crypto/hkdf.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698