aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-06-30 14:01:02 +0100
committerRichard van der Hoff <richard@matrix.org>2016-06-30 14:01:02 +0100
commitd8b24acb779db5314cc6c1f2e35da27b7b655c29 (patch)
treeb4a15ec31a96e7377047075233b6024c7cc1cd18 /src
parent8dd3c182ee568b9121a336b106aaaceedd1cc470 (diff)
PR feedback
* write V1 pickles on the master branch * the logging branch is going to write v0x80000001
Diffstat (limited to 'src')
-rw-r--r--src/ratchet.cpp11
-rw-r--r--src/session.cpp6
2 files changed, 5 insertions, 12 deletions
diff --git a/src/ratchet.cpp b/src/ratchet.cpp
index 671d260..aab5fbb 100644
--- a/src/ratchet.cpp
+++ b/src/ratchet.cpp
@@ -363,10 +363,6 @@ 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);
-
- // the logging_enabled branch includes a 'chain_index' field
- length += olm::pickle_length(std::uint32_t(0));
-
return length;
}
@@ -378,11 +374,6 @@ std::uint8_t * olm::pickle(
pos = pickle(pos, value.sender_chain);
pos = pickle(pos, value.receiver_chains);
pos = pickle(pos, value.skipped_message_keys);
-
- // the logging_enabled branch includes a 'chain_index' field; for us, it is
- // empty.
- pos = pickle(pos, std::uint32_t(0));
-
return pos;
}
@@ -397,7 +388,7 @@ std::uint8_t const * olm::unpickle(
pos = unpickle(pos, end, value.receiver_chains);
pos = unpickle(pos, end, value.skipped_message_keys);
- // pickle v2 includes a chain index; pickle v1 did not.
+ // pickle v 0x80000001 includes a chain index; pickle v1 does not.
if (includes_chain_index) {
std::uint32_t dummy;
pos = unpickle(pos, end, dummy);
diff --git a/src/session.cpp b/src/session.cpp
index b76a6b8..6ca7f36 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -396,7 +396,9 @@ std::size_t olm::Session::decrypt(
}
namespace {
-static const std::uint32_t SESSION_PICKLE_VERSION = 2;
+// the master branch writes pickle version 1; the logging_enabled branch writes
+// 0x80000001.
+static const std::uint32_t SESSION_PICKLE_VERSION = 1;
}
std::size_t olm::pickle_length(
@@ -440,7 +442,7 @@ std::uint8_t const * olm::unpickle(
includes_chain_index = false;
break;
- case 2:
+ case 0x80000001UL:
includes_chain_index = true;
break;