hci.c (e9f98c4a52a4522568d6b75f5ffa50a24b54385d) | hci.c (dbd5dcc31abc931e91ab93fbb5156709a0867dca) |
---|---|
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 --- 2776 unchanged lines hidden (view full) --- 2785 break; 2786 2787#ifdef ENABLE_CLASSIC 2788 case HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT: 2789 handle = hci_event_authentication_complete_get_connection_handle(packet); 2790 conn = hci_connection_for_handle(handle); 2791 if (!conn) break; 2792 | 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 --- 2776 unchanged lines hidden (view full) --- 2785 break; 2786 2787#ifdef ENABLE_CLASSIC 2788 case HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT: 2789 handle = hci_event_authentication_complete_get_connection_handle(packet); 2790 conn = hci_connection_for_handle(handle); 2791 if (!conn) break; 2792 |
2793 // clear authentication active flag 2794 conn->bonding_flags &= ~BONDING_SENT_AUTHENTICATE_REQUEST; 2795 |
|
2793 // authenticated only if auth status == 0 2794 if (hci_event_authentication_complete_get_status(packet) == 0){ 2795 // authenticated 2796 conn->authentication_flags |= CONNECTION_AUTHENTICATED; 2797 2798 // If not already encrypted, start encryption 2799 if ((conn->authentication_flags & CONNECTION_ENCRYPTED) == 0){ 2800 conn->bonding_flags |= BONDING_SEND_ENCRYPTION_REQUEST; --- 2605 unchanged lines hidden (view full) --- 5406 } 5407 5408 btstack_assert(hci_is_le_connection(connection) == false); 5409 5410 gap_security_level_t current_level = gap_security_level(con_handle); 5411 log_info("gap_request_security_level requested level %u, planned level %u, current level %u", 5412 requested_level, connection->requested_security_level, current_level); 5413 | 2796 // authenticated only if auth status == 0 2797 if (hci_event_authentication_complete_get_status(packet) == 0){ 2798 // authenticated 2799 conn->authentication_flags |= CONNECTION_AUTHENTICATED; 2800 2801 // If not already encrypted, start encryption 2802 if ((conn->authentication_flags & CONNECTION_ENCRYPTED) == 0){ 2803 conn->bonding_flags |= BONDING_SEND_ENCRYPTION_REQUEST; --- 2605 unchanged lines hidden (view full) --- 5409 } 5410 5411 btstack_assert(hci_is_le_connection(connection) == false); 5412 5413 gap_security_level_t current_level = gap_security_level(con_handle); 5414 log_info("gap_request_security_level requested level %u, planned level %u, current level %u", 5415 requested_level, connection->requested_security_level, current_level); 5416 |
5414 // authentication already active if planned level > 0 5415 if (connection->requested_security_level > LEVEL_0){ | 5417 // authentication active if authentication request was sent or planned level > 0 5418 bool authentication_active = ((connection->bonding_flags & BONDING_SENT_AUTHENTICATE_REQUEST) != 0) || (connection->requested_security_level > LEVEL_0); 5419 if (authentication_active){ |
5416 // authentication already active 5417 if (connection->requested_security_level < requested_level){ 5418 // increase requested level as new level is higher 5419 // TODO: handle re-authentication when done 5420 connection->requested_security_level = requested_level; 5421 } 5422 } else { 5423 // no request active, notify if security sufficient --- 1180 unchanged lines hidden --- | 5420 // authentication already active 5421 if (connection->requested_security_level < requested_level){ 5422 // increase requested level as new level is higher 5423 // TODO: handle re-authentication when done 5424 connection->requested_security_level = requested_level; 5425 } 5426 } else { 5427 // no request active, notify if security sufficient --- 1180 unchanged lines hidden --- |