aboutsummaryrefslogtreecommitdiff
path: root/include/olm/crypto.h
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2016-09-05 10:36:43 +0100
committerGitHub <noreply@github.com>2016-09-05 10:36:43 +0100
commit9d16d820890e7b301baa8b69694aaea19f9bfc7f (patch)
tree659be65eb1b131073bf9580292214b3fc24aa982 /include/olm/crypto.h
parent0c3f527dfd46d3056d5b3690836c102f0e0adfb4 (diff)
parent39212987bdef8e16794e756e3c78b531be25b70a (diff)
Merge pull request #13 from matrix-org/rav/split_out_key_lengths
Create new constants for key lengths, etc
Diffstat (limited to 'include/olm/crypto.h')
-rw-r--r--include/olm/crypto.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/include/olm/crypto.h b/include/olm/crypto.h
index 31b9b60..325080e 100644
--- a/include/olm/crypto.h
+++ b/include/olm/crypto.h
@@ -27,7 +27,36 @@
extern "C" {
#endif
-const size_t SHA256_OUTPUT_LENGTH = 32;
+/** length of a sha256 hash */
+#define SHA256_OUTPUT_LENGTH 32
+
+/** length of a public or private Curve25519 key */
+#define CURVE25519_KEY_LENGTH 32
+
+/** length of the shared secret created by a Curve25519 ECDH operation */
+#define CURVE25519_SHARED_SECRET_LENGTH 32
+
+/** amount of random data required to create a Curve25519 keypair */
+#define CURVE25519_RANDOM_LENGTH CURVE25519_KEY_LENGTH
+
+/** length of a public Ed25519 key */
+#define ED25519_PUBLIC_KEY_LENGTH 32
+
+/** length of a private Ed25519 key */
+#define ED25519_PRIVATE_KEY_LENGTH 64
+
+/** amount of random data required to create a Ed25519 keypair */
+#define ED25519_RANDOM_LENGTH 32
+
+/** length of an Ed25519 signature */
+#define ED25519_SIGNATURE_LENGTH 64
+
+/** length of an aes256 key */
+#define AES256_KEY_LENGTH 32
+
+/** length of an aes256 initialisation vector */
+#define AES256_IV_LENGTH 16
+
/** Computes SHA-256 of the input. The output buffer must be a least 32
* bytes long. */