ble_sec.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file ble_sec.h
5  *
6  * @brief BLE SEC API
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  *****************************************************************************************
36  */
37 
38 /**
39  * @addtogroup BLE
40  * @{
41  */
42 
43  /**
44  @addtogroup BLE_SEC Security Manager(SM)
45  @{
46  @brief Definitions and prototypes for the BLE_SEC interface.
47  */
48 
49 #ifndef __BLE_SEC_H__
50 #define __BLE_SEC_H__
51 
52 #include "ble_error.h"
53 #include "ble_gapc.h"
54 #include <stdbool.h>
55 
56 /**@addtogroup BLE_SM_DEFINES Defines
57  * @{
58  */
59 /**@defgroup BLE_SEC_AUTH_FLAG SEC Auth Flag
60 * @{
61 */
62 #define BLE_SEC_AUTH_NONE 0 /**< No auth requirement. */
63 #define BLE_SEC_AUTH_BOND (1 << 0) /**< Bond flag. */
64 #define BLE_SEC_AUTH_MITM (1 << 2) /**< MITM flag. */
65 #define BLE_SEC_AUTH_SEC_CON (1 << 3) /**< Security connection flag. */
66 #define BLE_SEC_AUTH_KEY_PRESS_NOTIFY (1 << 4) /**< Key press notify flag. */
67 #define BLE_SEC_AUTH_ALL (BLE_SEC_AUTH_BOND | BLE_SEC_AUTH_MITM | BLE_SEC_AUTH_SEC_CON | BLE_SEC_AUTH_KEY_PRESS_NOTIFY) /**< All authentication flags are on. */
68 /**@} */
69 
70 /**@defgroup BLE_SEC_KEY_DIST_FLAG SEC Key Distribution Flag
71 * @{
72 */
73 #define BLE_SEC_KDIST_NONE 0 /**< No key needs to be distributed. */
74 #define BLE_SEC_KDIST_ENCKEY (1 << 0) /**< Distribute encryption and master identification info. */
75 #define BLE_SEC_KDIST_IDKEY (1 << 1) /**< Distribute identity and address info. */
76 #define BLE_SEC_KDIST_SIGNKEY (1 << 2) /**< Distribute signing info. */
77 #define BLE_SEC_KDIST_LINKKEY (1 << 3) /**< Distribute BR/EDR link key info. This flag only used for LE/BREDR. */
78 #define BLE_SEC_KDIST_ALL (BLE_SEC_KDIST_ENCKEY | BLE_SEC_KDIST_IDKEY | BLE_SEC_KDIST_SIGNKEY) /**< Distribute all info. */
79 #define BLE_BT_SEC_KDIST_ALL (BLE_SEC_KDIST_ALL | BLE_SEC_KDIST_LINKKEY) /**< Distribute all info for LE/BREDR. */
80 
81 /**@} */
82 /**@} */
83 
84 /**@addtogroup BLE_SEC_ENUMERATIONS Enumerations
85  * @{ */
86 /**@brief SEC IO Capability. */
87 typedef enum
88 {
89  BLE_SEC_IO_DISPLAY_ONLY = 0x00, /**< Display only. */
90  BLE_SEC_IO_DISPLAY_YES_NO = 0x01, /**< Display and input yes or no. */
91  BLE_SEC_IO_KEYBOARD_ONLY = 0x02, /**< Keyboard only. */
92  BLE_SEC_IO_NO_INPUT_NO_OUTPUT = 0x03, /**< No input and no output. */
93  BLE_SEC_IO_KEYBOARD_DISPLAY = 0x04 /**< Keyboard and display. */
95 
96 /**@brief SEC Encryption Request Type.
97  *@note These types indicate some operations need to interact with app during pair process.
98  */
99 typedef enum
100 {
101  BLE_SEC_PAIR_REQ, /**< Pair request. Apps need to decide whether to accept this request. */
102  BLE_SEC_TK_REQ, /**< TK request. Apps need to set the TK value. */
103  BLE_SEC_OOB_REQ, /**< OOB request. Apps need to set the OOB value. */
104  BLE_SEC_NC_REQ /**< Number comparison request. Apps need to check if it is the same number displayed in Master and Slave. */
106 
107 /**@brief SEC Key Press Notify. */
108 typedef enum
109 {
110  BLE_SEC_KEY_PRESS_STARTED = 0x00, /**< Passkey entry started. */
111  BLE_SEC_KEY_PRESS_ENTERED = 0x01, /**< Passkey digit entered. */
112  BLE_SEC_KEY_PRESS_ERASED = 0x02, /**< Passkey digit erased. */
113  BLE_SEC_KEY_PRESS_CLEARED = 0x03, /**< Passkey cleared. */
114  BLE_SEC_KEY_PRESS_COMPLETED = 0x04 /**< Passkey entry completed. */
116 
117 /**@brief SEC mode and level. */
118 typedef enum
119 {
120  BLE_SEC_MODE1_LEVEL1 = 0x00, /**< No security is needed. */
121  BLE_SEC_MODE1_LEVEL2 = 0x01, /**< Encrypted link is required. Unnecessary: MITM and SC. */
122  BLE_SEC_MODE1_LEVEL3 = 0x02, /**< Encrypted link is required. Necessary: MITM; unnecessary: SC. */
123  BLE_SEC_MODE1_LEVEL4 = 0x03, /**< Encrypted link is required. Necessary: MITM and SC. */
124  BLE_SEC_MODE2_LEVEL1 = 0x04, /**< Data signing is required. Unnecessary: MITM and SC. */
125  BLE_SEC_MODE2_LEVEL2 = 0x05, /**< Data signing is required. Necessary: MITM; unnecessary: SC. */
127 
128 /**@brief SEC TK type. */
129 typedef enum
130 {
131  BLE_SEC_TK_OOB = 0x00, /**<TK got from OOB (out of band) method. */
132  BLE_SEC_TK_DISPLAY, /**<TK generated and shall be displayed by local device. */
133  BLE_SEC_TK_KEY_ENTRY /**<TK shall be entered by user using device keyboard. */
135 
136 /**@brief Key missing reason. */
137 typedef enum
138 {
139  BLE_SEC_BOND_INFO_LOAD_FAILED = 0x00, /**<Bond information load failed. */
140  BLE_SEC_LTK_VALID_MASK_ERR, /**<LTK valid mask flag is false. */
141  BLE_SEC_EDIV_RAND_VALUE_ERR /**<Ediv and rand value not match. */
143 /** @} */
144 
145 /**@addtogroup BLE_SEC_STRUCTURES Structures
146  * @{ */
147 /**@brief SEC Parameter. */
148 typedef struct
149 {
150  ble_sec_mode_level_t level; /**< Set the minimum security level of the device, see @ref ble_sec_mode_level_t. */
151  ble_sec_io_cap_t io_cap; /**< Set the IO capability, see @ref ble_sec_io_cap_t. */
152  bool oob; /**< Indicate whether OOB is supported. */
153  uint8_t auth; /**< Set the auth, see @ref BLE_SEC_AUTH_FLAG. */
154  uint8_t key_size; /**< Indicate the supported maximum LTK size (range: 7-16). */
155  uint8_t ikey_dist; /**< Set the initial key distribution, see @ref BLE_SEC_KEY_DIST_FLAG. */
156  uint8_t rkey_dist; /**< Set the response key distribution, see @ref BLE_SEC_KEY_DIST_FLAG. */
158 
159 /**@brief TK value. */
160 typedef struct
161 {
162  uint8_t key[16]; /**< TK value. */
163 } ble_sec_tk_t;
164 
165 /**@brief SEC OOB value. */
166 typedef struct
167 {
168  uint8_t conf[16]; /**< Confirm value. */
169  uint8_t rand[16]; /**< Random value. */
170 } ble_sec_oob_t;
171 
172 /**@brief SEC Confirm encryption data. */
173 typedef union
174 {
175  ble_sec_tk_t tk; /**< TK value, see @ref ble_sec_tk_t. */
176  ble_sec_oob_t oob; /**< OOB value, see @ref ble_sec_oob_t. */
178 
179 /**@brief SEC Confirm encryption. */
180 typedef struct
181 {
182  ble_sec_enc_req_type_t req_type; /**< Request type, see @ref ble_sec_enc_req_type_t. */
183  bool accept; /**< Indicate whether to accept the request. */
184  ble_sec_cfm_enc_data_t data; /**< SEC Confirm encryption data, see @ref ble_sec_cfm_enc_data_t. */
186 
187 /**@brief SEC number comparison value. */
188 typedef struct
189 {
190  uint8_t value[4]; /**< Number comparison value (000000~999999). */
191 } ble_sec_nc_t;
192 
193 /**@brief SEC encryption request data. */
194 typedef union
195 {
196  ble_sec_tk_type_t tk_type; /**<TK type, see @ref ble_sec_tk_type_t. */
197  ble_sec_oob_t oob_data; /**<OOB data, see @ref ble_sec_oob_t. */
198  ble_sec_nc_t nc_data; /**<Number comparison data, see @ref ble_sec_nc_t. */
200 
201 /**@brief SEC encryption request. */
202 typedef struct
203 {
204  ble_sec_enc_req_type_t req_type; /**< Indicate the request type, @ref ble_sec_enc_req_type_t. */
205  ble_sec_enc_req_data_t data; /**< SEC encryption request data, @ref ble_sec_enc_req_data_t. */
207 
208  /**@brief Link Encrypte Request event for @ref BLE_SEC_EVT_LINK_ENC_REQUEST. */
209 typedef struct
210 {
211  ble_sec_enc_req_type_t req_type; /**< Indicate the request type, @ref ble_sec_enc_req_type_t. */
212  ble_sec_enc_req_data_t data; /**< SEC encryption request data, @ref ble_sec_enc_req_data_t. */
214 
215  /**@brief Link Encrypted event for @ref BLE_SEC_EVT_LINK_ENCRYPTED. */
216 typedef struct
217 {
218  uint8_t auth; /**< Auth type. */
220 
221 /**@brief Key Press Notify event for @ref BLE_SEC_EVT_KEY_PRESS_NTF. */
222 typedef struct
223 {
224  ble_sec_keypress_notify_t notify_type; /**< key Press Notify type. */
226 
227 /**@brief Key Missing event for @ref BLE_SEC_EVT_KEY_MISSING. */
228 typedef struct
229 {
230  ble_sec_key_missing_reason_t reason; /**< Keymissing reason. */
232 
233 /**@brief BLE Security event structure. */
234 typedef struct
235 {
236  uint8_t index; /**< Index of connection. */
237  union
238  {
239  ble_sec_evt_enc_req_t enc_req; /**< Link Encrypte Request event. */
240  ble_sec_evt_enc_ind_t enc_ind; /**< Link Encrypted event. */
241  ble_sec_evt_keypress_notify_t keypress_ntf; /**< Key Press Notify event. */
242  ble_sec_evt_key_missing_t key_missing; /**< Key Missing event. */
243  } params; /**< The parameters of sec events. */
244 } ble_sec_evt_t; /**< Event Parameters. */
245 
246 /**@brief OOB info for CCC SC OOB pair. */
247 typedef void (*oob_info_cb_t)(uint8_t *pub_key_x, uint8_t *pub_key_y, uint8_t *rand, uint8_t *confirm);
248 
249 /** @} */
250 
251 /** @addtogroup BLE_SEC_FUNCTIONS Functions
252  * @{ */
253 /**
254  ****************************************************************************************
255  * @brief Set security parameter.
256  *
257  * @param[in] p_sec_param: Pointer to the security parameter structure, @ref ble_sec_param_t.
258  *
259  * @retval ::SDK_SUCCESS: The security parameter is successfully set to the BLE stack.
260  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
261  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
262  ****************************************************************************************
263  */
264 uint16_t ble_sec_params_set(ble_sec_param_t *p_sec_param);
265 
266 /**
267  ****************************************************************************************
268  * @brief Set security parameter for specific role.
269  *
270  * @param[in] p_sec_param: Pointer to the security parameter structure, @ref ble_sec_param_t.
271  * @param[in] role: 0: master role, 1: slave role, @ref ble_gap_ll_role_type_t.
272  *
273  * @retval ::SDK_SUCCESS: The security parameter is successfully set to the BLE stack.
274  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
275  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
276  ****************************************************************************************
277  */
278 uint16_t ble_sec_params_set_with_role(ble_sec_param_t *p_sec_param, uint8_t role);
279 
280 /**
281  ****************************************************************************************
282  * @brief Start security encryption, this interface is used by both slave and master
283  *
284  * @note If the local device role is master, it will check that if the peer device is bonded firstly. If the peer device is bonded,
285  * the stack will encrypt the link directly, otherwise the stack will send a pair request to the peer device.
286  *
287  * @note If the local device role is slave, the stack will send a security request to the peer device.
288  *
289  * @param[in] conn_idx: ACL connection index, the first ACL connection index is 0, and increased one by one.
290  *
291  * @retval ::SDK_SUCCESS: The security encryption is successfully set to the BLE stack.
292  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
293  ****************************************************************************************
294  */
295 uint16_t ble_sec_enc_start(uint8_t conn_idx);
296 
297 /**
298  ****************************************************************************************
299  * @brief Send the encrypt confirm information
300  *
301  * @param[in] conn_idx: ACL connection index, the first ACL connection index is 0, and increased one by one.
302  * @param[in] p_cfm_enc: Pointer to the confirm encryption structure, see @ref ble_sec_cfm_enc_t.
303  *
304  * @retval ::SDK_SUCCESS: The confirm encryption is successfully set to the BLE stack.
305  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
306  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
307  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
308  ****************************************************************************************
309  */
310 uint16_t ble_sec_enc_cfm(uint8_t conn_idx, const ble_sec_cfm_enc_t *p_cfm_enc);
311 
312 /**
313  ****************************************************************************************
314  * @brief Get the pair info by peer identity address.
315  *
316  * @param[in] p_iden_addr: Pointer to the identity address.
317  * @param[in] iden_addr_type: Identity address type.
318  * @param[out] p_irk: Pointer to the irk.
319  * @param[out] p_ltk: Pointer to the ltk.
320  *
321  * @retval ::SDK_SUCCESS: Success to find the pair info.
322  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Fail to get the pair info.
323  ****************************************************************************************
324  */
325 uint16_t ble_sec_get_pair_info(uint8_t *p_iden_addr, uint8_t iden_addr_type, uint8_t *p_irk, uint8_t *p_ltk);
326 
327 /**
328  ****************************************************************************************
329  * @brief Get the pair info by connection index.
330  *
331  * @param[in] conn_idx: Connection index.
332  * @param[out] p_iden_addr: Pointer to the identity address.
333  * @param[out] p_iden_addr_type: Pointer to the identity address type.
334  * @param[out] p_irk: Pointer to the irk.
335  * @param[out] p_ltk: Pointer to the ltk.
336  *
337  * @retval ::SDK_SUCCESS: Success to find the pair info.
338  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
339  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
340  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Item not found in the bond list.
341  ****************************************************************************************
342  */
343 uint16_t ble_sec_get_pair_info_by_conn_idx(uint8_t conn_idx, uint8_t *p_iden_addr, uint8_t *p_iden_addr_type, uint8_t *p_irk, uint8_t *p_ltk);
344 
345 /**
346  ****************************************************************************************
347  * @brief Check bonded state by connection index.
348  *
349  * @param[in] conn_idx: ACL connection index.
350  *
351  * @retval ::true: Connection is bonded.
352  * @retval ::false: Connection is not bonded.
353  ****************************************************************************************
354  */
355 bool ble_sec_check_bonded(uint8_t conn_idx);
356 
357 /**
358  ****************************************************************************************
359  * @brief Check bonded state by peer address.
360  *
361  * @param[in] p_peer_iden_addr: Pointer to the peer identity address.
362  *
363  * @retval ::true: Peer address is bonded.
364  * @retval ::false: Peer address is not bonded.
365  ****************************************************************************************
366  */
368 
369 /**
370  ****************************************************************************************
371  * @brief Init oob info for ccc sc pair.
372  *
373  * @param[in] p_cb: Pointer to the callback for oob info.
374  *
375  ****************************************************************************************
376  */
378 
379 /** @} */
380 
381 #endif
382 
383 /** @} */
384 /** @} */
ble_sec_enc_req_data_t::nc_data
ble_sec_nc_t nc_data
Definition: ble_sec.h:198
BLE_SEC_KEY_PRESS_COMPLETED
@ BLE_SEC_KEY_PRESS_COMPLETED
Definition: ble_sec.h:114
BLE_SEC_BOND_INFO_LOAD_FAILED
@ BLE_SEC_BOND_INFO_LOAD_FAILED
Definition: ble_sec.h:139
ble_sec_cfm_enc_data_t::oob
ble_sec_oob_t oob
Definition: ble_sec.h:176
ble_sec_nc_t
SEC number comparison value.
Definition: ble_sec.h:189
BLE_SEC_KEY_PRESS_CLEARED
@ BLE_SEC_KEY_PRESS_CLEARED
Definition: ble_sec.h:113
BLE_SEC_MODE2_LEVEL1
@ BLE_SEC_MODE2_LEVEL1
Definition: ble_sec.h:124
BLE_SEC_OOB_REQ
@ BLE_SEC_OOB_REQ
Definition: ble_sec.h:103
BLE_SEC_KEY_PRESS_STARTED
@ BLE_SEC_KEY_PRESS_STARTED
Definition: ble_sec.h:110
ble_sec_check_bonded_by_addr
bool ble_sec_check_bonded_by_addr(ble_gap_bdaddr_t *p_peer_iden_addr)
Check bonded state by peer address.
ble_sec_evt_keypress_notify_t
Key Press Notify event for BLE_SEC_EVT_KEY_PRESS_NTF.
Definition: ble_sec.h:223
ble_sec_evt_enc_req_t::req_type
ble_sec_enc_req_type_t req_type
Definition: ble_sec.h:211
ble_sec_ccc_sc_oob_pair_init
void ble_sec_ccc_sc_oob_pair_init(oob_info_cb_t p_cb)
Init oob info for ccc sc pair.
BLE_SEC_TK_OOB
@ BLE_SEC_TK_OOB
Definition: ble_sec.h:131
ble_gap_bdaddr_t
The struct of broadcast address with broadcast type.
Definition: ble_gapc.h:269
ble_sec_cfm_enc_data_t::tk
ble_sec_tk_t tk
Definition: ble_sec.h:175
ble_sec_tk_t
TK value.
Definition: ble_sec.h:161
BLE_SEC_TK_KEY_ENTRY
@ BLE_SEC_TK_KEY_ENTRY
Definition: ble_sec.h:133
ble_sec_param_t::io_cap
ble_sec_io_cap_t io_cap
Definition: ble_sec.h:151
ble_sec_param_t::rkey_dist
uint8_t rkey_dist
Definition: ble_sec.h:156
ble_sec_evt_keypress_notify_t::notify_type
ble_sec_keypress_notify_t notify_type
Definition: ble_sec.h:224
ble_sec_param_t::oob
bool oob
Definition: ble_sec.h:152
ble_sec_evt_key_missing_t
Key Missing event for BLE_SEC_EVT_KEY_MISSING.
Definition: ble_sec.h:229
ble_sec_cfm_enc_t
SEC Confirm encryption.
Definition: ble_sec.h:181
BLE_SEC_KEY_PRESS_ENTERED
@ BLE_SEC_KEY_PRESS_ENTERED
Definition: ble_sec.h:111
BLE_SEC_TK_DISPLAY
@ BLE_SEC_TK_DISPLAY
Definition: ble_sec.h:132
ble_sec_enc_req_t
SEC encryption request.
Definition: ble_sec.h:203
ble_sec_evt_enc_ind_t::auth
uint8_t auth
Definition: ble_sec.h:218
ble_sec_evt_enc_ind_t
Link Encrypted event for BLE_SEC_EVT_LINK_ENCRYPTED.
Definition: ble_sec.h:217
ble_sec_evt_key_missing_t::reason
ble_sec_key_missing_reason_t reason
Definition: ble_sec.h:230
ble_sec_evt_enc_req_t
Link Encrypte Request event for BLE_SEC_EVT_LINK_ENC_REQUEST.
Definition: ble_sec.h:210
ble_sec_enc_req_data_t::tk_type
ble_sec_tk_type_t tk_type
Definition: ble_sec.h:196
BLE_SEC_MODE1_LEVEL1
@ BLE_SEC_MODE1_LEVEL1
Definition: ble_sec.h:120
ble_sec_cfm_enc_t::data
ble_sec_cfm_enc_data_t data
Definition: ble_sec.h:184
ble_sec_enc_req_data_t
SEC encryption request data.
Definition: ble_sec.h:195
ble_error.h
File that contains error codes.
ble_gapc.h
BLE GAPC API.
BLE_SEC_MODE1_LEVEL2
@ BLE_SEC_MODE1_LEVEL2
Definition: ble_sec.h:121
BLE_SEC_KEY_PRESS_ERASED
@ BLE_SEC_KEY_PRESS_ERASED
Definition: ble_sec.h:112
ble_sec_evt_t::enc_req
ble_sec_evt_enc_req_t enc_req
Definition: ble_sec.h:239
ble_sec_enc_cfm
uint16_t ble_sec_enc_cfm(uint8_t conn_idx, const ble_sec_cfm_enc_t *p_cfm_enc)
Send the encrypt confirm information.
oob_info_cb_t
void(* oob_info_cb_t)(uint8_t *pub_key_x, uint8_t *pub_key_y, uint8_t *rand, uint8_t *confirm)
OOB info for CCC SC OOB pair.
Definition: ble_sec.h:247
ble_sec_cfm_enc_t::accept
bool accept
Definition: ble_sec.h:183
BLE_SEC_IO_DISPLAY_ONLY
@ BLE_SEC_IO_DISPLAY_ONLY
Definition: ble_sec.h:89
ble_sec_enc_req_t::req_type
ble_sec_enc_req_type_t req_type
Definition: ble_sec.h:204
ble_sec_param_t::key_size
uint8_t key_size
Definition: ble_sec.h:154
BLE_SEC_MODE1_LEVEL3
@ BLE_SEC_MODE1_LEVEL3
Definition: ble_sec.h:122
ble_sec_mode_level_t
ble_sec_mode_level_t
SEC mode and level.
Definition: ble_sec.h:119
ble_sec_evt_enc_req_t::data
ble_sec_enc_req_data_t data
Definition: ble_sec.h:212
ble_sec_cfm_enc_t::req_type
ble_sec_enc_req_type_t req_type
Definition: ble_sec.h:182
ble_sec_tk_type_t
ble_sec_tk_type_t
SEC TK type.
Definition: ble_sec.h:130
BLE_SEC_TK_REQ
@ BLE_SEC_TK_REQ
Definition: ble_sec.h:102
BLE_SEC_IO_NO_INPUT_NO_OUTPUT
@ BLE_SEC_IO_NO_INPUT_NO_OUTPUT
Definition: ble_sec.h:92
ble_sec_keypress_notify_t
ble_sec_keypress_notify_t
SEC Key Press Notify.
Definition: ble_sec.h:109
BLE_SEC_NC_REQ
@ BLE_SEC_NC_REQ
Definition: ble_sec.h:104
ble_sec_enc_start
uint16_t ble_sec_enc_start(uint8_t conn_idx)
Start security encryption, this interface is used by both slave and master.
ble_sec_enc_req_data_t::oob_data
ble_sec_oob_t oob_data
Definition: ble_sec.h:197
ble_sec_key_missing_reason_t
ble_sec_key_missing_reason_t
Key missing reason.
Definition: ble_sec.h:138
BLE_SEC_IO_KEYBOARD_DISPLAY
@ BLE_SEC_IO_KEYBOARD_DISPLAY
Definition: ble_sec.h:93
BLE_SEC_LTK_VALID_MASK_ERR
@ BLE_SEC_LTK_VALID_MASK_ERR
Definition: ble_sec.h:140
ble_sec_enc_req_t::data
ble_sec_enc_req_data_t data
Definition: ble_sec.h:205
ble_sec_cfm_enc_data_t
SEC Confirm encryption data.
Definition: ble_sec.h:174
BLE_SEC_MODE2_LEVEL2
@ BLE_SEC_MODE2_LEVEL2
Definition: ble_sec.h:125
ble_sec_get_pair_info_by_conn_idx
uint16_t ble_sec_get_pair_info_by_conn_idx(uint8_t conn_idx, uint8_t *p_iden_addr, uint8_t *p_iden_addr_type, uint8_t *p_irk, uint8_t *p_ltk)
Get the pair info by connection index.
BLE_SEC_IO_KEYBOARD_ONLY
@ BLE_SEC_IO_KEYBOARD_ONLY
Definition: ble_sec.h:91
ble_sec_evt_t::enc_ind
ble_sec_evt_enc_ind_t enc_ind
Definition: ble_sec.h:240
BLE_SEC_PAIR_REQ
@ BLE_SEC_PAIR_REQ
Definition: ble_sec.h:101
BLE_SEC_IO_DISPLAY_YES_NO
@ BLE_SEC_IO_DISPLAY_YES_NO
Definition: ble_sec.h:90
ble_sec_get_pair_info
uint16_t ble_sec_get_pair_info(uint8_t *p_iden_addr, uint8_t iden_addr_type, uint8_t *p_irk, uint8_t *p_ltk)
Get the pair info by peer identity address.
ble_sec_params_set_with_role
uint16_t ble_sec_params_set_with_role(ble_sec_param_t *p_sec_param, uint8_t role)
Set security parameter for specific role.
ble_sec_io_cap_t
ble_sec_io_cap_t
SEC IO Capability.
Definition: ble_sec.h:88
ble_sec_evt_t::index
uint8_t index
Definition: ble_sec.h:236
BLE_SEC_EDIV_RAND_VALUE_ERR
@ BLE_SEC_EDIV_RAND_VALUE_ERR
Definition: ble_sec.h:141
ble_sec_param_t
SEC Parameter.
Definition: ble_sec.h:149
ble_sec_evt_t::keypress_ntf
ble_sec_evt_keypress_notify_t keypress_ntf
Definition: ble_sec.h:241
ble_sec_param_t::ikey_dist
uint8_t ikey_dist
Definition: ble_sec.h:155
ble_sec_params_set
uint16_t ble_sec_params_set(ble_sec_param_t *p_sec_param)
Set security parameter.
ble_sec_check_bonded
bool ble_sec_check_bonded(uint8_t conn_idx)
Check bonded state by connection index.
BLE_SEC_MODE1_LEVEL4
@ BLE_SEC_MODE1_LEVEL4
Definition: ble_sec.h:123
ble_sec_param_t::auth
uint8_t auth
Definition: ble_sec.h:153
ble_sec_evt_t
BLE Security event structure.
Definition: ble_sec.h:235
ble_sec_enc_req_type_t
ble_sec_enc_req_type_t
SEC Encryption Request Type.
Definition: ble_sec.h:100
ble_sec_evt_t::key_missing
ble_sec_evt_key_missing_t key_missing
Definition: ble_sec.h:242
ble_sec_param_t::level
ble_sec_mode_level_t level
Definition: ble_sec.h:150
ble_sec_oob_t
SEC OOB value.
Definition: ble_sec.h:167