From a954124fc5429f259e47258af64e159c621cc6e0 Mon Sep 17 00:00:00 2001 From: Casper Bonde Date: Thu, 21 May 2015 11:07:52 +0200 Subject: [PATCH] Add support for MITM for BluetoothSockets (4/4) This change adds an option to enforce Man-in-the-middle protection for the authentication process. This feature is needed for the Sim Access Profile. Change-Id: I2eda507ffdcb4a194434adedf207e1e9951b80c3 Signed-off-by: Casper Bonde --- btif/src/btif_sock_rfc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/btif/src/btif_sock_rfc.c b/btif/src/btif_sock_rfc.c index 7b6eeb683..4ecb5acda 100644 --- a/btif/src/btif_sock_rfc.c +++ b/btif/src/btif_sock_rfc.c @@ -176,6 +176,8 @@ static rfc_slot_t *alloc_rfc_slot(const bt_bdaddr_t *addr, const char *name, con security |= server ? BTM_SEC_IN_ENCRYPT : BTM_SEC_OUT_ENCRYPT; if(flags & BTSOCK_FLAG_AUTH) security |= server ? BTM_SEC_IN_AUTHENTICATE : BTM_SEC_OUT_AUTHENTICATE; + if(flags & BTSOCK_FLAG_AUTH_MITM) + security |= server ? BTM_SEC_IN_MITM : BTM_SEC_OUT_MITM; rfc_slot_t *slot = find_free_slot(); if (!slot) { @@ -251,7 +253,7 @@ bt_status_t btsock_rfc_listen(const char *service_name, const uint8_t *service_u assert(sock_fd != NULL); assert((service_uuid != NULL) || (channel >= 1 && channel <= MAX_RFC_CHANNEL) - || ((flags & BTSOCK_FLAG_NO_SDP) != 0)); + || ((flags & BTSOCK_FLAG_NO_SDP) != 0)); *sock_fd = INVALID_FD; -- 2.11.0