mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 06:44:32 +00:00
assert max encryption size above our minimum
This commit is contained in:
parent
ae8cec9a27
commit
fd4c6f057c
@ -589,8 +589,6 @@ static void sm_run(void){
|
|||||||
|
|
||||||
case SM_STATE_PH1_SEND_PAIRING_RESPONSE: {
|
case SM_STATE_PH1_SEND_PAIRING_RESPONSE: {
|
||||||
|
|
||||||
// TODO use locally defined max encryption key size
|
|
||||||
|
|
||||||
uint8_t buffer[7];
|
uint8_t buffer[7];
|
||||||
|
|
||||||
memcpy(buffer, sm_m_preq, 7);
|
memcpy(buffer, sm_m_preq, 7);
|
||||||
@ -805,6 +803,13 @@ static void sm_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pac
|
|||||||
sm_m_auth_req = packet[3];
|
sm_m_auth_req = packet[3];
|
||||||
sm_m_max_encryption_key_size = packet[4];
|
sm_m_max_encryption_key_size = packet[4];
|
||||||
|
|
||||||
|
// assert max encryption size above our minimum
|
||||||
|
if (sm_m_max_encryption_key_size < sm_min_encrypted_key_size){
|
||||||
|
sm_pairing_failed_reason = SM_REASON_ENCRYPTION_KEY_SIZE;
|
||||||
|
sm_state_responding = SM_STATE_SEND_PAIRING_FAILED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// setup key distribution
|
// setup key distribution
|
||||||
sm_m_key_distribution = packet[5];
|
sm_m_key_distribution = packet[5];
|
||||||
sm_setup_key_distribution(packet[6]);
|
sm_setup_key_distribution(packet[6]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user