diff --git a/android/gatt.c b/android/gatt.c
index b8074a9..65f3142 100644
--- a/android/gatt.c
+++ b/android/gatt.c
if (cid == ATT_CID)
mtu = ATT_DEFAULT_LE_MTU;
- attrib = g_attrib_new(io, mtu);
+ attrib = g_attrib_new(io, mtu, true);
if (!attrib) {
error("gatt: unable to create new GAttrib instance");
device_set_state(dev, DEVICE_DISCONNECTED);
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 2011359..2e1e39a 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
return NULL;
}
-GAttrib *g_attrib_new(GIOChannel *io, guint16 mtu)
+GAttrib *g_attrib_new(GIOChannel *io, guint16 mtu, bool ext_signed)
{
gint fd;
GAttrib *attr;
g_io_channel_ref(io);
attr->io = io;
- attr->att = bt_att_new(fd);
+ attr->att = bt_att_new(fd, ext_signed);
if (!attr->att)
goto fail;
diff --git a/attrib/gattrib.h b/attrib/gattrib.h
index 374bac2..611f952 100644
--- a/attrib/gattrib.h
+++ b/attrib/gattrib.h
typedef void (*GAttribNotifyFunc)(const guint8 *pdu, guint16 len,
gpointer user_data);
-GAttrib *g_attrib_new(GIOChannel *io, guint16 mtu);
+GAttrib *g_attrib_new(GIOChannel *io, guint16 mtu, bool ext_signed);
GAttrib *g_attrib_ref(GAttrib *attrib);
void g_attrib_unref(GAttrib *attrib);
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 1a40c94..95bd20a 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
if (cid == ATT_CID)
mtu = ATT_DEFAULT_LE_MTU;
- attrib = g_attrib_new(io, mtu);
+ attrib = g_attrib_new(io, mtu, false);
if (opt_listen)
g_idle_add(listen_start, attrib);
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 451be23..7d4786a 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
if (cid == ATT_CID)
mtu = ATT_DEFAULT_LE_MTU;
- attrib = g_attrib_new(iochannel, mtu);
+ attrib = g_attrib_new(iochannel, mtu, false);
g_attrib_register(attrib, ATT_OP_HANDLE_NOTIFY, GATTRIB_ALL_HANDLES,
events_handler, attrib, NULL);
g_attrib_register(attrib, ATT_OP_HANDLE_IND, GATTRIB_ALL_HANDLES,
diff --git a/peripheral/gatt.c b/peripheral/gatt.c
index 6cf2b79..4c5531d 100644
--- a/peripheral/gatt.c
+++ b/peripheral/gatt.c
if (!conn)
return NULL;
- conn->att = bt_att_new(fd);
+ conn->att = bt_att_new(fd, false);
if (!conn->att) {
fprintf(stderr, "Failed to initialze ATT transport layer\n");
free(conn);
diff --git a/src/device.c b/src/device.c
index d4d72c0..ce96ab5 100644
--- a/src/device.c
+++ b/src/device.c
}
dev->att_mtu = MIN(mtu, BT_ATT_MAX_LE_MTU);
- attrib = g_attrib_new(io, dev->att_mtu);
+ attrib = g_attrib_new(io, dev->att_mtu, false);
if (!attrib) {
error("Unable to create new GAttrib instance");
return false;
diff --git a/src/shared/att.c b/src/shared/att.c
index c5eaa09..053aa47 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
void *debug_data;
struct bt_crypto *crypto;
+ bool ext_signed;
struct sign_info *local_sign;
struct sign_info *remote_sign;
const struct queue_entry *entry;
bool found;
- if (opcode & ATT_OP_SIGNED_MASK) {
+ if (opcode & ATT_OP_SIGNED_MASK & !att->ext_signed) {
if (!handle_signed(att, opcode, pdu, pdu_len))
return;
pdu_len -= BT_ATT_SIGNATURE_LEN;
free(att);
}
-struct bt_att *bt_att_new(int fd)
+struct bt_att *bt_att_new(int fd, bool ext_signed)
{
struct bt_att *att;
return NULL;
att->fd = fd;
-
+ att->ext_signed = ext_signed;
att->mtu = BT_ATT_DEFAULT_LE_MTU;
att->buf = malloc(att->mtu);
if (!att->buf)
goto fail;
/* crypto is optional, if not available leave it NULL */
- att->crypto = bt_crypto_new();
+ if (!ext_signed)
+ att->crypto = bt_crypto_new();
att->req_queue = queue_new();
if (!att->req_queue)
diff --git a/src/shared/att.h b/src/shared/att.h
index 80810a1..2a7f87e 100644
--- a/src/shared/att.h
+++ b/src/shared/att.h
struct bt_att;
-struct bt_att *bt_att_new(int fd);
+struct bt_att *bt_att_new(int fd, bool ext_signed);
struct bt_att *bt_att_ref(struct bt_att *att);
void bt_att_unref(struct bt_att *att);
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 7c964bd..0f6a1bd 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
return NULL;
}
- cli->att = bt_att_new(fd);
+ cli->att = bt_att_new(fd, false);
if (!cli->att) {
fprintf(stderr, "Failed to initialze ATT transport layer\n");
bt_att_unref(cli->att);
diff --git a/tools/btgatt-server.c b/tools/btgatt-server.c
index b30a958..292b584 100644
--- a/tools/btgatt-server.c
+++ b/tools/btgatt-server.c
return NULL;
}
- server->att = bt_att_new(fd);
+ server->att = bt_att_new(fd, false);
if (!server->att) {
fprintf(stderr, "Failed to initialze ATT transport layer\n");
goto fail;
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index a7ea7cd..40e2ca9 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
g_assert(err == 0);
- context->att = bt_att_new(sv[0]);
+ context->att = bt_att_new(sv[0], false);
g_assert(context->att);
switch (test_data->context_type) {
diff --git a/unit/test-gattrib.c b/unit/test-gattrib.c
index 28542f3..416e596 100644
--- a/unit/test-gattrib.c
+++ b/unit/test-gattrib.c
g_io_channel_set_encoding(cxt->server_io, NULL, NULL);
g_io_channel_set_buffered(cxt->server_io, FALSE);
- cxt->att = g_attrib_new(cxt->att_io, DEFAULT_MTU);
+ cxt->att = g_attrib_new(cxt->att_io, DEFAULT_MTU, false);
g_assert(cxt->att != NULL);
}
diff --git a/unit/test-hog.c b/unit/test-hog.c
index 778f087..24731d7 100644
--- a/unit/test-hog.c
+++ b/unit/test-hog.c
g_io_channel_set_close_on_unref(att_io, TRUE);
- context->attrib = g_attrib_new(att_io, 23);
+ context->attrib = g_attrib_new(att_io, 23, false);
g_assert(context->attrib);
g_io_channel_unref(att_io);