NimBLE: Compare only x component of public key before pairing

Update fix of MITM vulnerability during public key exchange in secure connection
This commit is contained in:
Rahul Tank
2021-09-15 09:52:06 +05:30
parent ef1e0e35f0
commit e28c2e6f28
+3 -3
View File
@@ -569,9 +569,9 @@ ble_sm_sc_public_key_rx(uint16_t conn_handle, struct os_mbuf **om,
cmd = (struct ble_sm_public_key *)(*om)->om_data;
BLE_SM_LOG_CMD(0, "public key", conn_handle, ble_sm_public_key_log, cmd);
/* Check if the peer public key is same as our generated public key.
* Return fail if the public keys match. */
if (memcmp(cmd, ble_sm_sc_pub_key, 64) == 0) {
/* Check if the X component of peer public key is same as X component of our generated public key.
* Return fail if they match. */
if (memcmp(cmd, ble_sm_sc_pub_key, 32) == 0) {
res->enc_cb = 1;
res->sm_err = BLE_SM_ERR_AUTHREQ;
return;