diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2016-09-05 10:42:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-05 10:42:09 +0100 |
commit | 057ab15c1a9bd6e09b31955e840861151b5ad69e (patch) | |
tree | 140b55571972ddf76c28515ec767ac01a5e21712 /src/ratchet.cpp | |
parent | 2aad4cfa860e33228372d525b4bc6a8bcdfbb8f6 (diff) | |
parent | 69f269ffaf88515f6d5c0b34178bf0096cf5773b (diff) |
Merge pull request #14 from matrix-org/rav/convert_crypto_to_c
Convert crypto.hh into C-compatible interface
Diffstat (limited to 'src/ratchet.cpp')
-rw-r--r-- | src/ratchet.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ratchet.cpp b/src/ratchet.cpp index 57cb385..279c4c0 100644 --- a/src/ratchet.cpp +++ b/src/ratchet.cpp @@ -41,14 +41,14 @@ static const std::size_t MAX_MESSAGE_GAP = 2000; */ static void create_chain_key( olm::SharedKey const & root_key, - olm::Curve25519KeyPair const & our_key, - olm::Curve25519PublicKey const & their_key, + _olm_curve25519_key_pair const & our_key, + _olm_curve25519_public_key const & their_key, olm::KdfInfo const & info, olm::SharedKey & new_root_key, olm::ChainKey & new_chain_key ) { olm::SharedKey secret; - olm::curve25519_shared_secret(our_key, their_key, secret); + _olm_crypto_curve25519_shared_secret(&our_key, &their_key, secret); std::uint8_t derived_secrets[2 * olm::OLM_SHARED_KEY_LENGTH]; _olm_crypto_hkdf_sha256( secret, sizeof(secret), @@ -189,7 +189,7 @@ olm::Ratchet::Ratchet( void olm::Ratchet::initialise_as_bob( std::uint8_t const * shared_secret, std::size_t shared_secret_length, - olm::Curve25519PublicKey const & their_ratchet_key + _olm_curve25519_public_key const & their_ratchet_key ) { std::uint8_t derived_secrets[2 * olm::OLM_SHARED_KEY_LENGTH]; _olm_crypto_hkdf_sha256( @@ -210,7 +210,7 @@ void olm::Ratchet::initialise_as_bob( void olm::Ratchet::initialise_as_alice( std::uint8_t const * shared_secret, std::size_t shared_secret_length, - olm::Curve25519KeyPair const & our_ratchet_key + _olm_curve25519_key_pair const & our_ratchet_key ) { std::uint8_t derived_secrets[2 * olm::OLM_SHARED_KEY_LENGTH]; _olm_crypto_hkdf_sha256( @@ -437,7 +437,7 @@ std::size_t olm::Ratchet::encrypt( if (sender_chain.empty()) { sender_chain.insert(); - olm::curve25519_generate_key(random, sender_chain[0].ratchet_key); + _olm_crypto_curve25519_generate_key(random, &sender_chain[0].ratchet_key); create_chain_key( root_key, sender_chain[0].ratchet_key, @@ -456,7 +456,8 @@ std::size_t olm::Ratchet::encrypt( plaintext_length ); std::uint32_t counter = keys.index; - Curve25519PublicKey const & ratchet_key = sender_chain[0].ratchet_key; + _olm_curve25519_public_key const & ratchet_key = + sender_chain[0].ratchet_key.public_key; olm::MessageWriter writer; |