diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-07-07 09:03:12 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-07-07 09:03:12 +0100 |
commit | a30a64d17931c43ca20090220272ce9257064072 (patch) | |
tree | 8d7d387dd9e5d13535a6061a33bdcca455664c2c | |
parent | f1cd5613f68beee08ab479edf2a5ae50c91a63fe (diff) |
Rename generate_key to curve25519_generate_key
-rw-r--r-- | include/olm/crypto.hh | 2 | ||||
-rw-r--r-- | src/account.cpp | 4 | ||||
-rw-r--r-- | src/crypto.cpp | 2 | ||||
-rw-r--r-- | src/ratchet.cpp | 2 | ||||
-rw-r--r-- | src/session.cpp | 4 | ||||
-rw-r--r-- | tests/test_crypto.cpp | 6 | ||||
-rw-r--r-- | tests/test_ratchet.cpp | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/include/olm/crypto.hh b/include/olm/crypto.hh index b299e12..7f8f069 100644 --- a/include/olm/crypto.hh +++ b/include/olm/crypto.hh @@ -34,7 +34,7 @@ struct Curve25519KeyPair : public Curve25519PublicKey { /** Generate a curve25519 key pair from 32 random bytes. */ -void generate_key( +void curve25519_generate_key( std::uint8_t const * random_32_bytes, Curve25519KeyPair & key_pair ); diff --git a/src/account.cpp b/src/account.cpp index 2323856..198c5d3 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -53,7 +53,7 @@ std::size_t olm::Account::new_account( unsigned id = 0; identity_key.id = ++id; - olm::generate_key(random, identity_key.key); + olm::curve25519_generate_key(random, identity_key.key); random += 32; random += 32; @@ -61,7 +61,7 @@ std::size_t olm::Account::new_account( for (unsigned i = 0; i < 10; ++i) { LocalKey & key = *one_time_keys.insert(one_time_keys.end()); key.id = ++id; - olm::generate_key(random, key.key); + olm::curve25519_generate_key(random, key.key); random += 32; } diff --git a/src/crypto.cpp b/src/crypto.cpp index ebe4724..db4bfa6 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -136,7 +136,7 @@ inline void hmac_sha256_final( } // namespace -void olm::generate_key( +void olm::curve25519_generate_key( std::uint8_t const * random_32_bytes, olm::Curve25519KeyPair & key_pair ) { diff --git a/src/ratchet.cpp b/src/ratchet.cpp index 2f361fa..b9108db 100644 --- a/src/ratchet.cpp +++ b/src/ratchet.cpp @@ -419,7 +419,7 @@ std::size_t olm::Ratchet::encrypt( if (sender_chain.empty()) { 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( root_key, sender_chain[0].ratchet_key, diff --git a/src/session.cpp b/src/session.cpp index a028431..08498e4 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -68,10 +68,10 @@ std::size_t olm::Session::new_outbound_session( } Curve25519KeyPair base_key; - olm::generate_key(random, base_key); + olm::curve25519_generate_key(random, base_key); Curve25519KeyPair ratchet_key; - olm::generate_key(random + 32, ratchet_key); + olm::curve25519_generate_key(random + 32, ratchet_key); received_message = false; alice_identity_key.id = local_account.identity_key.id; diff --git a/tests/test_crypto.cpp b/tests/test_crypto.cpp index 9b7637b..b8ffbcd 100644 --- a/tests/test_crypto.cpp +++ b/tests/test_crypto.cpp @@ -59,13 +59,13 @@ std::uint8_t expected_agreement[32] = { }; 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_public, alice_pair.public_key, 32); 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_public, bob_pair.public_key, 32); @@ -91,7 +91,7 @@ std::uint8_t message[] = "message"; std::size_t message_length = sizeof(message) - 1; olm::Curve25519KeyPair key_pair; -olm::generate_key(private_key, key_pair); +olm::curve25519_generate_key(private_key, key_pair); std::uint8_t signature[64]; diff --git a/tests/test_ratchet.cpp b/tests/test_ratchet.cpp index b2db8e7..cbb3c52 100644 --- a/tests/test_ratchet.cpp +++ b/tests/test_ratchet.cpp @@ -34,7 +34,7 @@ olm::CipherAesSha256 cipher( std::uint8_t random_bytes[] = "0123456789ABDEF0123456789ABCDEF"; 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"; |