Linux bluetooth development
 help / color / mirror / Atom feed
From: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: szymon.janc@tieto.com, johan.hedberg@gmail.com,
	Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Subject: [PATCH v3 10/12] android/gatt: Add crypto needed for sign write
Date: Thu, 22 May 2014 21:06:24 +0200	[thread overview]
Message-ID: <1400785586-22710-11-git-send-email-lukasz.rymanowski@tieto.com> (raw)
In-Reply-To: <1400785586-22710-1-git-send-email-lukasz.rymanowski@tieto.com>

---
 android/Android.mk  |  1 +
 android/Makefile.am |  1 +
 android/gatt.c      | 11 ++++++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/android/Android.mk b/android/Android.mk
index 4235a7c..4548ed7 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 e663790..1bde83d 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 532a416..9e65fb5 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)
@@ -5241,9 +5244,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);
@@ -5264,6 +5268,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;
 	}
 
@@ -5305,4 +5311,7 @@ void bt_gatt_unregister(void)
 
 	g_io_channel_unref(listening_io);
 	listening_io = NULL;
+
+	bt_crypto_unref(crypto);
+	crypto = NULL;
 }
-- 
1.8.4


  parent reply	other threads:[~2014-05-22 19:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22 19:06 [PATCH v3 00/12] android/gatt: Add support for write signature command Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 01/12] shared/crypto: Extend bt_crypto_sign_att with sign counter Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 02/12] attrib: Add helpers to enc and dec signed write command Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 03/12] attrib/gatt: Add wrapper to send " Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 04/12] android/bluetooth: Expose API to get CSRK for device Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 05/12] android/bluetooth: Expose API to update sign counter Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 06/12] android/bluetooth: Add support to read CSRK from the kernel Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 07/12] android/bluetooth: Store CSRK Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 08/12] android/bluetooth: Read CSRK from the storage on startup Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 09/12] android/bluetooth: Store sign counter needed for aes-cmac sign Lukasz Rymanowski
2014-05-22 19:06 ` Lukasz Rymanowski [this message]
2014-05-22 19:06 ` [PATCH v3 11/12] android/gatt: Add support for signed write command Lukasz Rymanowski
2014-05-22 19:06 ` [PATCH v3 12/12] android/gatt: Add handling signed write from remote device Lukasz Rymanowski
2014-05-26  8:41 ` [PATCH v3 00/12] android/gatt: Add support for write signature command Szymon Janc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400785586-22710-11-git-send-email-lukasz.rymanowski@tieto.com \
    --to=lukasz.rymanowski@tieto.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=szymon.janc@tieto.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox