| 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 #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 Loading... |
| 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 |
| OLD | NEW |