mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
BLE: Add GapPairingNone support (#3596)
* BLE: Add GapPairingNone support * FuriHal: cleanup naming in ble gap, remove useless config options Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
/**
|
/**
|
||||||
* Define IO Authentication
|
* Define IO Authentication
|
||||||
*/
|
*/
|
||||||
#define CFG_USED_FIXED_PIN USE_FIXED_PIN_FOR_PAIRING_FORBIDDEN
|
|
||||||
#define CFG_ENCRYPTION_KEY_SIZE_MAX (16)
|
#define CFG_ENCRYPTION_KEY_SIZE_MAX (16)
|
||||||
#define CFG_ENCRYPTION_KEY_SIZE_MIN (8)
|
#define CFG_ENCRYPTION_KEY_SIZE_MIN (8)
|
||||||
|
|
||||||
@@ -18,11 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
#define CFG_IO_CAPABILITY IO_CAP_DISPLAY_YES_NO
|
#define CFG_IO_CAPABILITY IO_CAP_DISPLAY_YES_NO
|
||||||
|
|
||||||
/**
|
|
||||||
* Define MITM modes
|
|
||||||
*/
|
|
||||||
#define CFG_MITM_PROTECTION MITM_PROTECTION_REQUIRED
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define Secure Connections Support
|
* Define Secure Connections Support
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -348,22 +348,31 @@ static void gap_init_svc(Gap* gap) {
|
|||||||
// Set default PHY
|
// Set default PHY
|
||||||
hci_le_set_default_phy(ALL_PHYS_PREFERENCE, TX_2M_PREFERRED, RX_2M_PREFERRED);
|
hci_le_set_default_phy(ALL_PHYS_PREFERENCE, TX_2M_PREFERRED, RX_2M_PREFERRED);
|
||||||
// Set I/O capability
|
// Set I/O capability
|
||||||
|
uint8_t auth_req_mitm_mode = MITM_PROTECTION_REQUIRED;
|
||||||
|
uint8_t auth_req_use_fixed_pin = USE_FIXED_PIN_FOR_PAIRING_FORBIDDEN;
|
||||||
bool keypress_supported = false;
|
bool keypress_supported = false;
|
||||||
if(gap->config->pairing_method == GapPairingPinCodeShow) {
|
if(gap->config->pairing_method == GapPairingPinCodeShow) {
|
||||||
aci_gap_set_io_capability(IO_CAP_DISPLAY_ONLY);
|
aci_gap_set_io_capability(IO_CAP_DISPLAY_ONLY);
|
||||||
} else if(gap->config->pairing_method == GapPairingPinCodeVerifyYesNo) {
|
} else if(gap->config->pairing_method == GapPairingPinCodeVerifyYesNo) {
|
||||||
aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO);
|
aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO);
|
||||||
keypress_supported = true;
|
keypress_supported = true;
|
||||||
|
} else if(gap->config->pairing_method == GapPairingNone) {
|
||||||
|
// "Just works" pairing method (iOS accepts it, it seems Android and Linux don't)
|
||||||
|
auth_req_mitm_mode = MITM_PROTECTION_NOT_REQUIRED;
|
||||||
|
auth_req_use_fixed_pin = USE_FIXED_PIN_FOR_PAIRING_ALLOWED;
|
||||||
|
// If "just works" isn't supported, we want the numeric comparaison method
|
||||||
|
aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO);
|
||||||
|
keypress_supported = true;
|
||||||
}
|
}
|
||||||
// Setup authentication
|
// Setup authentication
|
||||||
aci_gap_set_authentication_requirement(
|
aci_gap_set_authentication_requirement(
|
||||||
gap->config->bonding_mode,
|
gap->config->bonding_mode,
|
||||||
CFG_MITM_PROTECTION,
|
auth_req_mitm_mode,
|
||||||
CFG_SC_SUPPORT,
|
CFG_SC_SUPPORT,
|
||||||
keypress_supported,
|
keypress_supported,
|
||||||
CFG_ENCRYPTION_KEY_SIZE_MIN,
|
CFG_ENCRYPTION_KEY_SIZE_MIN,
|
||||||
CFG_ENCRYPTION_KEY_SIZE_MAX,
|
CFG_ENCRYPTION_KEY_SIZE_MAX,
|
||||||
CFG_USED_FIXED_PIN,
|
auth_req_use_fixed_pin,
|
||||||
0,
|
0,
|
||||||
CFG_IDENTITY_ADDRESS);
|
CFG_IDENTITY_ADDRESS);
|
||||||
// Configure whitelist
|
// Configure whitelist
|
||||||
|
|||||||
Reference in New Issue
Block a user