aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/account.cpp7
-rw-r--r--src/olm.cpp2
-rw-r--r--src/session.cpp7
3 files changed, 6 insertions, 10 deletions
diff --git a/src/account.cpp b/src/account.cpp
index a171f5c..5bbd6a6 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -29,11 +29,12 @@ olm::OneTimeKey const * olm::Account::lookup_key(
}
std::size_t olm::Account::remove_key(
- std::uint32_t id
+ olm::Curve25519PublicKey const & public_key
) {
OneTimeKey * i;
for (i = one_time_keys.begin(); i != one_time_keys.end(); ++i) {
- if (i->id == id) {
+ if (0 == memcmp(i->key.public_key, public_key.public_key, 32)) {
+ std::uint32_t id = i->id;
one_time_keys.erase(i);
return id;
}
@@ -42,7 +43,7 @@ std::size_t olm::Account::remove_key(
}
std::size_t olm::Account::new_account_random_length() {
- return 103 * 32;
+ return 12 * 32;
}
std::size_t olm::Account::new_account(
diff --git a/src/olm.cpp b/src/olm.cpp
index ede9c26..65d0648 100644
--- a/src/olm.cpp
+++ b/src/olm.cpp
@@ -447,7 +447,7 @@ size_t olm_remove_one_time_keys(
OlmSession * session
) {
size_t result = from_c(account)->remove_key(
- from_c(session)->bob_one_time_key_id
+ from_c(session)->bob_one_time_key
);
if (result == std::size_t(-1)) {
from_c(account)->last_error = olm::ErrorCode::BAD_MESSAGE_KEY_ID;
diff --git a/src/session.cpp b/src/session.cpp
index f3b7637..4abf6cf 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -45,8 +45,7 @@ static const olm::KdfInfo OLM_KDF_INFO = {
olm::Session::Session(
) : ratchet(OLM_KDF_INFO, OLM_CIPHER),
last_error(olm::ErrorCode::SUCCESS),
- received_message(false),
- bob_one_time_key_id(0) {
+ received_message(false) {
}
@@ -157,7 +156,6 @@ std::size_t olm::Session::new_inbound_session(
last_error = olm::ErrorCode::BAD_MESSAGE_KEY_ID;
return std::size_t(-1);
}
- bob_one_time_key_id = our_one_time_key->id;
std::uint8_t shared_secret[96];
@@ -364,7 +362,6 @@ std::size_t olm::pickle_length(
length += olm::pickle_length(value.alice_identity_key);
length += olm::pickle_length(value.alice_base_key);
length += olm::pickle_length(value.bob_one_time_key);
- length += olm::pickle_length(value.bob_one_time_key_id);
length += olm::pickle_length(value.ratchet);
return length;
}
@@ -378,7 +375,6 @@ std::uint8_t * olm::pickle(
pos = olm::pickle(pos, value.alice_identity_key);
pos = olm::pickle(pos, value.alice_base_key);
pos = olm::pickle(pos, value.bob_one_time_key);
- pos = olm::pickle(pos, value.bob_one_time_key_id);
pos = olm::pickle(pos, value.ratchet);
return pos;
}
@@ -392,7 +388,6 @@ std::uint8_t const * olm::unpickle(
pos = olm::unpickle(pos, end, value.alice_identity_key);
pos = olm::unpickle(pos, end, value.alice_base_key);
pos = olm::unpickle(pos, end, value.bob_one_time_key);
- pos = olm::unpickle(pos, end, value.bob_one_time_key_id);
pos = olm::unpickle(pos, end, value.ratchet);
return pos;
}