aboutsummaryrefslogtreecommitdiff
path: root/src/ratchet.cpp
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-09-02 15:13:24 +0100
committerRichard van der Hoff <richard@matrix.org>2016-09-05 10:40:39 +0100
commitf0acf6582f88ca66b3fabf7d622278da51a94c10 (patch)
tree28581d2ab5ec6cfd835b18aa9be9e1a46109d2b8 /src/ratchet.cpp
parent2aad4cfa860e33228372d525b4bc6a8bcdfbb8f6 (diff)
Convert Ed25519 and Curve25519 functions to plain C
Diffstat (limited to 'src/ratchet.cpp')
-rw-r--r--src/ratchet.cpp15
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;