| 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/curve25519.h" | 5 #include "crypto/curve25519.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <string> | 9 #include <string> |
| 8 | 10 |
| 9 #include "crypto/random.h" | 11 #include "crypto/random.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 13 |
| 12 namespace crypto { | 14 namespace crypto { |
| 13 | 15 |
| 14 // Test that the basic shared key exchange identity holds: that both parties end | 16 // Test that the basic shared key exchange identity holds: that both parties end |
| 15 // up with the same shared key. This test starts with a fixed private key for | 17 // up with the same shared key. This test starts with a fixed private key for |
| 16 // two parties: alice and bob. Runs ScalarBaseMult and ScalarMult to compute | 18 // two parties: alice and bob. Runs ScalarBaseMult and ScalarMult to compute |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, | 50 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 uint8_t out[32], private_key[32]; | 53 uint8_t out[32], private_key[32]; |
| 52 memset(private_key, 0x11, sizeof(private_key)); | 54 memset(private_key, 0x11, sizeof(private_key)); |
| 53 | 55 |
| 54 EXPECT_FALSE(curve25519::ScalarMult(private_key, kSmallOrderPoint, out)); | 56 EXPECT_FALSE(curve25519::ScalarMult(private_key, kSmallOrderPoint, out)); |
| 55 } | 57 } |
| 56 | 58 |
| 57 } // namespace crypto | 59 } // namespace crypto |
| OLD | NEW |