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 "net/quic/core/crypto/p256_key_exchange.h" | 5 #include "net/quic/core/crypto/p256_key_exchange.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 ASSERT_FALSE(alice_private.empty()); | 23 ASSERT_FALSE(alice_private.empty()); |
24 ASSERT_FALSE(bob_private.empty()); | 24 ASSERT_FALSE(bob_private.empty()); |
25 ASSERT_NE(alice_private, bob_private); | 25 ASSERT_NE(alice_private, bob_private); |
26 | 26 |
27 std::unique_ptr<P256KeyExchange> alice(P256KeyExchange::New(alice_private)); | 27 std::unique_ptr<P256KeyExchange> alice(P256KeyExchange::New(alice_private)); |
28 std::unique_ptr<P256KeyExchange> bob(P256KeyExchange::New(bob_private)); | 28 std::unique_ptr<P256KeyExchange> bob(P256KeyExchange::New(bob_private)); |
29 | 29 |
30 ASSERT_TRUE(alice.get() != nullptr); | 30 ASSERT_TRUE(alice.get() != nullptr); |
31 ASSERT_TRUE(bob.get() != nullptr); | 31 ASSERT_TRUE(bob.get() != nullptr); |
32 | 32 |
33 const base::StringPiece alice_public(alice->public_value()); | 33 const QuicStringPiece alice_public(alice->public_value()); |
34 const base::StringPiece bob_public(bob->public_value()); | 34 const QuicStringPiece bob_public(bob->public_value()); |
35 | 35 |
36 std::string alice_shared, bob_shared; | 36 std::string alice_shared, bob_shared; |
37 ASSERT_TRUE(alice->CalculateSharedKey(bob_public, &alice_shared)); | 37 ASSERT_TRUE(alice->CalculateSharedKey(bob_public, &alice_shared)); |
38 ASSERT_TRUE(bob->CalculateSharedKey(alice_public, &bob_shared)); | 38 ASSERT_TRUE(bob->CalculateSharedKey(alice_public, &bob_shared)); |
39 ASSERT_EQ(alice_shared, bob_shared); | 39 ASSERT_EQ(alice_shared, bob_shared); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 } // namespace test | 43 } // namespace test |
44 } // namespace net | 44 } // namespace net |
OLD | NEW |