aboutsummaryrefslogtreecommitdiff
path: root/include/olm/crypto.hh
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 /include/olm/crypto.hh
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 'include/olm/crypto.hh')
-rw-r--r--include/olm/crypto.hh15
1 files changed, 5 insertions, 10 deletions
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];
};