aboutsummaryrefslogtreecommitdiff
path: root/src/megolm.c
diff options
context:
space:
mode:
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