aboutsummaryrefslogtreecommitdiff
path: root/src/utility.cpp
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-08-19 17:18:09 +0100
committerMark Haines <mark.haines@matrix.org>2015-08-19 17:32:06 +0100
commitb3180551851d6f736a98eb059d5b46b0872666e2 (patch)
treeeab45e085474fe190d9a87d16ed284a407d96925 /src/utility.cpp
parenta378a40b3a139b789b00d778c1091a0818c4a8ad (diff)
Replace hard coded references to the 32-byte key length with a constant, add utilities for copying data to and from fixed sized arrays
Diffstat (limited to 'src/utility.cpp')
-rw-r--r--src/utility.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utility.cpp b/src/utility.cpp
index 1d8c5c1..bc51cff 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -23,7 +23,7 @@ olm::Utility::Utility(
size_t olm::Utility::sha256_length() {
- return olm::HMAC_SHA256_OUTPUT_LENGTH;
+ return olm::SHA256_OUTPUT_LENGTH;
}
@@ -36,7 +36,7 @@ size_t olm::Utility::sha256(
return std::size_t(-1);
}
olm::sha256(input, input_length, output);
- return 32;
+ return olm::SHA256_OUTPUT_LENGTH;
}
@@ -45,7 +45,7 @@ size_t olm::Utility::ed25519_verify(
std::uint8_t const * message, std::size_t message_length,
std::uint8_t const * signature, std::size_t signature_length
) {
- if (signature_length < 64) {
+ if (signature_length < olm::SIGNATURE_LENGTH) {
last_error = olm::ErrorCode::BAD_MESSAGE_MAC;
return std::size_t(-1);
}