Mistake on this page?
Report an issue in GitHub or email us
smp_main.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief SMP main module.
6  *
7  * Copyright (c) 2010-2019 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 #ifndef SMP_MAIN_H
25 #define SMP_MAIN_H
26 
27 #include "sec_api.h"
28 #include "wsf_timer.h"
29 #include "l2c_api.h"
30 #include "dm_api.h"
31 #include "smp_api.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /**************************************************************************************************
38  Macros
39 **************************************************************************************************/
40 
41 /* State machine table constants */
42 #define SMP_SM_POS_EVENT 0 /* Column position for event */
43 #define SMP_SM_POS_NEXT_STATE 1 /* Column position for next state */
44 #define SMP_SM_POS_ACTION 2 /* Column position for action */
45 #define SMP_SM_NUM_COLS 3 /* Number of columns in state table */
46 #define SMP_STATE_TBL_COMMON_MAX 5 /* Number of entries in common state table */
47 
48 /* Position of parameters in pairing request/response */
49 #define SMP_IO_POS 1
50 #define SMP_OOB_POS 2
51 #define SMP_AUTHREQ_POS 3
52 #define SMP_MAXKEY_POS 4
53 #define SMP_IKEYDIST_POS 5
54 #define SMP_RKEYDIST_POS 6
55 
56 /* Position of parameters in public key message */
57 #define SMP_PUB_KEY_X_POS 1
58 #define SMP_PUB_KEY_Y_POS 33
59 
60 /* LESC Authorization Types */
61 #define SMP_AUTH_TYPE_UNKNOWN 0
62 #define SMP_AUTH_TYPE_JUST_WORKS 1
63 #define SMP_AUTH_TYPE_OOB 2
64 #define SMP_AUTH_TYPE_PASSKEY 3
65 #define SMP_AUTH_TYPE_NUM_COMP 4
66 
67 /*! smpi_sm state machine states */
68 enum
69 {
70  SMPI_SM_ST_IDLE, /*!< Idle */
71  SMPI_SM_ST_PAIR_RSP, /*!< Wait for pairing response */
72  SMPI_SM_ST_PIN, /*!< Wait for PIN */
73  SMPI_SM_ST_CNF_CALC_1, /*!< Wait for confirm calc 1 */
74  SMPI_SM_ST_CNF_CALC_2, /*!< Wait for confirm calc 2 */
75  SMPI_SM_ST_PAIR_CNF, /*!< Wait for pairing confirm */
76  SMPI_SM_ST_PAIR_RAND, /*!< Wait for pairing random */
77  SMPI_SM_ST_CNF_VER_CALC_1, /*!< Wait for confirm verify calc 1 */
78  SMPI_SM_ST_CNF_VER_CALC_2, /*!< Wait for confirm verify calc 2 */
79  SMPI_SM_ST_STK_CALC, /*!< Wait for STK calc */
80  SMPI_SM_ST_ENCRYPT, /*!< Wait for link encryption */
81  SMPI_SM_ST_KEY_DIST, /*!< Key distribution */
82  SMPI_SM_ST_ATTEMPTS, /*!< Repeated attempts */
83  SMPI_SM_ST_RSP_TO /*!< Response timeout state */
84 };
85 
86 /*! smpr_sm state machine states */
87 enum
88 {
89  SMPR_SM_ST_IDLE, /*!< Idle */
90  SMPR_SM_ST_API_PAIR_REQ, /*!< Wait for API pairing request */
91  SMPR_SM_ST_API_PAIR_RSP, /*!< Wait for API pairing response */
92  SMPR_SM_ST_PIN_PAIR_1, /*!< Wait for PIN or pairing confirm 1 */
93  SMPR_SM_ST_PIN_PAIR_2, /*!< Wait for PIN or pairing confirm 2 */
94  SMPR_SM_ST_CNF_CALC_1, /*!< Wait for confirm calc 1 */
95  SMPR_SM_ST_CNF_CALC_2, /*!< Wait for confirm calc 2 */
96  SMPR_SM_ST_PAIR_RAND, /*!< Wait for pairing random */
97  SMPR_SM_ST_CNF_VER_CALC_1, /*!< Wait for confirm verify calc 1 */
98  SMPR_SM_ST_CNF_VER_CALC_2, /*!< Wait for confirm verify calc 2 */
99  SMPR_SM_ST_STK_CALC, /*!< Wait for STK calc */
100  SMPR_SM_ST_ENCRYPT, /*!< Wait for link encryption */
101  SMPR_SM_ST_KEY_DIST, /*!< Key distribution */
102  SMPR_SM_ST_ATTEMPTS, /*!< Repeated attempts */
103  SMPR_SM_ST_RSP_TO /*!< Response timeout state */
104 };
105 
106 /*! smpi_sc_sm state machine states */
107 enum
108 {
109  SMPI_SC_SM_ST_IDLE, /*!< Idle */
110  SMPI_SC_SM_ST_PAIR_RSP, /*!< Wait for pairing response */
111  SMPI_SC_SM_ST_MODE_SELECT, /*!< Select the security mode (LESC or Legacy) */
112  SMPI_SC_SM_ST_LESC_PIN, /*!< Wait for PIN in LESC */
113  SMPI_SC_SM_ST_PUB_KEY, /*!< Wait for public key from peer */
114  SMPI_SC_SM_ST_AUTH_SELECT, /*!< Select the type of LESC pairing (Just Works, Passkey, or OOB) */
115 
116  SMPI_SC_SM_ST_JWNC_WAIT_CNF, /*!< Wait for confirm in Just Works/Numeric Comparison Pairing */
117  SMPI_SC_SM_ST_JWNC_RAND, /*!< Wait for rand in Just Works/Numeric Comparison Pairing */
118  SMPI_SC_SM_ST_JWNC_CHECK_1, /*!< Calculate confirm value in Just Works/Numeric Comparison Pairing */
119  SMPI_SC_SM_ST_JWNC_CHECK_2, /*!< Calculate user validate value in Just Works/Numeric Comparison Pairing */
120  SMPI_SC_SM_ST_JWNC_WAIT_USER, /* Wait for user to validate the confirm value */
121 
122  SMPI_SC_SM_ST_PK_KEYPRESS, /*!< Process a keypress command in passkey pairing */
123  SMPI_SC_SM_ST_PK_CALC, /*!< Calculate the confirm in passkey pairing */
124  SMPI_SC_SM_ST_PK_CNF, /*!< Wait for confirm in passkey pairing */
125  SMPI_SC_SM_ST_PK_RAND, /*!< Wait for rand in passkey pairing */
126  SMPI_SC_SM_ST_PK_CHECK, /*!< Check the conform value in passkey pairing */
127  SMPI_SC_SM_ST_PK_REPEAT, /*!< Repeat or complete the passkey pairing */
128 
129  SMPI_SC_SM_ST_OOB_SEND_RAND, /*!< Send the rand in OOB pairing */
130  SMPI_SC_SM_ST_OOB_WAIT_RAND, /*!< Wait for a rand in OOB pairing */
131 
132  SMPI_SC_SM_ST_CALC_DHKEY, /*!< Calculate the DHKEY shared secret */
133  SMPI_SC_SM_ST_CALC_F5_TKEY, /*!< Calculate the DHKEY T Key */
134  SMPI_SC_SM_ST_CALC_F5_MACKEY, /*!< Calculate the DHKEY MAC Key */
135  SMPI_SC_SM_ST_CALC_F5_LTK, /*!< Calculate the DHKEY LTK Key */
136  SMPI_SC_SM_ST_CALC_F6_EA, /*!< Calculate the DHKEY Ea Key */
137  SMPI_SC_SM_ST_CALC_F6_EB, /*!< Calculate the DHKEY Eb Key */
138  SMPI_SC_SM_ST_VERIFY_DH_CHECK, /*!< Verify the DHKEY check value */
139 
140  SMPI_SC_SM_ST_LEGACY_PIN, /*!< Wait for PIN */
141  SMPI_SC_SM_ST_CNF_CALC_1, /*!< Wait for confirm calc 1 */
142  SMPI_SC_SM_ST_CNF_CALC_2, /*!< Wait for confirm calc 2 */
143  SMPI_SC_SM_ST_PAIR_CNF, /*!< Wait for pairing confirm */
144  SMPI_SC_SM_ST_PAIR_RAND, /*!< Wait for pairing random */
145  SMPI_SC_SM_ST_CNF_VER_CALC_1, /*!< Wait for confirm verify calc 1 */
146  SMPI_SC_SM_ST_CNF_VER_CALC_2, /*!< Wait for confirm verify calc 2 */
147  SMPI_SC_SM_ST_STK_CALC, /*!< Wait for STK calc */
148  SMPI_SC_SM_ST_ENCRYPT, /*!< Wait for link encryption */
149  SMPI_SC_SM_ST_KEY_DIST, /*!< Key distribution */
150  SMPI_SC_SM_ST_ATTEMPTS, /*!< Repeated attempts */
151  SMPI_SC_SM_ST_RSP_TO /*!< Response timeout state */
152 };
153 
154 /*! smpr_sc_sm state machine states */
155 enum
156 {
157  SMPR_SC_SM_ST_IDLE, /*!< Idle */
158  SMPR_SC_SM_ST_API_PAIR_REQ, /*!< Wait for API pairing request */
159  SMPR_SC_SM_ST_API_PAIR_RSP, /*!< Wait for API pairing response */
160  SMPR_SC_SM_ST_MODE_SELECT, /*!< Select the security mode (LESC or Legacy) */
161  SMPR_SC_SM_ST_PUB_KEY, /*!< Wait for public key from peer */
162  SMPR_SC_SM_ST_LESC_PIN, /*!< Wait for pin in LESC */
163  SMPR_SC_SM_ST_AUTH_SELECT, /*!< Select the type of LESC pairing (Just Works, Passkey, or OOB) */
164 
165  SMPR_SC_SM_ST_JWNC_SETUP, /*!< Prepare for Just Works/Numeric Comparison Pairing */
166  SMPR_SC_SM_ST_JWNC_WAIT_RAND, /*!< Wait for Rand in Just Works/Numeric Comparison Pairing */
167  SMPR_SC_SM_ST_JWNC_CALC_G2, /*!< Calculate the user validate value in Just Works/Numeric Comparison Pairing */
168  SMPR_SC_SM_ST_JWNC_WAIT_USER, /*!< Wait for user to validate the confirm value */
169  SMPR_SC_SM_ST_JWNC_WAIT_USER_DH_CHECK_RCVD, /*!< Wait for user to validate the confirm value with a received DH Key Check */
170 
171  SMPR_SC_SM_ST_PK_KEYPRESS, /*!< Process a keypress command in passkey pairing */
172  SMPR_SC_SM_ST_PK_WAIT_AUTH, /*!< The confirm was received before the auth from the API, wait for the auth */
173  SMPR_SC_SM_ST_PK_WAIT_CNF, /*!< Wait for the confirm command in passkey pairing */
174  SMPR_SC_SM_ST_PK_CALC, /*!< Calculate the confirm in passkey pairing */
175  SMPR_SC_SM_ST_PK_RAND, /*!< Send the rand command in passkey pairing */
176  SMPR_SC_SM_ST_PK_CHECK, /*!< Check the confirm in passkey pairing */
177  SMPR_SC_SM_ST_PK_REPEAT, /*!< Repeat or complete the passkey pairing */
178 
179  SMPR_SC_SM_ST_OOB_SEND_RAND, /*!< Send the rand in OOB pairing */
180  SMPR_SC_SM_ST_OOB_WAIT_RAND, /*!< Wait for a rand in OOB pairing */
181 
182  SMPR_SC_SM_ST_WAIT_DH_CHECK, /*!< Wait for the DH Check command */
183  SMPR_SC_SM_ST_CALC_DHKEY, /*!< Calculate the DHKEY shared secret */
184  SMPR_SC_SM_ST_CALC_F5_TKEY, /*!< Calculate the DHKEY T Key */
185  SMPR_SC_SM_ST_CALC_F5_MACKEY, /*!< Calculate the DHKEY MAC Key */
186  SMPR_SC_SM_ST_CALC_F5_LTK, /*!< Calculate the DHKEY LTK Key */
187  SMPR_SC_SM_ST_CALC_F6_EA, /*!< Calculate the DHKEY Ea Key */
188  SMPR_SC_SM_ST_CALC_F6_EB, /*!< Calculate the DHKEY Eb Key */
189 
190  SMPR_SC_SM_ST_PIN_PAIR_1, /*!< Wait for PIN or pairing confirm 1 */
191  SMPR_SC_SM_ST_PIN_PAIR_2, /*!< Wait for PIN or pairing confirm 2 */
192  SMPR_SC_SM_ST_CNF_CALC_1, /*!< Wait for confirm calc 1 */
193  SMPR_SC_SM_ST_CNF_CALC_2, /*!< Wait for confirm calc 2 */
194  SMPR_SC_SM_ST_PAIR_RAND, /*!< Wait for pairing random */
195  SMPR_SC_SM_ST_CNF_VER_CALC_1, /*!< Wait for confirm verify calc 1 */
196  SMPR_SC_SM_ST_CNF_VER_CALC_2, /*!< Wait for confirm verify calc 2 */
197  SMPR_SC_SM_ST_STK_CALC, /*!< Wait for STK calc */
198  SMPR_SC_SM_ST_ENCRYPT, /*!< Wait for link encryption */
199  SMPR_SC_SM_ST_KEY_DIST, /*!< Key distribution */
200  SMPR_SC_SM_ST_ATTEMPTS, /*!< Repeated attempts */
201  SMPR_SC_SM_ST_RSP_TO /*!< Response timeout state */
202 };
203 
204 /**************************************************************************************************
205  Data Types
206 **************************************************************************************************/
207 
208 /* Data type for state machine table entry */
209 typedef uint8_t smpTblEntry_t[SMP_SM_NUM_COLS];
210 
211 /* Pairing request/response parameters */
212 typedef uint8_t smpPair_t[SMP_PAIR_REQ_LEN];
213 
214 /* Temporary storage structure for calculations and other data.
215  * Note that keyInd overlaps b1 through b3 so these will be overwritten
216  * when key exchange occurs.
217  *
218  * Notes on usage from start of pairing to encryption with STK:
219  * buf.b1: PIN or OOB data
220  * buf.b2: RAND from peer
221  * buf.b3: pairing cnf received from peer, then STK (if responder)
222  * buf.b4: RAND used in pairing calc
223  *
224  */
225 typedef union
226 {
227  struct
228  {
229  uint8_t b1[SMP_KEY_LEN];
230  uint8_t b2[SMP_KEY_LEN];
231  uint8_t b3[SMP_KEY_LEN];
232  uint8_t b4[SMP_KEY_LEN];
233  } buf;
234  dmSecKeyIndEvt_t keyInd;
235 } smpScratch_t;
236 
237 /* SMP message handling function type */
238 typedef void (*smpMsgHandler_t)(wsfMsgHdr_t *pMsg);
239 
240 /* SMP connection callback type */
241 typedef void (*smpConnCback_t)(dmEvt_t *pDmEvt);
242 
243 /* SMP data message type */
244 typedef struct
245 {
246  wsfMsgHdr_t hdr; /* Header structure */
247  uint8_t *pPacket; /* Pointer to buffer containing L2CAP packet */
248 } smpDataMsg_t;
249 
250 /* Union of event handler data types */
251 typedef union
252 {
253  wsfMsgHdr_t hdr; /* Header structure */
254  smpDmMsg_t dm; /* Union SMP DM message data types */
255  secAes_t aes; /* AES Security callback parameters structure */
256  smpDataMsg_t data; /* SMP data message */
257 } smpMsg_t;
258 
259 /* LE LTK Calc Scratch buffer */
260 typedef struct
261 {
262  uint8_t mac[SEC_CMAC_KEY_LEN]; /* MAC Key */
263  uint8_t ltk_t[SEC_CMAC_KEY_LEN]; /* LTK Key or T value of MAC/LTK calculation */
264 } smpScLtk_t;
265 
266 /* ECC DH Key */
267 typedef struct
268 {
269  uint8_t pubKeyX[SMP_PUB_KEY_LEN]; /* Public Key X */
270  uint8_t pubKeyY[SMP_PUB_KEY_LEN]; /* Public Key Y */
271 } smpScPubKey_t;
272 
273 /* LESC Scratch Buffers */
274 typedef struct
275 {
276  uint8_t Na_Ea[SMP_RAND_LEN]; /* Initiator Na or Ea */
277  uint8_t Nb_Eb[SMP_RAND_LEN]; /* Responder Nb or Eb */
278  uint8_t Ra[SMP_RAND_LEN]; /* Initiator Ra */
279  uint8_t Rb[SMP_RAND_LEN]; /* Responder Nb */
280  uint8_t PeerCb[SMP_RAND_LEN]; /* Peer Responder Confirm */
281  uint8_t PeerCa_Ea[SMP_RAND_LEN]; /* Peer Responder Confirm or DH Key Check */
283 
284 /* SMP LESC Control Block */
285 typedef struct
286 {
287  uint8_t lescEnabled; /* TRUE when LE Secure Connection pairing in use */
288  uint8_t authType; /* Type of authentication (Just Works, Numeric Comparison, Passkey, or OOB) */
289  uint8_t kpNotify; /* TRUE when Keypress notification in use */
290  uint8_t pkPos; /* Current passkey bit position */
291  bool_t display; /* Passkey display setting */
292  smpScPubKey_t *pPeerPublicKey; /* Peer device's ECC Key */
293  smpScPubKey_t *pLocalPublicKey; /* Local device's public ECC Key */
294  uint8_t *pPrivateKey; /* Local device's private ECC Key */
295  smpScScratch_t *pScratch; /* Scratch Buffer */
296  smpScLtk_t *pLtk; /* LTK calculation control */
297 } smpScCcb_t;
298 
299 /* SMP connection control block */
300 typedef struct
301 {
302  wsfTimer_t rspTimer; /* Response timer */
303  wsfTimer_t waitTimer; /* Wait interval timer after max attempts */
304  smpPair_t pairReq; /* Pair request parameters */
305  smpPair_t pairRsp; /* Pair response parameters */
306  smpScratch_t *pScr; /* Pointer to scratchpad buffer */
307  uint8_t *pQueued; /* Pointer to queued packet buffer */
308  uint16_t handle; /* Connection handle */
309  bool_t initiator; /* TRUE if device is initiator */
310  bool_t secReq; /* TRUE if security request sent or received */
311  bool_t flowDisabled; /* TRUE if data flow disabled */
312  dmConnId_t connId; /* DM connection ID */
313  uint8_t state; /* State machine state */
314  uint8_t nextCmdCode; /* Command code of next expected packet */
315  uint8_t auth; /* Resulting authentication and bonding flags */
316  uint8_t token; /* AES transaction token */
317  uint8_t attempts; /* Failed pairing attempts */
318  uint8_t lastSentKey; /* Command code of last sent key */
319  bool_t keyReady; /* Encryption key is ready */
320  smpScCcb_t *pScCcb; /* LE Secure Connection control blocks */
321 } smpCcb_t;
322 
323 /* State machine action function type */
324 typedef void (*smpAct_t)(smpCcb_t *pCcb, smpMsg_t *pMsg);
325 
326 /* SMP process pairing function */
327 typedef bool_t smpProcPairing_t(smpCcb_t *pCcb, uint8_t *pOob, uint8_t *pDisplay);
328 
329 /* SMP process pairing function */
330 typedef void smpProcAuthReq_t(smpCcb_t *pCcb, uint8_t oob, uint8_t display);
331 
332 /* State machine interface type */
333 typedef struct
334 {
335  smpTblEntry_t const * const *pStateTbl; /* Pointer to state table */
336  smpAct_t const *pActionTbl; /* Pointer to action table */
337  smpTblEntry_t const *pCommonTbl; /* Pointer to common action table */
338 } smpSmIf_t;
339 
340 /* SMP main control block */
341 typedef struct
342 {
343  smpCcb_t ccb[DM_CONN_MAX]; /* Legacy Connection control blocks */
344  smpSmIf_t const *pSlave; /* Slave state machine interface */
345  smpSmIf_t const *pMaster; /* Master state machine interface */
346  wsfHandlerId_t handlerId; /* WSF handler ID */
347  smpProcPairing_t *procPairing; /* Pointer to process pairing function */
348  smpProcAuthReq_t *procAuthReq; /* Pointer to process auth request function */
349  bool_t lescSupported; /* TRUE if LE Secure Connections is supported */
350 } smpCb_t;
351 
352 /**************************************************************************************************
353  Global Variables
354 **************************************************************************************************/
355 
356 /* SMP packet length table */
357 extern const uint8_t smpPktLenTbl[];
358 
359 /* Control block */
360 extern smpCb_t smpCb;
361 
362 /**************************************************************************************************
363  Function Declarations
364 **************************************************************************************************/
365 
366 /* utility functions from smp main */
367 smpCcb_t *smpCcbByHandle(uint16_t handle);
368 smpCcb_t *smpCcbByConnId(dmConnId_t connId);
369 void smpCalcC1Part1(smpCcb_t *pCcb, uint8_t *pKey, uint8_t *pRand);
370 void smpCalcC1Part2(smpCcb_t *pCcb, uint8_t *pKey, uint8_t *pPart1);
371 void smpCalcS1(smpCcb_t *pCcb, uint8_t *pKey, uint8_t *pRand1, uint8_t *pRand2);
372 void smpGenerateLtk(smpCcb_t *pCcb);
373 void smpSendPkt(smpCcb_t *pCcb, uint8_t *pPkt);
374 bool_t smpStateIdle(smpCcb_t *pCcb);
375 void *smpMsgAlloc(uint16_t len);
376 uint8_t smpGetScSecLevel(smpCcb_t *pCcb);
377 
378 /* action functions and utility functions from smp act */
379 void smpStartRspTimer(smpCcb_t *pCcb);
380 void smpActNone(smpCcb_t *pCcb, smpMsg_t *pMsg);
381 void smpCleanup(smpCcb_t *pCcb);
382 void smpActCleanup(smpCcb_t *pCcb, smpMsg_t *pMsg);
383 void smpSendPairingFailed(smpCcb_t *pCcb, uint8_t reason);
384 void smpActPairingFailed(smpCcb_t *pCcb, smpMsg_t *pMsg);
385 void smpActSecReqTimeout(smpCcb_t *pCcb, smpMsg_t *pMsg);
386 void smpActPairingCancel(smpCcb_t *pCcb, smpMsg_t *pMsg);
387 void smpActStorePin(smpCcb_t *pCcb, smpMsg_t *pMsg);
388 bool_t smpProcPairing(smpCcb_t *pCcb, uint8_t *pOob, uint8_t *pDisplay);
389 void smpAuthReq(smpCcb_t *pCcb, uint8_t oob, uint8_t display);
390 void smpActPairCnfCalc1(smpCcb_t *pCcb, smpMsg_t *pMsg);
391 void smpActPairCnfCalc2(smpCcb_t *pCcb, smpMsg_t *pMsg);
392 void smpActSendPairCnf(smpCcb_t *pCcb, smpMsg_t *pMsg);
393 void smpActPairCnfVerCalc1(smpCcb_t *pCcb, smpMsg_t *pMsg);
394 void smpActPairCnfVerCalc2(smpCcb_t *pCcb, smpMsg_t *pMsg);
395 bool_t smpSendKey(smpCcb_t *pCcb, uint8_t keyDist);
396 bool_t smpProcRcvKey(smpCcb_t *pCcb, dmSecKeyIndEvt_t *pKeyInd, uint8_t *pBuf, uint8_t keyDist);
397 void smpActMaxAttempts(smpCcb_t *pCcb, smpMsg_t *pMsg);
398 void smpActAttemptRcvd(smpCcb_t *pCcb, smpMsg_t *pMsg);
399 void smpActCheckAttempts(smpCcb_t *pCcb, smpMsg_t *pMsg);
400 void smpActNotifyDmAttemptsFailure(smpCcb_t *pCcb, smpMsg_t *pMsg);
401 void smpActNotifyDmRspToFailure(smpCcb_t *pCcb, smpMsg_t *pMsg);
402 void smpActPairingCmpl(smpCcb_t *pCcb, smpMsg_t *pMsg);
403 void smpSmExecute(smpCcb_t *pCcb, smpMsg_t *pMsg);
404 
405 /* diagnostic functions */
406 uint8_t *smpEventStr(uint8_t eventId);
407 uint8_t *smpStateStr(uint8_t state);
408 
409 /* SMP DB functions */
410 uint32_t SmpDbMaxAttemptReached(dmConnId_t connId);
411 void SmpDbPairingFailed(dmConnId_t connId);
412 uint32_t SmpDbGetPairingDisabledTime(dmConnId_t connId);
413 void SmpDbService(void);
414 uint8_t SmpDbGetFailureCount(dmConnId_t connId);
415 void SmpDbSetFailureCount(dmConnId_t connId, uint8_t count);
416 
417 #ifdef __cplusplus
418 };
419 #endif
420 
421 #endif /* SMP_MAIN_H */
uint8_t dmConnId_t
Connection identifier.
Definition: dm_api.h:588
#define SEC_CMAC_KEY_LEN
CMAC algorithm key length.
Definition: sec_api.h:41
AES Security callback parameters structure.
Definition: sec_api.h:70
#define SMP_KEY_LEN
Key length.
Definition: smp_defs.h:183
Data type for DM_SEC_KEY_IND.
Definition: dm_api.h:669
#define SMP_PUB_KEY_LEN
Secure connecdtions public key length.
Definition: smp_defs.h:186
Union of DM callback event data types.
Definition: dm_api.h:760
#define SMP_RAND_LEN
Random number length.
Definition: smp_defs.h:181
uint8_t wsfHandlerId_t
Event handler ID data type.
Definition: wsf_os.h:80
#define SMP_PAIR_REQ_LEN
Pairing request message length.
Definition: smp_defs.h:108
Device Manager subsystem API.
Timer structure.
Definition: wsf_timer.h:53
#define DM_CONN_MAX
Maximum number of connections.
Definition: cfg_stack.h:81
Timer service.
SMP subsystem API.
Union SMP DM message data types.
Definition: smp_api.h:143
Common message structure passed to event handler.
Definition: wsf_os.h:106
AES and random number security service API.
L2CAP subsystem API.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.