mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 19:20:54 +00:00
implemented gap_security_level getter
This commit is contained in:
parent
9ab95c9023
commit
3c68dfa952
@ -63,7 +63,7 @@ typedef enum {
|
||||
|
||||
// MITM protection required
|
||||
// Encryption required
|
||||
// 128-bit equivalent strength for link and encryption keys required
|
||||
// 128-bit equivalent strength for link and encryption keys required (P-192 is not enough)
|
||||
// User interaction acceptable
|
||||
LEVEL_4,
|
||||
} gap_security_level_t;
|
||||
@ -73,7 +73,7 @@ typedef enum {
|
||||
GAP_SECUIRTY_ENCRYPTED, // SSP: JUST WORKS
|
||||
GAP_SECURITY_AUTHENTICATED, // SSP: numeric comparison, passkey, OOB
|
||||
// GAP_SECURITY_AUTHORIZED
|
||||
} gap_security_requirement_t;
|
||||
} gap_security_state;
|
||||
|
||||
/**
|
||||
* @bbrief enable/disable bonding. default is enabled
|
||||
|
15
src/hci.c
15
src/hci.c
@ -1712,7 +1712,19 @@ void gap_set_bondable_mode(int enable){
|
||||
* @brief get current security level
|
||||
*/
|
||||
gap_security_level_t gap_security_level(hci_con_handle_t con_handle){
|
||||
return LEVEL_0;
|
||||
hci_connection_t * connection = hci_connection_for_handle(con_handle);
|
||||
if (!connection) return LEVEL_0;
|
||||
if ((connection->authentication_flags & CONNECTION_ENCRYPTED) == 0) return LEVEL_0;
|
||||
switch (connection->link_key_type){
|
||||
case AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256:
|
||||
return LEVEL_4;
|
||||
case COMBINATION_KEY:
|
||||
case AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192:
|
||||
return LEVEL_3;
|
||||
case DEBUG_COMBINATION_KEY:
|
||||
default:
|
||||
return LEVEL_2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1721,3 +1733,4 @@ gap_security_level_t gap_security_level(hci_con_handle_t con_handle){
|
||||
*/
|
||||
void gap_request_security_level(hci_con_handle_t con_handle, gap_security_level_t level){
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user