sm.c (b96d60a6103b1a6f7c049e6b27899ce7e6965cfd) | sm.c (b6f39a74d2672c499a9bf128847eec1c84d23a53) |
---|---|
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 --- 180 unchanged lines hidden (view full) --- 189#endif 190 191// configuration 192static uint8_t sm_accepted_stk_generation_methods; 193static uint8_t sm_max_encryption_key_size; 194static uint8_t sm_min_encryption_key_size; 195static uint8_t sm_auth_req = 0; 196static uint8_t sm_io_capabilities = IO_CAPABILITY_NO_INPUT_NO_OUTPUT; | 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 --- 180 unchanged lines hidden (view full) --- 189#endif 190 191// configuration 192static uint8_t sm_accepted_stk_generation_methods; 193static uint8_t sm_max_encryption_key_size; 194static uint8_t sm_min_encryption_key_size; 195static uint8_t sm_auth_req = 0; 196static uint8_t sm_io_capabilities = IO_CAPABILITY_NO_INPUT_NO_OUTPUT; |
197static uint8_t sm_slave_request_security; | |
198static uint32_t sm_fixed_passkey_in_display_role; 199static bool sm_reconstruct_ltk_without_le_device_db_entry; 200 | 197static uint32_t sm_fixed_passkey_in_display_role; 198static bool sm_reconstruct_ltk_without_le_device_db_entry; 199 |
200#ifdef ENABLE_LE_PERIPHERAL 201static uint8_t sm_slave_request_security; 202#endif 203 |
|
201#ifdef ENABLE_LE_SECURE_CONNECTIONS 202static bool sm_sc_only_mode; 203static uint8_t sm_sc_oob_random[16]; 204static void (*sm_sc_oob_callback)(const uint8_t * confirm_value, const uint8_t * random_value); 205static sm_sc_oob_state_t sm_sc_oob_state; 206#endif 207 208 --- 2366 unchanged lines hidden (view full) --- 2575 // send keypress notifications 2576 if (setup->sm_keypress_notification){ 2577 sm_run_send_keypress_notification(connection); 2578 return; 2579 } 2580 2581 int key_distribution_flags; 2582 UNUSED(key_distribution_flags); | 204#ifdef ENABLE_LE_SECURE_CONNECTIONS 205static bool sm_sc_only_mode; 206static uint8_t sm_sc_oob_random[16]; 207static void (*sm_sc_oob_callback)(const uint8_t * confirm_value, const uint8_t * random_value); 208static sm_sc_oob_state_t sm_sc_oob_state; 209#endif 210 211 --- 2366 unchanged lines hidden (view full) --- 2578 // send keypress notifications 2579 if (setup->sm_keypress_notification){ 2580 sm_run_send_keypress_notification(connection); 2581 return; 2582 } 2583 2584 int key_distribution_flags; 2585 UNUSED(key_distribution_flags); |
2583 int err; 2584 UNUSED(err); | 2586#ifdef ENABLE_LE_PERIPHERAL 2587 int err; |
2585 bool have_ltk; 2586 uint8_t ltk[16]; | 2588 bool have_ltk; 2589 uint8_t ltk[16]; |
2590#endif |
|
2587 2588 log_info("sm_run: state %u", connection->sm_engine_state); 2589 if (!l2cap_can_send_fixed_channel_packet_now(sm_active_connection_handle, L2CAP_CID_SECURITY_MANAGER_PROTOCOL)) { 2590 log_info("sm_run // cannot send"); 2591 } 2592 switch (connection->sm_engine_state){ 2593 2594 // secure connections, initiator + responding states --- 1125 unchanged lines hidden (view full) --- 3720 sm_connection_init(sm_conn, 3721 con_handle, 3722 hci_subevent_le_connection_complete_get_role(packet), 3723 hci_subevent_le_connection_complete_get_peer_address_type(packet), 3724 addr); 3725 sm_conn->sm_cid = L2CAP_CID_SECURITY_MANAGER_PROTOCOL; 3726 3727 // track our addr used for this connection and set state | 2591 2592 log_info("sm_run: state %u", connection->sm_engine_state); 2593 if (!l2cap_can_send_fixed_channel_packet_now(sm_active_connection_handle, L2CAP_CID_SECURITY_MANAGER_PROTOCOL)) { 2594 log_info("sm_run // cannot send"); 2595 } 2596 switch (connection->sm_engine_state){ 2597 2598 // secure connections, initiator + responding states --- 1125 unchanged lines hidden (view full) --- 3724 sm_connection_init(sm_conn, 3725 con_handle, 3726 hci_subevent_le_connection_complete_get_role(packet), 3727 hci_subevent_le_connection_complete_get_peer_address_type(packet), 3728 addr); 3729 sm_conn->sm_cid = L2CAP_CID_SECURITY_MANAGER_PROTOCOL; 3730 3731 // track our addr used for this connection and set state |
3728#ifdef ENABLE_LE_CENTRAL | 3732#ifdef ENABLE_LE_PERIPHERAL |
3729 if (hci_subevent_le_connection_complete_get_role(packet) != 0){ 3730 // responder - use own address from advertisements 3731 gap_le_get_own_advertisements_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address); 3732 sm_conn->sm_engine_state = SM_RESPONDER_IDLE; 3733 } 3734#endif 3735#ifdef ENABLE_LE_CENTRAL 3736 if (hci_subevent_le_connection_complete_get_role(packet) == 0){ --- 1468 unchanged lines hidden --- | 3733 if (hci_subevent_le_connection_complete_get_role(packet) != 0){ 3734 // responder - use own address from advertisements 3735 gap_le_get_own_advertisements_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address); 3736 sm_conn->sm_engine_state = SM_RESPONDER_IDLE; 3737 } 3738#endif 3739#ifdef ENABLE_LE_CENTRAL 3740 if (hci_subevent_le_connection_complete_get_role(packet) == 0){ --- 1468 unchanged lines hidden --- |