Classes | Macros | Enumerations | Functions
ble_sec.h File Reference

BLE SEC API. More...

`#include "ble_error.h"`
`#include <stdbool.h>`
Include dependency graph for ble_sec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | ble_sec_param_t
| SEC Parameter. More...
struct | ble_sec_tk_t
| TK value. More...
struct | ble_sec_oob_t
| SEC OOB value. More...
union | ble_sec_cfm_enc_data_t
| SEC Confirm encryption data. More...
struct | ble_sec_cfm_enc_t
| SEC Confirm encryption. More...
struct | ble_sec_nc_t
| SEC number comparison value. More...
union | ble_sec_enc_req_data_t
| SEC encryption request data. More...
struct | ble_sec_evt_enc_req_t
| Link Encrypte Request event for BLE_SEC_EVT_LINK_ENC_REQUEST. More...
struct | ble_sec_evt_enc_ind_t
| Link Encrypted event for BLE_SEC_EVT_LINK_ENCRYPTED. More...
struct | ble_sec_evt_keypress_notify_t
| Key Press Notify event for BLE_SEC_EVT_KEY_PRESS_NTF. More...
struct | ble_sec_evt_key_missing_t
| Key Missing event for BLE_SEC_EVT_KEY_MISSING. More...
struct | ble_sec_evt_t
| BLE Security event structure. More...

## Macros
#define | BLE_SEC_AUTH_NONE 0
| No auth requirement. More...
#define | BLE_SEC_AUTH_BOND (1 << 0)
| Bond flag. More...
#define | BLE_SEC_AUTH_MITM (1 << 2)
| MITM flag. More...
#define | BLE_SEC_AUTH_SEC_CON (1 << 3)
| Security connection flag. More...
#define | BLE_SEC_AUTH_KEY_PRESS_NOTIFY (1 << 4)
| Key press notify flag. More...
#define | BLE_SEC_AUTH_ALL (AUTH_BOND | AUTH_MITM | AUTH_SEC_CON | AUTH_KEY_PRESS_NOTIFY)
| All authentication flags are on. More...
#define | BLE_SEC_KDIST_NONE 0
| No key needs to be distributed. More...
#define | BLE_SEC_KDIST_ENCKEY (1 << 0)
| Distribute encryption and master identification info. More...
#define | BLE_SEC_KDIST_IDKEY (1 << 1)
| Distribute identity and address info. More...
#define | BLE_SEC_KDIST_SIGNKEY (1 << 2)
| Distribute signing info. More...
#define | BLE_SEC_KDIST_LINKKEY (1 << 3)
| Distribute BR/EDR link key info. More...
#define | BLE_SEC_KDIST_ALL (BLE_SEC_KDIST_ENCKEY | BLE_SEC_KDIST_IDKEY | BLE_SEC_KDIST_SIGNKEY)
| Distribute all info. More...
#define | BLE_BT_SEC_KDIST_ALL (BLE_SEC_KDIST_ALL | BLE_SEC_KDIST_LINKKEY)
| Distribute all info for LE/BREDR. More...

## Enumerations
enum | ble_sec_io_cap_t { BLE_SEC_IO_DISPLAY_ONLY = 0x00, BLE_SEC_IO_DISPLAY_YES_NO = 0x01, BLE_SEC_IO_KEYBOARD_ONLY = 0x02, BLE_SEC_IO_NO_INPUT_NO_OUTPUT = 0x03, BLE_SEC_IO_KEYBOARD_DISPLAY = 0x04 }
| SEC IO Capability. More...
enum | ble_sec_enc_req_type_t { BLE_SEC_PAIR_REQ, BLE_SEC_TK_REQ, BLE_SEC_OOB_REQ, BLE_SEC_NC_REQ }
| SEC Encryption Request Type. More...
enum | ble_sec_keypress_notify_t { BLE_SEC_KEY_PRESS_STARTED = 0x00, BLE_SEC_KEY_PRESS_ENTERED = 0x01, BLE_SEC_KEY_PRESS_ERASED = 0x02, BLE_SEC_KEY_PRESS_CLEARED = 0x03, BLE_SEC_KEY_PRESS_COMPLETED = 0x04 }
| SEC Key Press Notify. More...
enum | ble_sec_mode_level_t { BLE_SEC_MODE1_LEVEL1 = 0x00, BLE_SEC_MODE1_LEVEL2 = 0x01, BLE_SEC_MODE1_LEVEL3 = 0x02, BLE_SEC_MODE1_LEVEL4 = 0x03, BLE_SEC_MODE2_LEVEL1 = 0x04, BLE_SEC_MODE2_LEVEL2 = 0x05 }
| SEC mode and level. More...
enum | ble_sec_tk_type_t { BLE_SEC_TK_OOB = 0x00, BLE_SEC_TK_DISPLAY, BLE_SEC_TK_KEY_ENTRY }
| SEC TK type. More...
enum | ble_sec_key_missing_reason_t { BLE_SEC_BOND_INFO_LOAD_FAILED = 0x00, BLE_SEC_LTK_VALID_MASK_ERR, BLE_SEC_EDIV_RAND_VALUE_ERR }
| Key missing reason. More...

## Functions
uint16_t | ble_sec_params_set (ble_sec_param_t *p_sec_param)
| Set security parameter. More...
uint16_t | ble_sec_enc_start (uint8_t conn_idx)
| Start security encryption, this interface is used by both slave and master. More...
uint16_t | ble_sec_send_pair_req (uint8_t conn_idx)
| Send pair request, this interface is used only by master. More...
uint16_t | ble_sec_enc_cfm (uint8_t conn_idx, const ble_sec_cfm_enc_t *p_cfm_enc)
| Send the encrypt confirm information. More...
uint16_t | ble_sec_keypress_notify_send (uint8_t conn_idx, uint8_t notify_type)
| Send key press notify. More...

## Detailed Description

BLE SEC API.

Attention

  ##### Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file ble_sec.h.