This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LESC unable to pair (SM_pairing_faill )

Hi all,

I have tried to mimic the LESC multi role example to my own app, but I dint have luck to pair it using LESC, MITM, and perform bonding and I received a SM_pairing_faill reason 0x0b; screen capture below:

nRF connect PC

image description

nRF connect PC failing to pair

image description

sniffer capture

image description

details: Peripheral running on my peripheral device nRF52 with SDK13. Central using a nRF51 using PC nRF connect firmware.

My device does not have any Input, I am trying to perform LESC with just work

sec_params.bond           = true;
sec_params.mitm           = false;
sec_params.lesc           = true;
sec_params.keypress       = false;
sec_params.io_caps        = false;
sec_params.oob            = false;
sec_params.min_key_size   = 7;
sec_params.max_key_size   = 16;
sec_params.kdist_own.enc  = 1;
sec_params.kdist_own.id   = 1;
sec_params.kdist_peer.enc = 1;
sec_params.kdist_peer.id  = 1;

I tried use nRF connect (pc version) with the multi role example and it works with no issue, and I am pretty sure it is equal on my app (same settings), but I am stuck in the SM_paring_failed.

Parents
  • Hi Hung, Yes, it handle the BLE_GAP_EVT_LESC_DHKEY_REQUEST and it is using the NRF_CRYPTO_BLE_ECDH_CURVE_INFO

    case BLE_GAP_EVT_LESC_DHKEY_REQUEST:
    	static nrf_value_length_t peer_public_key_raw = { 0 };
    
    	peer_public_key_raw.p_value = &p_ble_evt->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer->pk[0];
    	peer_public_key_raw.length = BLE_GAP_LESC_P256_PK_LEN;
    
    	err_code = nrf_crypto_ecc_public_key_from_raw(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
    		&peer_public_key_raw,
    		&m_peer_public_key);
    	APP_ERROR_CHECK(err_code);
    
    	err_code = nrf_crypto_ecdh_shared_secret_compute(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
    		&m_private_key,
    		&m_peer_public_key,
    		&m_dh_key);
    	APP_ERROR_CHECK(err_code);
    
    	err_code = sd_ble_gap_lesc_dhkey_reply(connectionhandle, &m_lesc_dh_key);
    	APP_ERROR_CHECK(err_code);
    	break;	
    

    it looks like my peripheral is not sending the SM_pairing_rsp. My device is sending all the message sequence chart except for the sm_pairing_rsp, what event handle it?

Reply
  • Hi Hung, Yes, it handle the BLE_GAP_EVT_LESC_DHKEY_REQUEST and it is using the NRF_CRYPTO_BLE_ECDH_CURVE_INFO

    case BLE_GAP_EVT_LESC_DHKEY_REQUEST:
    	static nrf_value_length_t peer_public_key_raw = { 0 };
    
    	peer_public_key_raw.p_value = &p_ble_evt->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer->pk[0];
    	peer_public_key_raw.length = BLE_GAP_LESC_P256_PK_LEN;
    
    	err_code = nrf_crypto_ecc_public_key_from_raw(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
    		&peer_public_key_raw,
    		&m_peer_public_key);
    	APP_ERROR_CHECK(err_code);
    
    	err_code = nrf_crypto_ecdh_shared_secret_compute(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
    		&m_private_key,
    		&m_peer_public_key,
    		&m_dh_key);
    	APP_ERROR_CHECK(err_code);
    
    	err_code = sd_ble_gap_lesc_dhkey_reply(connectionhandle, &m_lesc_dh_key);
    	APP_ERROR_CHECK(err_code);
    	break;	
    

    it looks like my peripheral is not sending the SM_pairing_rsp. My device is sending all the message sequence chart except for the sm_pairing_rsp, what event handle it?

Children
No Data
Related