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

BLE SEC API. More...

`#include "ble_error.h"`
`#include <stdbool.h>`

Go to the source code of this file.

## Classes
struct | sec_param_t
| SEC Parameter. More...
struct | sec_tk_t
| TK value. More...
struct | sec_oob_t
| SEC OOB value. More...
union | sec_cfm_enc_data_t
| SEC Confirm encryption data. More...
struct | sec_cfm_enc_t
| SEC Confirm encryption. More...
struct | sec_nc_t
| SEC number comparison value. More...
union | sec_enc_req_data_t
| SEC encryption request data. More...
struct | sec_enc_req_t
| SEC encryption request. More...
struct | sec_cb_fun_t
| SEC register call back. More...

## Macros
#define | AUTH_NONE 0
| No auth requirement. More...
#define | AUTH_BOND (1 << 0)
| Bond flag. More...
#define | AUTH_MITM (1 << 2)
| MITM flag. More...
#define | AUTH_SEC_CON (1 << 3)
| Security connection flag. More...
#define | AUTH_KEY_PRESS_NOTIFY (1 << 4)
| Key press notify flag. More...
#define | AUTH_ALL (AUTH_BOND | AUTH_MITM | AUTH_SEC_CON | AUTH_KEY_PRESS_NOTIFY)
| All authentication flags are on. More...
#define | KDIST_NONE 0
| No key needs to be distributed. More...
#define | KDIST_ENCKEY (1 << 0)
| Distribute encryption and master identification info. More...
#define | KDIST_IDKEY (1 << 1)
| Distribute identity and address info. More...
#define | KDIST_SIGNKEY (1 << 2)
| Distribute signing info. More...
#define | KDIST_ALL (KDIST_ENCKEY | KDIST_IDKEY | KDIST_SIGNKEY)
| Distribute all info. More...

## Enumerations
enum | sec_io_cap_t { IO_DISPLAY_ONLY = 0x00, IO_DISPLAY_YES_NO = 0x01, IO_KEYBOARD_ONLY = 0x02, IO_NO_INPUT_NO_OUTPUT = 0x03, IO_KEYBOARD_DISPLAY = 0x04 }
| SEC IO Capability. More...
enum | sec_enc_req_type_t { PAIR_REQ, TK_REQ, OOB_REQ, NC_REQ }
| SEC Encryption Request Type. More...
enum | sec_keypress_notify_t { KEY_PRESS_STARTED = 0x00, KEY_PRESS_ENTERED = 0x01, KEY_PRESS_ERASED = 0x02, KEY_PRESS_CLEARED = 0x03, KEY_PRESS_COMPLETED = 0x04 }
| SEC Key Press Notify. More...
enum | sec_enc_ind_t { ENC_SUCCESS = 0x00, ENC_FAIL_PASSKEY_ENTRY_FAIL = 0x01, ENC_FAIL_OOB_NOT_AVAILBL = 0x02, ENC_FAIL_AUTH_REQ = 0x03, ENC_FAIL_CONFIRM_VAL_FAIL = 0x04, ENC_FAIL_PAIRING_NOT_SUPPORT = 0x05, ENC_FAIL_ENCRPT_KEY_SIZE = 0x06, ENC_FAIL_COMMAND_NOT_SUPPORT = 0x07, ENC_FAIL_UNSPECIFIED = 0x08, ENC_FAIL_REPEAT_ATTEMPT = 0x09, ENC_FAIL_INVALID_PARAM = 0x0A, ENC_FAIL_DHKEY_CHECK_FAIL = 0x0B, ENC_FAIL_NUM_CMP_FAIL = 0x0C, ENC_FAIL_BR_EDR_IN_PROGRESS = 0x0D, ENC_FAIL_KEY_DRIV_GEN_NOT_ALLOW = 0x0E, ENC_FAIL_LTK_MISSING = 0x0F }
| SEC pair result. More...
enum | sec_mode_level_t { SEC_MODE1_LEVEL1 = 0x00, SEC_MODE1_LEVEL2 = 0x01, SEC_MODE1_LEVEL3 = 0x02, SEC_MODE1_LEVEL4 = 0x03, SEC_MODE2_LEVEL1 = 0x04, SEC_MODE2_LEVEL2 = 0x05 }
| SEC mode and level. More...
enum | sec_tk_type_t { SEC_TK_OOB = 0x00, SEC_TK_DISPLAY, SEC_TK_KEY_ENTRY }
| SEC TK type. More...
enum | sec_key_missing_reason_t { BOND_INFO_LOAD_FAILED = 0x00, LTK_VALID_MASK_ERR, EDIV_RAND_VALUE_ERR }
| Key missing reason. More...

## Functions
uint16_t | ble_sec_params_set (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_enc_cfm (uint8_t conn_idx, const 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.