diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-06-16 15:15:40 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-06-16 15:15:40 +0100 |
commit | 76f49cf17780c155dd02d39ebc40e1f62c0c2503 (patch) | |
tree | e4194d0feca2ac165ee8335af9155c981c1bbb0b /src/ratchet.cpp | |
parent | 11861404e444795a5437dcf193e71f68a96b5a59 (diff) |
Add a test for the axolotl API
Diffstat (limited to 'src/ratchet.cpp')
-rw-r--r-- | src/ratchet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ratchet.cpp b/src/ratchet.cpp index 24f0ac2..37d2d4e 100644 --- a/src/ratchet.cpp +++ b/src/ratchet.cpp @@ -141,12 +141,12 @@ std::size_t verify_mac_and_decrypt_for_new_chain( /* They shouldn't move to a new chain until we've sent them a message * acknowledging the last one */ if (session.sender_chain.empty()) { - return false; + return std::size_t(-1); } /* Limit the number of hashes we're prepared to compute */ if (reader.counter > MAX_MESSAGE_GAP) { - return false; + return std::size_t(-1); } std::memcpy( new_chain.ratchet_key.public_key, reader.ratchet_key, KEY_LENGTH @@ -191,6 +191,7 @@ void axolotl::Ratchet::initialise_as_bob( derived_secrets, sizeof(derived_secrets) ); receiver_chains.insert(); + receiver_chains[0].chain_key.index = 0; std::memcpy(root_key, derived_secrets, 32); std::memcpy(receiver_chains[0].chain_key.key, derived_secrets + 32, 32); receiver_chains[0].ratchet_key = their_ratchet_key; @@ -210,6 +211,7 @@ void axolotl::Ratchet::initialise_as_alice( derived_secrets, sizeof(derived_secrets) ); sender_chain.insert(); + sender_chain[0].chain_key.index = 0; std::memcpy(root_key, derived_secrets, 32); std::memcpy(sender_chain[0].chain_key.key, derived_secrets + 32, 32); sender_chain[0].ratchet_key = our_ratchet_key; |