aboutsummaryrefslogtreecommitdiff
path: root/src/megolm.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-17 11:52:06 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-24 13:39:34 +0100
commitcaaed796ad54de3f8ee1e56123973ae9ace346b9 (patch)
tree868178a8cf11c5f5c6b33e47a1e973ae26cd87ea /src/megolm.c
parent68d3c7bfa9d0d2f8a44edcd2d277c4a516ed6ed5 (diff)
Implementation of an outbound group session
Diffstat (limited to 'src/megolm.c')
-rw-r--r--src/megolm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/megolm.c b/src/megolm.c
index 36b0cc2..58fe725 100644
--- a/src/megolm.c
+++ b/src/megolm.c
@@ -18,8 +18,22 @@
#include <string.h>
+#include "olm/cipher.h"
#include "olm/crypto.h"
+const struct _olm_cipher *megolm_cipher() {
+ static const uint8_t CIPHER_KDF_INFO[] = "MEGOLM_KEYS";
+ static struct _olm_cipher *cipher;
+ static struct _olm_cipher_aes_sha_256 OLM_CIPHER;
+ if (!cipher) {
+ cipher = _olm_cipher_aes_sha_256_init(
+ &OLM_CIPHER,
+ CIPHER_KDF_INFO, sizeof(CIPHER_KDF_INFO) - 1
+ );
+ }
+ return cipher;
+}
+
/* the seeds used in the HMAC-SHA-256 functions for each part of the ratchet.
*/
#define HASH_KEY_SEED_LENGTH 1