aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2017-02-05 19:06:00 +0000
committerDr. David Alan Gilbert <dave@treblig.org>2018-02-25 02:08:49 +0000
commit22274a84c0255cc39134bd06896d3518a66a38d4 (patch)
tree0d997c65c326c391a19d0ad49bafce96dadcbb68
parentda5db06e8e057fb4f4e235f0d5322296fc44d953 (diff)
downloadpurple-matrix-22274a84c0255cc39134bd06896d3518a66a38d4.tar.gz
e2e: Create MatrixE2EData type and matrix-e2e.[ch] files
Somewhere for the e2e magic to happen. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
-rw-r--r--Makefile.common1
-rw-r--r--matrix-connection.h3
-rw-r--r--matrix-e2e.c34
-rw-r--r--matrix-e2e.h24
4 files changed, 62 insertions, 0 deletions
diff --git a/Makefile.common b/Makefile.common
index d31f2d8..219f74f 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -13,6 +13,7 @@ CFLAGS+=-DMATRIX_NO_E2E
endif
OBJECTS = libmatrix.o matrix-api.o matrix-connection.o \
+ matrix-e2e.o \
matrix-event.o \
matrix-json.o \
matrix-room.o \
diff --git a/matrix-connection.h b/matrix-connection.h
index e5be783..b7d8e21 100644
--- a/matrix-connection.h
+++ b/matrix-connection.h
@@ -29,6 +29,7 @@
#include <glib.h>
struct _PurpleConnection;
+struct _MatrixE2EData;
typedef struct _MatrixConnectionData {
struct _PurpleConnection *pc;
@@ -38,6 +39,8 @@ typedef struct _MatrixConnectionData {
/* the active sync request */
struct _MatrixApiRequestData *active_sync;
+ /* All the end-2-end encryption magic */
+ struct _MatrixE2EData *e2e;
} MatrixConnectionData;
diff --git a/matrix-e2e.c b/matrix-e2e.c
new file mode 100644
index 0000000..ec28820
--- /dev/null
+++ b/matrix-e2e.c
@@ -0,0 +1,34 @@
+/**
+ * Matrix end-to-end encryption support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#include <stdio.h>
+#include "libmatrix.h"
+#include "matrix-e2e.h"
+
+#include "connection.h"
+#ifndef MATRIX_NO_E2E
+#include "olm/olm.h"
+
+struct _MatrixE2EData {
+ OlmAccount *oa;
+ gchar *device_id;
+};
+
+#else
+/* ==== Stubs for when e2e is configured out of the build === */
+#endif
diff --git a/matrix-e2e.h b/matrix-e2e.h
new file mode 100644
index 0000000..a2d8f9b
--- /dev/null
+++ b/matrix-e2e.h
@@ -0,0 +1,24 @@
+/**
+ * Matrix end-to-end encryption support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#ifndef MATRIX_E2E_H
+#define MATRIX_E2E_H
+
+typedef struct _MatrixE2EData MatrixE2EData;
+
+#endif