aboutsummaryrefslogtreecommitdiff
path: root/src/account.cpp
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-09-02 15:11:14 +0100
committerRichard van der Hoff <richard@matrix.org>2016-09-02 15:11:14 +0100
commit39212987bdef8e16794e756e3c78b531be25b70a (patch)
tree659be65eb1b131073bf9580292214b3fc24aa982 /src/account.cpp
parent0c3f527dfd46d3056d5b3690836c102f0e0adfb4 (diff)
Create new constants for key lengths, etc
We were using olm::KEY_LENGTH for everything under the sun which happened to be 32 bytes long, and making a bunch of assumptions in the process. Create a bunch of new constants (as C #defines rather than C++ consts so that I can use them in another forthcoming refactor).
Diffstat (limited to 'src/account.cpp')
-rw-r--r--src/account.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/account.cpp b/src/account.cpp
index ec763f8..9512068 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -49,7 +49,7 @@ std::size_t olm::Account::remove_key(
}
std::size_t olm::Account::new_account_random_length() {
- return 2 * olm::KEY_LENGTH;
+ return ED25519_RANDOM_LENGTH + CURVE25519_RANDOM_LENGTH;
}
std::size_t olm::Account::new_account(
@@ -61,7 +61,7 @@ std::size_t olm::Account::new_account(
}
olm::ed25519_generate_key(random, identity_keys.ed25519_key);
- random += KEY_LENGTH;
+ random += ED25519_RANDOM_LENGTH;
olm::curve25519_generate_key(random, identity_keys.curve25519_key);
return 0;
@@ -137,7 +137,7 @@ std::size_t olm::Account::get_identity_json(
std::size_t olm::Account::signature_length(
) {
- return olm::SIGNATURE_LENGTH;
+ return ED25519_SIGNATURE_LENGTH;
}
@@ -238,7 +238,7 @@ std::size_t olm::Account::max_number_of_one_time_keys(
std::size_t olm::Account::generate_one_time_keys_random_length(
std::size_t number_of_keys
) {
- return olm::KEY_LENGTH * number_of_keys;
+ return CURVE25519_RANDOM_LENGTH * number_of_keys;
}
std::size_t olm::Account::generate_one_time_keys(
@@ -254,7 +254,7 @@ std::size_t olm::Account::generate_one_time_keys(
key.id = ++next_one_time_key_id;
key.published = false;
olm::curve25519_generate_key(random, key.key);
- random += olm::KEY_LENGTH;
+ random += CURVE25519_RANDOM_LENGTH;
}
return number_of_keys;
}