Remove the last resort one time key

This commit is contained in:
Mark Haines 2015-07-07 09:01:38 +01:00
parent 667e415c74
commit f1cd5613f6
3 changed files with 4 additions and 10 deletions

View file

@ -32,9 +32,9 @@ struct LocalKey {
static std::size_t const MAX_ONE_TIME_KEYS = 100; static std::size_t const MAX_ONE_TIME_KEYS = 100;
struct Account { struct Account {
LocalKey identity_key; LocalKey identity_key;
LocalKey last_resort_one_time_key;
List<LocalKey, MAX_ONE_TIME_KEYS> one_time_keys; List<LocalKey, MAX_ONE_TIME_KEYS> one_time_keys;
ErrorCode last_error; ErrorCode last_error;

View file

@ -58,10 +58,6 @@ std::size_t olm::Account::new_account(
random += 32; random += 32;
last_resort_one_time_key.id = ++id;
olm::generate_key(random, last_resort_one_time_key.key);
random += 32;
for (unsigned i = 0; i < 10; ++i) { for (unsigned i = 0; i < 10; ++i) {
LocalKey & key = *one_time_keys.insert(one_time_keys.end()); LocalKey & key = *one_time_keys.insert(one_time_keys.end());
key.id = ++id; key.id = ++id;
@ -110,7 +106,6 @@ std::size_t olm::pickle_length(
) { ) {
std::size_t length = 0; std::size_t length = 0;
length += olm::pickle_length(value.identity_key); length += olm::pickle_length(value.identity_key);
length += olm::pickle_length(value.last_resort_one_time_key);
length += olm::pickle_length(value.one_time_keys); length += olm::pickle_length(value.one_time_keys);
return length; return length;
} }
@ -121,7 +116,6 @@ std::uint8_t * olm::pickle(
olm::Account const & value olm::Account const & value
) { ) {
pos = olm::pickle(pos, value.identity_key); pos = olm::pickle(pos, value.identity_key);
pos = olm::pickle(pos, value.last_resort_one_time_key);
pos = olm::pickle(pos, value.one_time_keys); pos = olm::pickle(pos, value.one_time_keys);
return pos; return pos;
} }
@ -132,7 +126,6 @@ std::uint8_t const * olm::unpickle(
olm::Account & value olm::Account & value
) { ) {
pos = olm::unpickle(pos, end, value.identity_key); pos = olm::unpickle(pos, end, value.identity_key);
pos = olm::unpickle(pos, end, value.last_resort_one_time_key);
pos = olm::unpickle(pos, end, value.one_time_keys); pos = olm::unpickle(pos, end, value.one_time_keys);
return pos; return pos;
} }

View file

@ -396,11 +396,12 @@ size_t olm_account_one_time_keys(
return size_t(-1); return size_t(-1);
} }
std::uint8_t * output = from_c(identity_keys); std::uint8_t * output = from_c(identity_keys);
output_key(from_c(account)->last_resort_one_time_key, '[', output); std::uint8_t sep = '[';
output += OUTPUT_KEY_LENGTH; output += OUTPUT_KEY_LENGTH;
for (auto const & key : from_c(account)->one_time_keys) { for (auto const & key : from_c(account)->one_time_keys) {
output_key(key, ',', output); output_key(key, sep, output);
output += OUTPUT_KEY_LENGTH; output += OUTPUT_KEY_LENGTH;
sep = ',';
} }
output[0] = ']'; output[0] = ']';
return length; return length;