aboutsummaryrefslogtreecommitdiff
path: root/src/olm.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/olm.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/olm.cpp')
-rw-r--r--src/olm.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/olm.cpp b/src/olm.cpp
index 682a84c..10e00fa 100644
--- a/src/olm.cpp
+++ b/src/olm.cpp
@@ -436,8 +436,8 @@ size_t olm_create_outbound_session(
std::size_t id_key_length = their_identity_key_length;
std::size_t ot_key_length = their_one_time_key_length;
- if (olm::decode_base64_length(id_key_length) != olm::KEY_LENGTH
- || olm::decode_base64_length(ot_key_length) != olm::KEY_LENGTH
+ if (olm::decode_base64_length(id_key_length) != CURVE25519_KEY_LENGTH
+ || olm::decode_base64_length(ot_key_length) != CURVE25519_KEY_LENGTH
) {
from_c(session)->last_error = OlmErrorCode::OLM_INVALID_BASE64;
return std::size_t(-1);
@@ -483,7 +483,7 @@ size_t olm_create_inbound_session_from(
std::uint8_t const * id_key = from_c(their_identity_key);
std::size_t id_key_length = their_identity_key_length;
- if (olm::decode_base64_length(id_key_length) != olm::KEY_LENGTH) {
+ if (olm::decode_base64_length(id_key_length) != CURVE25519_KEY_LENGTH) {
from_c(session)->last_error = OlmErrorCode::OLM_INVALID_BASE64;
return std::size_t(-1);
}
@@ -554,7 +554,7 @@ size_t olm_matches_inbound_session_from(
std::uint8_t const * id_key = from_c(their_identity_key);
std::size_t id_key_length = their_identity_key_length;
- if (olm::decode_base64_length(id_key_length) != olm::KEY_LENGTH) {
+ if (olm::decode_base64_length(id_key_length) != CURVE25519_KEY_LENGTH) {
from_c(session)->last_error = OlmErrorCode::OLM_INVALID_BASE64;
return std::size_t(-1);
}
@@ -710,7 +710,7 @@ size_t olm_ed25519_verify(
void const * message, size_t message_length,
void * signature, size_t signature_length
) {
- if (olm::decode_base64_length(key_length) != olm::KEY_LENGTH) {
+ if (olm::decode_base64_length(key_length) != CURVE25519_KEY_LENGTH) {
from_c(utility)->last_error = OlmErrorCode::OLM_INVALID_BASE64;
return std::size_t(-1);
}