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

Side by Side Diff: crypto/hkdf_unittest.cc

Issue 423333002: Implement QUIC key extraction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass a size_t constant as a size_t argument. Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "crypto/hkdf.h" 5 #include "crypto/hkdf.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ASSERT_TRUE(base::HexStringToBytes(info, &data)); 75 ASSERT_TRUE(base::HexStringToBytes(info, &data));
76 info.assign(reinterpret_cast<char*>(&data[0]), data.size()); 76 info.assign(reinterpret_cast<char*>(&data[0]), data.size());
77 } 77 }
78 78
79 data.clear(); 79 data.clear();
80 ASSERT_TRUE(base::HexStringToBytes(test.output_hex, &data)); 80 ASSERT_TRUE(base::HexStringToBytes(test.output_hex, &data));
81 const std::string expected(reinterpret_cast<char*>(&data[0]), data.size()); 81 const std::string expected(reinterpret_cast<char*>(&data[0]), data.size());
82 82
83 // We set the key_length to the length of the expected output and then take 83 // We set the key_length to the length of the expected output and then take
84 // the result from the first key, which is the client write key. 84 // the result from the first key, which is the client write key.
85 HKDF hkdf(key, salt, info, expected.size(), 0); 85 HKDF hkdf(key, salt, info, expected.size(), 0, 0);
86 86
87 ASSERT_EQ(expected.size(), hkdf.client_write_key().size()); 87 ASSERT_EQ(expected.size(), hkdf.client_write_key().size());
88 EXPECT_EQ(0, memcmp(expected.data(), hkdf.client_write_key().data(), 88 EXPECT_EQ(0, memcmp(expected.data(), hkdf.client_write_key().data(),
89 expected.size())); 89 expected.size()));
90 } 90 }
91 } 91 }
92 92
93 } // namespace 93 } // namespace
94 } // namespace test 94 } // namespace test
OLDNEW
« crypto/hkdf.h ('K') | « crypto/hkdf.cc ('k') | net/quic/crypto/crypto_handshake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698