From 97c110f24ba99576ba27d469d1f4b911768d8b9e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 30 Jun 2016 14:14:35 +0100 Subject: [PATCH] Include chain_index in session pickle Write a different version of the session pickle for the logging_enabled branch which includes the chain_index. --- src/ratchet.cpp | 5 +++-- src/session.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ratchet.cpp b/src/ratchet.cpp index 6d266e9..5534fc8 100644 --- a/src/ratchet.cpp +++ b/src/ratchet.cpp @@ -381,6 +381,7 @@ std::size_t olm::pickle_length( length += olm::pickle_length(value.sender_chain); length += olm::pickle_length(value.receiver_chains); length += olm::pickle_length(value.skipped_message_keys); + length += olm::pickle_length(value.chain_index); return length; } @@ -392,6 +393,7 @@ std::uint8_t * olm::pickle( pos = pickle(pos, value.sender_chain); pos = pickle(pos, value.receiver_chains); pos = pickle(pos, value.skipped_message_keys); + pos = pickle(pos, value.chain_index); return pos; } @@ -408,8 +410,7 @@ std::uint8_t const * olm::unpickle( // pickle v 0x80000001 includes a chain index; pickle v1 does not. if (includes_chain_index) { - std::uint32_t dummy; - pos = unpickle(pos, end, dummy); + pos = unpickle(pos, end, value.chain_index); } return pos; } diff --git a/src/session.cpp b/src/session.cpp index fddcdd9..e75a117 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -454,7 +454,7 @@ std::size_t olm::Session::decrypt( namespace { // the master branch writes pickle version 1; the logging_enabled branch writes // 0x80000001. -static const std::uint32_t SESSION_PICKLE_VERSION = 1; +static const std::uint32_t SESSION_PICKLE_VERSION = 0x80000001; } std::size_t olm::pickle_length(