Diff between 067c255878231c304cd786d974f0a35b04fde137 and 3785fca57cb2d3cb80e1e3f5290d297aa8a1a136

Changed Files

File Additions Deletions Status
android/Android.mk +1 -0 modified
android/Makefile.am +1 -0 modified
android/gatt.c +10 -1 modified

Full Patch

diff --git a/android/Android.mk b/android/Android.mk
index f59352a..f91c581 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -53,6 +53,7 @@ LOCAL_SRC_FILES := \
 	bluez/src/shared/hfp.c \
 	bluez/src/shared/gatt-db.c \
 	bluez/src/shared/io-glib.c \
+	bluez/src/shared/crypto.c \
 	bluez/src/sdpd-database.c \
 	bluez/src/sdpd-service.c \
 	bluez/src/sdpd-request.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index f2172a9..2d74505 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -31,6 +31,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				src/shared/ringbuf.h src/shared/ringbuf.c \
 				src/shared/hfp.h src/shared/hfp.c \
 				src/shared/gatt-db.h src/shared/gatt-db.c \
+				src/shared/crypto.h src/shared/crypto.c \
 				android/bluetooth.h android/bluetooth.c \
 				android/hidhost.h android/hidhost.c \
 				android/ipc-common.h \
diff --git a/android/gatt.c b/android/gatt.c
index 70cd5fe..4b3b837 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -44,6 +44,7 @@
 #include "src/shared/util.h"
 #include "src/shared/queue.h"
 #include "src/shared/gatt-db.h"
+#include "src/shared/crypto.h"
 #include "attrib/gattrib.h"
 #include "attrib/att.h"
 #include "attrib/gatt.h"
@@ -180,6 +181,8 @@ static struct gatt_db *gatt_db = NULL;
 
 static GIOChannel *listening_io = NULL;
 
+static struct bt_crypto *crypto = NULL;
+
 static void bt_le_discovery_stop_cb(void);
 
 static bool is_bluetooth_uuid(const uint8_t *uuid)
@@ -5246,9 +5249,10 @@ bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
 	app_connections = queue_new();
 	listen_apps = queue_new();
 	gatt_db = gatt_db_new();
+	crypto = bt_crypto_new();
 
 	if (!gatt_devices || !gatt_apps || !listen_apps ||
-						!app_connections || !gatt_db) {
+				!app_connections || !gatt_db || !crypto) {
 		error("gatt: Failed to allocate memory for queues");
 
 		queue_destroy(gatt_apps, NULL);
@@ -5269,6 +5273,8 @@ bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
 		g_io_channel_unref(listening_io);
 		listening_io = NULL;
 
+		bt_crypto_unref(crypto);
+
 		return false;
 	}
 
@@ -5310,4 +5316,7 @@ void bt_gatt_unregister(void)
 
 	g_io_channel_unref(listening_io);
 	listening_io = NULL;
+
+	bt_crypto_unref(crypto);
+	crypto = NULL;
 }