hci.c (8ce186819bfbeb3eb643846cb71ed5499760b755) hci.c (62daa4413793ac9b1b00945388a2ed4faeb48481)
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

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

4084 conn->link_key_type = new_link_key_type;
4085#else
4086 log_info("SC during pairing, but only E0 now -> abort");
4087 conn->bonding_flags |= BONDING_DISCONNECT_SECURITY_BLOCK;
4088 break;
4089#endif
4090 }
4091
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

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

4084 conn->link_key_type = new_link_key_type;
4085#else
4086 log_info("SC during pairing, but only E0 now -> abort");
4087 conn->bonding_flags |= BONDING_DISCONNECT_SECURITY_BLOCK;
4088 break;
4089#endif
4090 }
4091
4092#ifdef ENABLE_MUTUAL_AUTHENTICATION_FOR_LEGACY_SECURE_CONNECTIONS
4092 // if AES-CCM is used, authentication used SC -> authentication was mutual and we can skip explicit authentication
4093 if (connected_uses_aes_ccm){
4094 conn->authentication_flags |= AUTH_FLAG_CONNECTION_AUTHENTICATED;
4095 }
4093 // if AES-CCM is used, authentication used SC -> authentication was mutual and we can skip explicit authentication
4094 if (connected_uses_aes_ccm){
4095 conn->authentication_flags |= AUTH_FLAG_CONNECTION_AUTHENTICATED;
4096 }
4096
4097#ifdef ENABLE_TESTING_SUPPORT
4098 // work around for issue with PTS dongle
4097#else
4098 // We consider even Legacy Secure Connections as authenticated as BTstack mandates encryption
4099 // with encryption key size > hci_stack->gap_required_encyrption_key_size
4100 // for all operations that require any security. See BIAS attacks.
4099 conn->authentication_flags |= AUTH_FLAG_CONNECTION_AUTHENTICATED;
4100#endif
4101 // validate encryption key size
4102 if (hci_event_packet_get_type(packet) == HCI_EVENT_ENCRYPTION_CHANGE_V2) {
4103 uint8_t encryption_key_size = hci_event_encryption_change_v2_get_encryption_key_size(packet);
4104 // already got encryption key size
4105 hci_handle_read_encryption_key_size_complete(conn, encryption_key_size);
4106 } else {

--- 6566 unchanged lines hidden ---
4101 conn->authentication_flags |= AUTH_FLAG_CONNECTION_AUTHENTICATED;
4102#endif
4103 // validate encryption key size
4104 if (hci_event_packet_get_type(packet) == HCI_EVENT_ENCRYPTION_CHANGE_V2) {
4105 uint8_t encryption_key_size = hci_event_encryption_change_v2_get_encryption_key_size(packet);
4106 // already got encryption key size
4107 hci_handle_read_encryption_key_size_complete(conn, encryption_key_size);
4108 } else {

--- 6566 unchanged lines hidden ---