From 1710921f6720d55f83292b98321976dac3e67f6b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Sat, 28 Feb 2015 17:49:18 +0200 Subject: [PATCH] shared/att: Do not fail if crypto is not available This makes bt_crypto optional since it depend on kernel modules to work properly and just affect signed operations, the code will now just proceed if bt_crypto_new fails leaving it NULL which will fail properly if there is any attempt to use it without affecting other operations. --- src/shared/att.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/att.c b/src/shared/att.c index 97873771d..8bf004271 100644 --- a/src/shared/att.c +++ b/src/shared/att.c @@ -317,6 +317,9 @@ static bool encode_pdu(struct bt_att *att, struct att_send_op *op, sign_cnt, &((uint8_t *) op->pdu)[1 + length]))) return true; + util_debug(att->debug_callback, att->debug_data, + "ATT unable to generate signature"); + fail: free(op->pdu); return false; @@ -926,9 +929,8 @@ struct bt_att *bt_att_new(int fd) if (!att->io) goto fail; + /* crypto is optional, if not available leave it NULL */ att->crypto = bt_crypto_new(); - if (!att->crypto) - goto fail; att->req_queue = queue_new(); if (!att->req_queue) -- 2.47.3