hci.c (e82ac897a0878b49804cb51f63e4cc400950c5a3) hci.c (501e6d2b86e6c92bfb9c390bcf55709938e25ac1)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 4013 unchanged lines hidden (view full) ---

4022 // cache link key. link keys stored in little-endian format for legacy reasons
4023 memcpy(&conn->link_key, &packet[8], 16);
4024
4025 // only store link key:
4026 // - if bondable enabled
4027 if (hci_stack->bondable == false) break;
4028 // - if at least one side requests bonding during the IO Capabilities exchange.
4029 // Note: we drop bonding flag in acceptor role if remote doesn't request it
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 4013 unchanged lines hidden (view full) ---

4022 // cache link key. link keys stored in little-endian format for legacy reasons
4023 memcpy(&conn->link_key, &packet[8], 16);
4024
4025 // only store link key:
4026 // - if bondable enabled
4027 if (hci_stack->bondable == false) break;
4028 // - if at least one side requests bonding during the IO Capabilities exchange.
4029 // Note: we drop bonding flag in acceptor role if remote doesn't request it
4030 bool bonding_local = conn->io_cap_request_auth_req >= SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING;
4031 bool bonding_remote = conn->io_cap_response_auth_req >= SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING;
4032 if ((bonding_local == false) && (bonding_remote == false)) break;
4030 if (conn->link_key_type != COMBINATION_KEY) {
4031 bool bonding_local = conn->io_cap_request_auth_req >= SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING;
4032 bool bonding_remote = conn->io_cap_response_auth_req >= SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING;
4033 if ((bonding_local == false) && (bonding_remote == false)) break;
4034 }
4033 // - if security level sufficient
4034 if (gap_security_level_for_link_key_type(link_key_type) < conn->requested_security_level) break;
4035 gap_store_link_key_for_bd_addr(addr, &packet[8], conn->link_key_type);
4036 break;
4037 }
4038
4039 case HCI_EVENT_PIN_CODE_REQUEST:
4040 hci_event_pin_code_request_get_bd_addr(packet, addr);

--- 6915 unchanged lines hidden ---
4035 // - if security level sufficient
4036 if (gap_security_level_for_link_key_type(link_key_type) < conn->requested_security_level) break;
4037 gap_store_link_key_for_bd_addr(addr, &packet[8], conn->link_key_type);
4038 break;
4039 }
4040
4041 case HCI_EVENT_PIN_CODE_REQUEST:
4042 hci_event_pin_code_request_get_bd_addr(packet, addr);

--- 6915 unchanged lines hidden ---