Commit a4e5bf97 authored by Mark Haines's avatar Mark Haines
Browse files

Don't bother passing through the mac_length, the caller already knows it since they supplied it

parent 5f9cc655
...@@ -18,12 +18,12 @@ public: ...@@ -18,12 +18,12 @@ public:
/** /**
* Is the list empty? * Is the list empty?
*/ */
bool empty() { return _end == _data; } bool empty() const { return _end == _data; }
/** /**
* The number of items in the list. * The number of items in the list.
*/ */
std::size_t size() { return _end - _data; } std::size_t size() const { return _end - _data; }
T & operator[](std::size_t index) { return _data[index]; } T & operator[](std::size_t index) { return _data[index]; }
......
...@@ -29,7 +29,6 @@ struct MessageReader { ...@@ -29,7 +29,6 @@ struct MessageReader {
std::uint32_t counter; std::uint32_t counter;
std::size_t ratchet_key_length; std::size_t ratchet_key_length;
std::size_t ciphertext_length; std::size_t ciphertext_length;
std::size_t mac_length;
std::uint8_t const * ratchet_key; std::uint8_t const * ratchet_key;
std::uint8_t const * ciphertext; std::uint8_t const * ciphertext;
std::uint8_t const * mac; std::uint8_t const * mac;
......
...@@ -120,7 +120,6 @@ axolotl::MessageReader axolotl::decode_message( ...@@ -120,7 +120,6 @@ axolotl::MessageReader axolotl::decode_message(
std::uint8_t const * end = input + input_length - mac_length; std::uint8_t const * end = input + input_length - mac_length;
std::uint8_t flags = 0; std::uint8_t flags = 0;
result.mac = end; result.mac = end;
result.mac_length = mac_length;
if (pos == end) return result; if (pos == end) return result;
result.version = *(pos++); result.version = *(pos++);
while (pos != end) { while (pos != end) {
......
...@@ -20,7 +20,6 @@ assert_equals(std::uint8_t(3), reader.version); ...@@ -20,7 +20,6 @@ assert_equals(std::uint8_t(3), reader.version);
assert_equals(std::uint32_t(1), reader.counter); assert_equals(std::uint32_t(1), reader.counter);
assert_equals(std::size_t(10), reader.ratchet_key_length); assert_equals(std::size_t(10), reader.ratchet_key_length);
assert_equals(std::size_t(10), reader.ciphertext_length); assert_equals(std::size_t(10), reader.ciphertext_length);
assert_equals(std::size_t(8), reader.mac_length);
assert_equals(ratchetkey, reader.ratchet_key, 10); assert_equals(ratchetkey, reader.ratchet_key, 10);
assert_equals(ciphertext, reader.ciphertext, 10); assert_equals(ciphertext, reader.ciphertext, 10);
...@@ -47,7 +46,6 @@ std::memcpy(writer.mac, hmacsha2, 8); ...@@ -47,7 +46,6 @@ std::memcpy(writer.mac, hmacsha2, 8);
assert_equals(message2, output, 35); assert_equals(message2, output, 35);
} /* Message encode test */ } /* Message encode test */
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment