diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-09-02 15:11:14 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-09-02 15:11:14 +0100 |
commit | 39212987bdef8e16794e756e3c78b531be25b70a (patch) | |
tree | 659be65eb1b131073bf9580292214b3fc24aa982 /src/crypto.cpp | |
parent | 0c3f527dfd46d3056d5b3690836c102f0e0adfb4 (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/crypto.cpp')
-rw-r--r-- | src/crypto.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crypto.cpp b/src/crypto.cpp index 83493be..0b08c54 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -31,7 +31,7 @@ namespace { static const std::uint8_t CURVE25519_BASEPOINT[32] = {9}; static const std::size_t AES_KEY_SCHEDULE_LENGTH = 60; -static const std::size_t AES_KEY_BITS = 8 * olm::KEY_LENGTH; +static const std::size_t AES_KEY_BITS = 8 * AES256_KEY_LENGTH; static const std::size_t AES_BLOCK_LENGTH = 16; static const std::size_t SHA256_BLOCK_LENGTH = 64; static const std::uint8_t HKDF_DEFAULT_SALT[32] = {}; @@ -104,7 +104,7 @@ void olm::curve25519_generate_key( std::uint8_t const * random_32_bytes, olm::Curve25519KeyPair & key_pair ) { - std::memcpy(key_pair.private_key, random_32_bytes, KEY_LENGTH); + std::memcpy(key_pair.private_key, random_32_bytes, CURVE25519_KEY_LENGTH); ::curve25519_donna( key_pair.public_key, key_pair.private_key, CURVE25519_BASEPOINT ); |