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

the security issue in nRF52_SDK_0.9.2_dbc28c9

HI,all

when i want to notify with MITM,there is an issue with my project.

my central role device is IPHONE and the app is lightblue.

When i enabel notify ,the nrf52382 restart.

i know now the reason is the statement 'BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM'

following is my source code.

//in function '**main.c**'

#define IO_CAPS BLE_GAP_IO_CAPS_DISPLAY_ONLY
#define BOND       0
#define OOB        0
#define MITM        1
void resp_pair_request()

{

enter code here
ble_gap_sec_params_t sec_params;
uint32_t err_code;
memset(&sec_params,0,sizeof(ble_gap_sec_params_t));
sec_params.bond = BOND;
sec_params.io_caps = IO_CAPS;
sec_params.max_key_size = 16;
sec_params.min_key_size = 7;
sec_params.oob = BOND;
sec_params.mitm = MITM;
err_code=sd_ble_gap_sec_params_reply(m_conn_handle,BLE_GAP_SEC_STATUS_SUCCESS,&sec_params,NULL);
APP_ERROR_CHECK(err_code);
}

in function 'static void on_ble_evt(ble_evt_t * p_ble_evt)' in main.c

    case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
        // Pairing not supported
					printf("receive pair request\n");
					resp_pair_request();           
					APP_ERROR_CHECK(err_code);
        break;
			case BLE_GAP_EVT_PASSKEY_DISPLAY:
					printf("show passkey: ");
					for ( int i = 0; i < 6; i++)
					{ 
						printf("%c",p_ble_evt->evt.gap_evt.params. \
						passkey_display.passkey[i]);
					}
					break;

in source file 'ble_nus.c' , and in function 'static uint32_t rx_char_add(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) '

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&cccd_md.write_perm);
Parents
    1. How do you 'know that is the reason'

    2. Can you format your code properly so that people can read it

    3. You have an APP_ERROR_CHECK() of err_code but haven't set it (in the code shown)

    4. if the device is resetting are you going to the error handler? For the 100th time always put a breakpoint in the error handler so that you see if you get there.

Reply
    1. How do you 'know that is the reason'

    2. Can you format your code properly so that people can read it

    3. You have an APP_ERROR_CHECK() of err_code but haven't set it (in the code shown)

    4. if the device is resetting are you going to the error handler? For the 100th time always put a breakpoint in the error handler so that you see if you get there.

Children
No Data
Related