aboutsummaryrefslogtreecommitdiff
path: root/include/olm/crypto.hh
diff options
context:
space:
mode:
Diffstat (limited to 'include/olm/crypto.hh')
-rw-r--r--include/olm/crypto.hh26
1 files changed, 10 insertions, 16 deletions
diff --git a/include/olm/crypto.hh b/include/olm/crypto.hh
index b845bfe..7a05f8d 100644
--- a/include/olm/crypto.hh
+++ b/include/olm/crypto.hh
@@ -20,28 +20,27 @@
namespace olm {
+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 {
- static const int LENGTH = 32;
- std::uint8_t public_key[32];
+ std::uint8_t public_key[KEY_LENGTH];
};
struct Curve25519KeyPair : public Curve25519PublicKey {
- static const int LENGTH = 64;
- std::uint8_t private_key[32];
+ std::uint8_t private_key[KEY_LENGTH];
};
struct Ed25519PublicKey {
- static const int LENGTH = 32;
- std::uint8_t public_key[32];
+ std::uint8_t public_key[KEY_LENGTH];
};
struct Ed25519KeyPair : public Ed25519PublicKey {
- static const int LENGTH = 64;
- std::uint8_t private_key[32];
+ std::uint8_t private_key[KEY_LENGTH];
};
@@ -52,9 +51,6 @@ void curve25519_generate_key(
);
-const std::size_t CURVE25519_SHARED_SECRET_LENGTH = 32;
-
-
/** Create a shared secret using our private key and their public key.
* The output buffer must be at least 32 bytes long. */
void curve25519_shared_secret(
@@ -109,14 +105,12 @@ bool ed25519_verify(
struct Aes256Key {
- static const int LENGTH = 32;
- std::uint8_t key[32];
+ std::uint8_t key[KEY_LENGTH];
};
struct Aes256Iv {
- static const int LENGTH = 16;
- std::uint8_t iv[16];
+ std::uint8_t iv[IV_LENGTH];
};
@@ -156,7 +150,7 @@ void sha256(
);
-const std::size_t HMAC_SHA256_OUTPUT_LENGTH = 32;
+const std::size_t SHA256_OUTPUT_LENGTH = 32;
/** HMAC: Keyed-Hashing for Message Authentication