mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00: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:
parent
be43e49869
commit
12112e70bc
2 changed files with 11 additions and 8 deletions
|
@ -9,7 +9,6 @@
|
|||
/**
|
||||
* 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_MIN (8)
|
||||
|
||||
|
@ -18,11 +17,6 @@
|
|||
*/
|
||||
#define CFG_IO_CAPABILITY IO_CAP_DISPLAY_YES_NO
|
||||
|
||||
/**
|
||||
* Define MITM modes
|
||||
*/
|
||||
#define CFG_MITM_PROTECTION MITM_PROTECTION_REQUIRED
|
||||
|
||||
/**
|
||||
* Define Secure Connections Support
|
||||
*/
|
||||
|
|
|
@ -348,22 +348,31 @@ static void gap_init_svc(Gap* gap) {
|
|||
// Set default PHY
|
||||
hci_le_set_default_phy(ALL_PHYS_PREFERENCE, TX_2M_PREFERRED, RX_2M_PREFERRED);
|
||||
// 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;
|
||||
if(gap->config->pairing_method == GapPairingPinCodeShow) {
|
||||
aci_gap_set_io_capability(IO_CAP_DISPLAY_ONLY);
|
||||
} else if(gap->config->pairing_method == GapPairingPinCodeVerifyYesNo) {
|
||||
aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO);
|
||||
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
|
||||
aci_gap_set_authentication_requirement(
|
||||
gap->config->bonding_mode,
|
||||
CFG_MITM_PROTECTION,
|
||||
auth_req_mitm_mode,
|
||||
CFG_SC_SUPPORT,
|
||||
keypress_supported,
|
||||
CFG_ENCRYPTION_KEY_SIZE_MIN,
|
||||
CFG_ENCRYPTION_KEY_SIZE_MAX,
|
||||
CFG_USED_FIXED_PIN,
|
||||
auth_req_use_fixed_pin,
|
||||
0,
|
||||
CFG_IDENTITY_ADDRESS);
|
||||
// Configure whitelist
|
||||
|
|
Loading…
Reference in a new issue