Rename generate_key to curve25519_generate_key

This commit is contained in:
Mark Haines 2015-07-07 09:03:12 +01:00
parent f1cd5613f6
commit a30a64d179
7 changed files with 11 additions and 11 deletions

View file

@ -34,7 +34,7 @@ struct Curve25519KeyPair : public Curve25519PublicKey {
/** Generate a curve25519 key pair from 32 random bytes. */ /** Generate a curve25519 key pair from 32 random bytes. */
void generate_key( void curve25519_generate_key(
std::uint8_t const * random_32_bytes, std::uint8_t const * random_32_bytes,
Curve25519KeyPair & key_pair Curve25519KeyPair & key_pair
); );

View file

@ -53,7 +53,7 @@ std::size_t olm::Account::new_account(
unsigned id = 0; unsigned id = 0;
identity_key.id = ++id; identity_key.id = ++id;
olm::generate_key(random, identity_key.key); olm::curve25519_generate_key(random, identity_key.key);
random += 32; random += 32;
random += 32; random += 32;
@ -61,7 +61,7 @@ std::size_t olm::Account::new_account(
for (unsigned i = 0; i < 10; ++i) { for (unsigned i = 0; i < 10; ++i) {
LocalKey & key = *one_time_keys.insert(one_time_keys.end()); LocalKey & key = *one_time_keys.insert(one_time_keys.end());
key.id = ++id; key.id = ++id;
olm::generate_key(random, key.key); olm::curve25519_generate_key(random, key.key);
random += 32; random += 32;
} }

View file

@ -136,7 +136,7 @@ inline void hmac_sha256_final(
} // namespace } // namespace
void olm::generate_key( void olm::curve25519_generate_key(
std::uint8_t const * random_32_bytes, std::uint8_t const * random_32_bytes,
olm::Curve25519KeyPair & key_pair olm::Curve25519KeyPair & key_pair
) { ) {

View file

@ -419,7 +419,7 @@ std::size_t olm::Ratchet::encrypt(
if (sender_chain.empty()) { if (sender_chain.empty()) {
sender_chain.insert(); sender_chain.insert();
olm::generate_key(random, sender_chain[0].ratchet_key); olm::curve25519_generate_key(random, sender_chain[0].ratchet_key);
create_chain_key( create_chain_key(
root_key, root_key,
sender_chain[0].ratchet_key, sender_chain[0].ratchet_key,

View file

@ -68,10 +68,10 @@ std::size_t olm::Session::new_outbound_session(
} }
Curve25519KeyPair base_key; Curve25519KeyPair base_key;
olm::generate_key(random, base_key); olm::curve25519_generate_key(random, base_key);
Curve25519KeyPair ratchet_key; Curve25519KeyPair ratchet_key;
olm::generate_key(random + 32, ratchet_key); olm::curve25519_generate_key(random + 32, ratchet_key);
received_message = false; received_message = false;
alice_identity_key.id = local_account.identity_key.id; alice_identity_key.id = local_account.identity_key.id;

View file

@ -59,13 +59,13 @@ std::uint8_t expected_agreement[32] = {
}; };
olm::Curve25519KeyPair alice_pair; olm::Curve25519KeyPair alice_pair;
olm::generate_key(alice_private, alice_pair); olm::curve25519_generate_key(alice_private, alice_pair);
assert_equals(alice_private, alice_pair.private_key, 32); assert_equals(alice_private, alice_pair.private_key, 32);
assert_equals(alice_public, alice_pair.public_key, 32); assert_equals(alice_public, alice_pair.public_key, 32);
olm::Curve25519KeyPair bob_pair; olm::Curve25519KeyPair bob_pair;
olm::generate_key(bob_private, bob_pair); olm::curve25519_generate_key(bob_private, bob_pair);
assert_equals(bob_private, bob_pair.private_key, 32); assert_equals(bob_private, bob_pair.private_key, 32);
assert_equals(bob_public, bob_pair.public_key, 32); assert_equals(bob_public, bob_pair.public_key, 32);
@ -91,7 +91,7 @@ std::uint8_t message[] = "message";
std::size_t message_length = sizeof(message) - 1; std::size_t message_length = sizeof(message) - 1;
olm::Curve25519KeyPair key_pair; olm::Curve25519KeyPair key_pair;
olm::generate_key(private_key, key_pair); olm::curve25519_generate_key(private_key, key_pair);
std::uint8_t signature[64]; std::uint8_t signature[64];

View file

@ -34,7 +34,7 @@ olm::CipherAesSha256 cipher(
std::uint8_t random_bytes[] = "0123456789ABDEF0123456789ABCDEF"; std::uint8_t random_bytes[] = "0123456789ABDEF0123456789ABCDEF";
olm::Curve25519KeyPair alice_key; olm::Curve25519KeyPair alice_key;
olm::generate_key(random_bytes, alice_key); olm::curve25519_generate_key(random_bytes, alice_key);
std::uint8_t shared_secret[] = "A secret"; std::uint8_t shared_secret[] = "A secret";