hci.c (367aedc0e9bcd6a667a86fa0fe58d84dd974d1f4) hci.c (bc00e12c3fd94794a9ee9235d4aa3183edbc3316)
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

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

5502 hci_connection_t * connection = hci_connection_for_handle(con_handle);
5503 if (!connection){
5504 hci_emit_security_level(con_handle, LEVEL_0);
5505 return;
5506 }
5507
5508 btstack_assert(hci_is_le_connection(connection) == false);
5509
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

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

5502 hci_connection_t * connection = hci_connection_for_handle(con_handle);
5503 if (!connection){
5504 hci_emit_security_level(con_handle, LEVEL_0);
5505 return;
5506 }
5507
5508 btstack_assert(hci_is_le_connection(connection) == false);
5509
5510 // Core Spec 5.2, GAP 5.2.2: "When in Secure Connections Only mode, all services (except those allowed to have Security Mode 4, Level 0)
5511 // available on the BR/EDR physical transport require Security Mode 4, Level 4 "
5512 if (hci_stack->gap_secure_connections_only_mode && (requested_level != LEVEL_0)){
5513 requested_level = LEVEL_4;
5514 }
5515
5510 gap_security_level_t current_level = gap_security_level(con_handle);
5511 log_info("gap_request_security_level requested level %u, planned level %u, current level %u",
5512 requested_level, connection->requested_security_level, current_level);
5513
5514 // authentication active if authentication request was sent or planned level > 0
5515 bool authentication_active = ((connection->bonding_flags & BONDING_SENT_AUTHENTICATE_REQUEST) != 0) || (connection->requested_security_level > LEVEL_0);
5516 if (authentication_active){
5517 // authentication already active

--- 1194 unchanged lines hidden ---
5516 gap_security_level_t current_level = gap_security_level(con_handle);
5517 log_info("gap_request_security_level requested level %u, planned level %u, current level %u",
5518 requested_level, connection->requested_security_level, current_level);
5519
5520 // authentication active if authentication request was sent or planned level > 0
5521 bool authentication_active = ((connection->bonding_flags & BONDING_SENT_AUTHENTICATE_REQUEST) != 0) || (connection->requested_security_level > LEVEL_0);
5522 if (authentication_active){
5523 // authentication already active

--- 1194 unchanged lines hidden ---