This source file includes following definitions.
- TEST
#include "crypto/curve25519.h"
#include <string>
#include "crypto/random.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace crypto {
TEST(Curve25519, SharedKeyIdentity) {
uint8 alice_private_key[curve25519::kScalarBytes] = {3};
uint8 bob_private_key[curve25519::kScalarBytes] = {5};
uint8 alice_public_key[curve25519::kBytes];
curve25519::ScalarBaseMult(alice_private_key, alice_public_key);
uint8 bob_public_key[curve25519::kBytes];
curve25519::ScalarBaseMult(bob_private_key, bob_public_key);
uint8 alice_shared_key[curve25519::kBytes];
curve25519::ScalarMult(alice_private_key, bob_public_key, alice_shared_key);
uint8 bob_shared_key[curve25519::kBytes];
curve25519::ScalarMult(bob_private_key, alice_public_key, bob_shared_key);
ASSERT_EQ(0, memcmp(alice_shared_key, bob_shared_key, curve25519::kBytes));
}
}