aboutsummaryrefslogtreecommitdiff
path: root/src/message.cpp
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-08 14:53:25 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-08 14:53:25 +0100
commit5291ec78b5e0187aa873f911b9d907aa0139def5 (patch)
tree16e95740fd8c4455c109dee07e438431c63c1c53 /src/message.cpp
parent974e0984bd0d618093669780a75739d4b02fd3b2 (diff)
Send the public part of the one time key rather than passing an identifier
Diffstat (limited to 'src/message.cpp')
-rw-r--r--src/message.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/message.cpp b/src/message.cpp
index af43916..93473b9 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -232,7 +232,7 @@ void olm::decode_message(
namespace {
-static std::uint8_t const ONE_TIME_KEY_ID_TAG = 010;
+static std::uint8_t const ONE_TIME_KEY_ID_TAG = 012;
static std::uint8_t const BASE_KEY_TAG = 022;
static std::uint8_t const IDENTITY_KEY_TAG = 032;
static std::uint8_t const MESSAGE_TAG = 042;
@@ -241,13 +241,13 @@ static std::uint8_t const MESSAGE_TAG = 042;
std::size_t olm::encode_one_time_key_message_length(
- std::uint32_t one_time_key_id,
+ std::size_t one_time_key_length,
std::size_t identity_key_length,
std::size_t base_key_length,
std::size_t message_length
) {
std::size_t length = VERSION_LENGTH;
- length += 1 + varint_length(one_time_key_id);
+ length += 1 + varstring_length(one_time_key_length);
length += 1 + varstring_length(identity_key_length);
length += 1 + varstring_length(base_key_length);
length += 1 + varstring_length(message_length);
@@ -258,15 +258,15 @@ std::size_t olm::encode_one_time_key_message_length(
void olm::encode_one_time_key_message(
olm::PreKeyMessageWriter & writer,
std::uint8_t version,
- std::uint32_t one_time_key_id,
std::size_t identity_key_length,
std::size_t base_key_length,
+ std::size_t one_time_key_length,
std::size_t message_length,
std::uint8_t * output
) {
std::uint8_t * pos = output;
*(pos++) = version;
- pos = encode(pos, ONE_TIME_KEY_ID_TAG, one_time_key_id);
+ pos = encode(pos, ONE_TIME_KEY_ID_TAG, writer.one_time_key, one_time_key_length);
pos = encode(pos, BASE_KEY_TAG, writer.base_key, base_key_length);
pos = encode(pos, IDENTITY_KEY_TAG, writer.identity_key, identity_key_length);
pos = encode(pos, MESSAGE_TAG, writer.message, message_length);
@@ -283,7 +283,7 @@ void olm::decode_one_time_key_message(
if (pos == end) return;
reader.version = *(pos++);
- reader.has_one_time_key_id = false;
+ reader.one_time_key = nullptr;
reader.identity_key = nullptr;
reader.base_key = nullptr;
reader.message = nullptr;
@@ -291,7 +291,7 @@ void olm::decode_one_time_key_message(
while (pos != end) {
pos = decode(
pos, end, ONE_TIME_KEY_ID_TAG,
- reader.one_time_key_id, reader.has_one_time_key_id
+ reader.one_time_key, reader.one_time_key_length
);
pos = decode(
pos, end, BASE_KEY_TAG,