From 39212987bdef8e16794e756e3c78b531be25b70a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 2 Sep 2016 15:11:14 +0100 Subject: 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). --- include/olm/crypto.hh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'include/olm/crypto.hh') diff --git a/include/olm/crypto.hh b/include/olm/crypto.hh index 484dc83..13fd7e9 100644 --- a/include/olm/crypto.hh +++ b/include/olm/crypto.hh @@ -25,23 +25,18 @@ namespace olm { -static const std::size_t ED25519_PRIVATE_KEY_LENGTH = 64; -static const std::size_t KEY_LENGTH = 32; -static const std::size_t SIGNATURE_LENGTH = 64; -static const std::size_t IV_LENGTH = 16; - struct Curve25519PublicKey { - std::uint8_t public_key[KEY_LENGTH]; + std::uint8_t public_key[CURVE25519_KEY_LENGTH]; }; struct Curve25519KeyPair : public Curve25519PublicKey { - std::uint8_t private_key[KEY_LENGTH]; + std::uint8_t private_key[CURVE25519_KEY_LENGTH]; }; struct Ed25519PublicKey { - std::uint8_t public_key[KEY_LENGTH]; + std::uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH]; }; @@ -93,12 +88,12 @@ bool ed25519_verify( struct Aes256Key { - std::uint8_t key[KEY_LENGTH]; + std::uint8_t key[AES256_KEY_LENGTH]; }; struct Aes256Iv { - std::uint8_t iv[IV_LENGTH]; + std::uint8_t iv[AES256_IV_LENGTH]; }; -- cgit v1.2.3