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

Add security to service Characteristic

In the BLE Characteristics, a beginner's tutorial

Martin mentions: Since this is a beginners tutorial we will keep it simple and leave the doors wide open. No security, encryption, or passkey needed.

Is there an example to add security? I have a server, no IO, so it has to be Just Works bonding. I tried using BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM() as suggested, but then the advertising stops

I use SDK13, so perhaps there is something else I need to do.

Any help appreciated

Parents
  • Bjørn

    code execution does not reach app_error_handler.

    With both char_md.char_props.read = 1; and char_md.char_props.write = 1;

    // OUR_JOB: Step 3.A, Configuring Client Characteristic Configuration Descriptor metadata and add to char_md structure ble_gatts_attr_md_t cccd_md; memset(&cccd_md, 0, sizeof(cccd_md)); //GvR BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);

    //BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
    //BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
    cccd_md.vloc                = BLE_GATTS_VLOC_STACK;    
    char_md.p_cccd_md           = &cccd_md;
    char_md.char_props.notify   = 1;
    

    I see the following on the UART output:

    :ERROR:Fatal
    SDH:WARNING:RAM start should be adjusted to 0x20001ff0.
    SDH:WARNING:RAM size should be adjusted to 0xe010.
    

    In IAR I have

    define symbol __ICFEDIT_intvec_start__ = 0x1f000;
    /*-Memory Regions-*/
    define symbol __ICFEDIT_region_ROM_start__ = 0x1f000;
    define symbol __ICFEDIT_region_ROM_end__   = 0x7ffff;
    define symbol __ICFEDIT_region_RAM_start__ = 0x20002fff;
    define symbol __ICFEDIT_region_RAM_end__   = 0x2000ffff;
    export symbol __ICFEDIT_region_RAM_start__;
    export symbol __ICFEDIT_region_RAM_end__;
    /*-Sizes-*/
    define symbol __ICFEDIT_size_cstack__ = 0x800;
    define symbol __ICFEDIT_size_heap__   = 0x200;
    /**** End of ICF editor section. ###ICF###*/
    

    I guess there is no point in trying to use BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM() if I am not using //char_md.char_props.read = 1; or //char_md.char_props.write = 1;

    Since it is the CCCD Notify property being displayed, I assume the MITH bonding is only for the read and write.

Reply
  • Bjørn

    code execution does not reach app_error_handler.

    With both char_md.char_props.read = 1; and char_md.char_props.write = 1;

    // OUR_JOB: Step 3.A, Configuring Client Characteristic Configuration Descriptor metadata and add to char_md structure ble_gatts_attr_md_t cccd_md; memset(&cccd_md, 0, sizeof(cccd_md)); //GvR BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);

    //BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
    //BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
    cccd_md.vloc                = BLE_GATTS_VLOC_STACK;    
    char_md.p_cccd_md           = &cccd_md;
    char_md.char_props.notify   = 1;
    

    I see the following on the UART output:

    :ERROR:Fatal
    SDH:WARNING:RAM start should be adjusted to 0x20001ff0.
    SDH:WARNING:RAM size should be adjusted to 0xe010.
    

    In IAR I have

    define symbol __ICFEDIT_intvec_start__ = 0x1f000;
    /*-Memory Regions-*/
    define symbol __ICFEDIT_region_ROM_start__ = 0x1f000;
    define symbol __ICFEDIT_region_ROM_end__   = 0x7ffff;
    define symbol __ICFEDIT_region_RAM_start__ = 0x20002fff;
    define symbol __ICFEDIT_region_RAM_end__   = 0x2000ffff;
    export symbol __ICFEDIT_region_RAM_start__;
    export symbol __ICFEDIT_region_RAM_end__;
    /*-Sizes-*/
    define symbol __ICFEDIT_size_cstack__ = 0x800;
    define symbol __ICFEDIT_size_heap__   = 0x200;
    /**** End of ICF editor section. ###ICF###*/
    

    I guess there is no point in trying to use BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM() if I am not using //char_md.char_props.read = 1; or //char_md.char_props.write = 1;

    Since it is the CCCD Notify property being displayed, I assume the MITH bonding is only for the read and write.

Children
No Data
Related