smp_api.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2008-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This file contains the implementation of the SMP interface used by
  21. * applications that can run over an SMP.
  22. *
  23. ******************************************************************************/
  24. #include <string.h>
  25. #include "bt_target.h"
  26. //#include "bt_utils.h"
  27. #if SMP_INCLUDED == TRUE
  28. #include "smp_int.h"
  29. #include "smp_api.h"
  30. #include "l2cdefs.h"
  31. #include "l2c_int.h"
  32. #include "btm_int.h"
  33. #include "hcimsgs.h"
  34. #include "btu.h"
  35. #include "p_256_ecc_pp.h"
  36. #include "allocator.h"
  37. /*******************************************************************************
  38. **
  39. ** Function SMP_Init
  40. **
  41. ** Description This function initializes the SMP unit.
  42. **
  43. ** Returns void
  44. **
  45. *******************************************************************************/
  46. void SMP_Init(void)
  47. {
  48. #if SMP_DYNAMIC_MEMORY
  49. smp_cb_ptr = (tSMP_CB *)osi_malloc(sizeof(tSMP_CB));
  50. #endif
  51. memset(&smp_cb, 0, sizeof(tSMP_CB));
  52. #if defined(SMP_INITIAL_TRACE_LEVEL)
  53. smp_cb.trace_level = SMP_INITIAL_TRACE_LEVEL;
  54. #else
  55. smp_cb.trace_level = BT_TRACE_LEVEL_NONE; /* No traces */
  56. #endif
  57. SMP_TRACE_EVENT ("%s", __FUNCTION__);
  58. smp_l2cap_if_init();
  59. /* initialization of P-256 parameters */
  60. p_256_init_curve(KEY_LENGTH_DWORDS_P256);
  61. }
  62. void SMP_Free(void)
  63. {
  64. memset(&smp_cb, 0, sizeof(tSMP_CB));
  65. #if SMP_DYNAMIC_MEMORY
  66. FREE_AND_RESET(smp_cb_ptr);
  67. #endif /* #if SMP_DYNAMIC_MEMORY */
  68. }
  69. /*******************************************************************************
  70. **
  71. ** Function SMP_SetTraceLevel
  72. **
  73. ** Description This function sets the trace level for SMP. If called with
  74. ** a value of 0xFF, it simply returns the current trace level.
  75. **
  76. ** Input Parameters:
  77. ** level: The level to set the GATT tracing to:
  78. ** 0xff-returns the current setting.
  79. ** 0-turns off tracing.
  80. ** >= 1-Errors.
  81. ** >= 2-Warnings.
  82. ** >= 3-APIs.
  83. ** >= 4-Events.
  84. ** >= 5-Debug.
  85. **
  86. ** Returns The new or current trace level
  87. **
  88. *******************************************************************************/
  89. extern UINT8 SMP_SetTraceLevel (UINT8 new_level)
  90. {
  91. if (new_level != 0xFF) {
  92. smp_cb.trace_level = new_level;
  93. }
  94. return (smp_cb.trace_level);
  95. }
  96. /*******************************************************************************
  97. **
  98. ** Function SMP_Register
  99. **
  100. ** Description This function register for the SMP services callback.
  101. **
  102. ** Returns void
  103. **
  104. *******************************************************************************/
  105. BOOLEAN SMP_Register (tSMP_CALLBACK *p_cback)
  106. {
  107. SMP_TRACE_EVENT ("SMP_Register state=%d", smp_cb.state);
  108. if (smp_cb.p_callback != NULL) {
  109. SMP_TRACE_ERROR ("SMP_Register: duplicate registration, overwrite it");
  110. }
  111. smp_cb.p_callback = p_cback;
  112. return (TRUE);
  113. }
  114. /*******************************************************************************
  115. **
  116. ** Function SMP_Pair
  117. **
  118. ** Description This function call to perform a SMP pairing with peer device.
  119. ** Device support one SMP pairing at one time.
  120. **
  121. ** Parameters bd_addr - peer device bd address.
  122. **
  123. ** Returns None
  124. **
  125. *******************************************************************************/
  126. tSMP_STATUS SMP_Pair (BD_ADDR bd_addr)
  127. {
  128. tSMP_CB *p_cb = &smp_cb;
  129. UINT8 status = SMP_PAIR_INTERNAL_ERR;
  130. SMP_TRACE_EVENT ("%s state=%d br_state=%d flag=0x%x \n",
  131. __FUNCTION__, p_cb->state, p_cb->br_state, p_cb->flags);
  132. if (p_cb->state != SMP_STATE_IDLE || p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD ||
  133. p_cb->smp_over_br) {
  134. /* pending security on going, reject this one */
  135. return SMP_BUSY;
  136. } else {
  137. p_cb->flags = SMP_PAIR_FLAGS_WE_STARTED_DD;
  138. memcpy (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN);
  139. if (!L2CA_ConnectFixedChnl (L2CAP_SMP_CID, bd_addr, BLE_ADDR_UNKNOWN_TYPE)) {
  140. SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.\n", __FUNCTION__);
  141. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
  142. return status;
  143. }
  144. return SMP_STARTED;
  145. }
  146. }
  147. /*******************************************************************************
  148. **
  149. ** Function SMP_BR_PairWith
  150. **
  151. ** Description This function is called to start a SMP pairing over BR/EDR.
  152. ** Device support one SMP pairing at one time.
  153. **
  154. ** Parameters bd_addr - peer device bd address.
  155. **
  156. ** Returns SMP_STARTED if pairing started, otherwise reason for failure.
  157. **
  158. *******************************************************************************/
  159. tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr)
  160. {
  161. tSMP_CB *p_cb = &smp_cb;
  162. UINT8 status = SMP_PAIR_INTERNAL_ERR;
  163. SMP_TRACE_EVENT ("%s state=%d br_state=%d flag=0x%x ",
  164. __func__, p_cb->state, p_cb->br_state, p_cb->flags);
  165. if (p_cb->state != SMP_STATE_IDLE ||
  166. p_cb->smp_over_br ||
  167. p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD) {
  168. /* pending security on going, reject this one */
  169. return SMP_BUSY;
  170. }
  171. p_cb->role = HCI_ROLE_MASTER;
  172. p_cb->flags = SMP_PAIR_FLAGS_WE_STARTED_DD;
  173. p_cb->smp_over_br = TRUE;
  174. memcpy (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN);
  175. if (!L2CA_ConnectFixedChnl (L2CAP_SMP_BR_CID, bd_addr, BLE_ADDR_UNKNOWN_TYPE)) {
  176. SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __FUNCTION__);
  177. smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
  178. return status;
  179. }
  180. return SMP_STARTED;
  181. }
  182. /*******************************************************************************
  183. **
  184. ** Function SMP_PairCancel
  185. **
  186. ** Description This function call to cancel a SMP pairing with peer device.
  187. **
  188. ** Parameters bd_addr - peer device bd address.
  189. **
  190. ** Returns TRUE - Pairining is cancelled
  191. **
  192. *******************************************************************************/
  193. BOOLEAN SMP_PairCancel (BD_ADDR bd_addr)
  194. {
  195. tSMP_CB *p_cb = &smp_cb;
  196. UINT8 err_code = SMP_PAIR_FAIL_UNKNOWN;
  197. BOOLEAN status = FALSE;
  198. BTM_TRACE_EVENT ("SMP_CancelPair state=%d flag=0x%x ", p_cb->state, p_cb->flags);
  199. if ( (p_cb->state != SMP_STATE_IDLE) &&
  200. (!memcmp (p_cb->pairing_bda, bd_addr, BD_ADDR_LEN)) ) {
  201. p_cb->is_pair_cancel = TRUE;
  202. SMP_TRACE_DEBUG("Cancel Pairing: set fail reason Unknown");
  203. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &err_code);
  204. status = TRUE;
  205. }
  206. return status;
  207. }
  208. /*******************************************************************************
  209. **
  210. ** Function SMP_SecurityGrant
  211. **
  212. ** Description This function is called to grant security process.
  213. **
  214. ** Parameters bd_addr - peer device bd address.
  215. ** res - result of the operation SMP_SUCCESS if success.
  216. ** Otherwise, SMP_REPEATED_ATTEMPTS is too many attempts.
  217. **
  218. ** Returns None
  219. **
  220. *******************************************************************************/
  221. void SMP_SecurityGrant(BD_ADDR bd_addr, UINT8 res)
  222. {
  223. SMP_TRACE_EVENT ("SMP_SecurityGrant ");
  224. if (smp_cb.smp_over_br) {
  225. if (smp_cb.br_state != SMP_BR_STATE_WAIT_APP_RSP ||
  226. smp_cb.cb_evt != SMP_SEC_REQUEST_EVT ||
  227. memcmp (smp_cb.pairing_bda, bd_addr, BD_ADDR_LEN)) {
  228. return;
  229. }
  230. /* clear the SMP_SEC_REQUEST_EVT event after get grant */
  231. /* avoid generating duplicate pair request */
  232. smp_cb.cb_evt = 0;
  233. smp_br_state_machine_event(&smp_cb, SMP_BR_API_SEC_GRANT_EVT, &res);
  234. return;
  235. }
  236. if (smp_cb.state != SMP_STATE_WAIT_APP_RSP ||
  237. smp_cb.cb_evt != SMP_SEC_REQUEST_EVT ||
  238. memcmp (smp_cb.pairing_bda, bd_addr, BD_ADDR_LEN)) {
  239. return;
  240. }
  241. /* clear the SMP_SEC_REQUEST_EVT event after get grant */
  242. /* avoid generate duplicate pair request */
  243. smp_cb.cb_evt = 0;
  244. smp_sm_event(&smp_cb, SMP_API_SEC_GRANT_EVT, &res);
  245. }
  246. /*******************************************************************************
  247. **
  248. ** Function SMP_PasskeyReply
  249. **
  250. ** Description This function is called after Security Manager submitted
  251. ** passkey request to the application.
  252. **
  253. ** Parameters: bd_addr - Address of the device for which passkey was requested
  254. ** res - result of the operation SMP_SUCCESS if success
  255. ** passkey - numeric value in the range of
  256. ** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  257. **
  258. *******************************************************************************/
  259. void SMP_PasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey)
  260. {
  261. tSMP_CB *p_cb = & smp_cb;
  262. UINT8 failure = SMP_PASSKEY_ENTRY_FAIL;
  263. SMP_TRACE_EVENT ("SMP_PasskeyReply: Key: %d Result:%d",
  264. passkey, res);
  265. /* If timeout already expired or has been canceled, ignore the reply */
  266. if (p_cb->cb_evt != SMP_PASSKEY_REQ_EVT) {
  267. SMP_TRACE_WARNING ("SMP_PasskeyReply() - Wrong State: %d", p_cb->state);
  268. return;
  269. }
  270. if (memcmp (bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) != 0) {
  271. SMP_TRACE_ERROR ("SMP_PasskeyReply() - Wrong BD Addr");
  272. return;
  273. }
  274. if (btm_find_dev (bd_addr) == NULL) {
  275. SMP_TRACE_ERROR ("SMP_PasskeyReply() - no dev CB");
  276. return;
  277. }
  278. if (passkey > BTM_MAX_PASSKEY_VAL || res != SMP_SUCCESS) {
  279. SMP_TRACE_WARNING ("SMP_PasskeyReply() - Wrong key len: %d or passkey entry fail", passkey);
  280. /* send pairing failure */
  281. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
  282. } else if (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_PASSKEY_ENT) {
  283. smp_sm_event(&smp_cb, SMP_SC_KEY_READY_EVT, &passkey);
  284. } else {
  285. smp_convert_string_to_tk(p_cb->tk, passkey);
  286. }
  287. return;
  288. }
  289. /*******************************************************************************
  290. **
  291. ** Function SMP_ConfirmReply
  292. **
  293. ** Description This function is called after Security Manager submitted
  294. ** numeric comparison request to the application.
  295. **
  296. ** Parameters: bd_addr - Address of the device with which numeric
  297. ** comparison was requested
  298. ** res - comparison result SMP_SUCCESS if success
  299. **
  300. *******************************************************************************/
  301. void SMP_ConfirmReply (BD_ADDR bd_addr, UINT8 res)
  302. {
  303. tSMP_CB *p_cb = & smp_cb;
  304. UINT8 failure = SMP_NUMERIC_COMPAR_FAIL;
  305. SMP_TRACE_EVENT ("%s: Result:%d", __FUNCTION__, res);
  306. /* If timeout already expired or has been canceled, ignore the reply */
  307. if (p_cb->cb_evt != SMP_NC_REQ_EVT) {
  308. SMP_TRACE_WARNING ("%s() - Wrong State: %d", __FUNCTION__, p_cb->state);
  309. return;
  310. }
  311. if (memcmp (bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) != 0) {
  312. SMP_TRACE_ERROR ("%s() - Wrong BD Addr", __FUNCTION__);
  313. return;
  314. }
  315. if (btm_find_dev (bd_addr) == NULL) {
  316. SMP_TRACE_ERROR ("%s() - no dev CB", __FUNCTION__);
  317. return;
  318. }
  319. if (res != SMP_SUCCESS) {
  320. SMP_TRACE_WARNING ("%s() - Numeric Comparison fails", __FUNCTION__);
  321. /* send pairing failure */
  322. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
  323. } else {
  324. smp_sm_event(p_cb, SMP_SC_NC_OK_EVT, NULL);
  325. }
  326. }
  327. /*******************************************************************************
  328. **
  329. ** Function SMP_OobDataReply
  330. **
  331. ** Description This function is called to provide the OOB data for
  332. ** SMP in response to SMP_OOB_REQ_EVT
  333. **
  334. ** Parameters: bd_addr - Address of the peer device
  335. ** res - result of the operation SMP_SUCCESS if success
  336. ** p_data - simple pairing Randomizer C.
  337. **
  338. *******************************************************************************/
  339. void SMP_OobDataReply(BD_ADDR bd_addr, tSMP_STATUS res, UINT8 len, UINT8 *p_data)
  340. {
  341. tSMP_CB *p_cb = & smp_cb;
  342. UINT8 failure = SMP_OOB_FAIL;
  343. tSMP_KEY key;
  344. SMP_TRACE_EVENT ("%s State: %d res:%d", __FUNCTION__, smp_cb.state, res);
  345. /* If timeout already expired or has been canceled, ignore the reply */
  346. if (p_cb->state != SMP_STATE_WAIT_APP_RSP || p_cb->cb_evt != SMP_OOB_REQ_EVT) {
  347. return;
  348. }
  349. if (res != SMP_SUCCESS || len == 0 || !p_data) {
  350. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
  351. } else {
  352. if (len > BT_OCTET16_LEN) {
  353. len = BT_OCTET16_LEN;
  354. }
  355. memcpy(p_cb->tk, p_data, len);
  356. key.key_type = SMP_KEY_TYPE_TK;
  357. key.p_data = p_cb->tk;
  358. smp_sm_event(&smp_cb, SMP_KEY_READY_EVT, &key);
  359. }
  360. }
  361. /*******************************************************************************
  362. **
  363. ** Function SMP_SecureConnectionOobDataReply
  364. **
  365. ** Description This function is called to provide the SC OOB data for
  366. ** SMP in response to SMP_SC_OOB_REQ_EVT
  367. **
  368. ** Parameters: p_data - pointer to the data
  369. **
  370. *******************************************************************************/
  371. void SMP_SecureConnectionOobDataReply(UINT8 *p_data)
  372. {
  373. tSMP_CB *p_cb = &smp_cb;
  374. UINT8 failure = SMP_OOB_FAIL;
  375. tSMP_SC_OOB_DATA *p_oob = (tSMP_SC_OOB_DATA *) p_data;
  376. if (!p_oob) {
  377. SMP_TRACE_ERROR("%s received no data", __FUNCTION__);
  378. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
  379. return;
  380. }
  381. SMP_TRACE_EVENT ("%s req_oob_type: %d, loc_oob_data.present: %d, "
  382. "peer_oob_data.present: %d",
  383. __FUNCTION__, p_cb->req_oob_type, p_oob->loc_oob_data.present,
  384. p_oob->peer_oob_data.present);
  385. if (p_cb->state != SMP_STATE_WAIT_APP_RSP || p_cb->cb_evt != SMP_SC_OOB_REQ_EVT) {
  386. return;
  387. }
  388. BOOLEAN data_missing = FALSE;
  389. switch (p_cb->req_oob_type) {
  390. case SMP_OOB_PEER:
  391. if (!p_oob->peer_oob_data.present) {
  392. data_missing = TRUE;
  393. }
  394. break;
  395. case SMP_OOB_LOCAL:
  396. if (!p_oob->loc_oob_data.present) {
  397. data_missing = TRUE;
  398. }
  399. break;
  400. case SMP_OOB_BOTH:
  401. if (!p_oob->loc_oob_data.present || !p_oob->peer_oob_data.present) {
  402. data_missing = TRUE;
  403. }
  404. break;
  405. default:
  406. SMP_TRACE_EVENT ("Unexpected OOB data type requested. Fail OOB");
  407. data_missing = TRUE;
  408. break;
  409. }
  410. if (data_missing) {
  411. smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure);
  412. return;
  413. }
  414. p_cb->sc_oob_data = *p_oob;
  415. smp_sm_event(&smp_cb, SMP_SC_OOB_DATA_EVT, p_data);
  416. }
  417. /*******************************************************************************
  418. **
  419. ** Function SMP_Encrypt
  420. **
  421. ** Description This function is called to encrypt the data with the specified
  422. ** key
  423. **
  424. ** Parameters: key - Pointer to key key[0] conatins the MSB
  425. ** key_len - key length
  426. ** plain_text - Pointer to data to be encrypted
  427. ** plain_text[0] conatins the MSB
  428. ** pt_len - plain text length
  429. ** p_out - output of the encrypted texts
  430. **
  431. ** Returns Boolean - request is successful
  432. *******************************************************************************/
  433. BOOLEAN SMP_Encrypt (UINT8 *key, UINT8 key_len,
  434. UINT8 *plain_text, UINT8 pt_len,
  435. tSMP_ENC *p_out)
  436. {
  437. BOOLEAN status = FALSE;
  438. status = smp_encrypt_data(key, key_len, plain_text, pt_len, p_out);
  439. return status;
  440. }
  441. /*******************************************************************************
  442. **
  443. ** Function SMP_KeypressNotification
  444. **
  445. ** Description This function is called to notify Security Manager about Keypress Notification.
  446. **
  447. ** Parameters: bd_addr Address of the device to send keypress notification to
  448. ** value Keypress notification parameter value
  449. **
  450. *******************************************************************************/
  451. void SMP_KeypressNotification (BD_ADDR bd_addr, UINT8 value)
  452. {
  453. tSMP_CB *p_cb = &smp_cb;
  454. SMP_TRACE_EVENT ("%s: Value: %d", __FUNCTION__, value);
  455. if (memcmp (bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) != 0) {
  456. SMP_TRACE_ERROR ("%s() - Wrong BD Addr", __FUNCTION__);
  457. return;
  458. }
  459. if (btm_find_dev (bd_addr) == NULL) {
  460. SMP_TRACE_ERROR ("%s() - no dev CB", __FUNCTION__);
  461. return;
  462. }
  463. /* Keypress Notification is used by a device with KeyboardOnly IO capabilities */
  464. /* during the passkey entry protocol */
  465. if (p_cb->local_io_capability != SMP_IO_CAP_IN) {
  466. SMP_TRACE_ERROR ("%s() - wrong local IO capabilities %d",
  467. __FUNCTION__, p_cb->local_io_capability);
  468. return;
  469. }
  470. if (p_cb->selected_association_model != SMP_MODEL_SEC_CONN_PASSKEY_ENT) {
  471. SMP_TRACE_ERROR ("%s() - wrong protocol %d", __FUNCTION__,
  472. p_cb->selected_association_model);
  473. return;
  474. }
  475. smp_sm_event(p_cb, SMP_KEYPRESS_NOTIFICATION_EVENT, &value);
  476. }
  477. /*******************************************************************************
  478. **
  479. ** Function SMP_CreateLocalSecureConnectionsOobData
  480. **
  481. ** Description This function is called to start creation of local SC OOB
  482. ** data set (tSMP_LOC_OOB_DATA).
  483. **
  484. ** Parameters: bd_addr - Address of the device to send OOB data block to
  485. **
  486. ** Returns Boolean - TRUE: creation of local SC OOB data set started.
  487. *******************************************************************************/
  488. BOOLEAN SMP_CreateLocalSecureConnectionsOobData (tBLE_BD_ADDR *addr_to_send_to)
  489. {
  490. tSMP_CB *p_cb = &smp_cb;
  491. UINT8 *bd_addr;
  492. if (addr_to_send_to == NULL) {
  493. SMP_TRACE_ERROR ("%s addr_to_send_to is not provided", __FUNCTION__);
  494. return FALSE;
  495. }
  496. bd_addr = addr_to_send_to->bda;
  497. SMP_TRACE_EVENT ("%s addr type: %u, BDA: %08x%04x, state: %u, br_state: %u",
  498. __FUNCTION__, addr_to_send_to->type,
  499. (bd_addr[0] << 24) + (bd_addr[1] << 16) + (bd_addr[2] << 8) + bd_addr[3],
  500. (bd_addr[4] << 8) + bd_addr[5],
  501. p_cb->state,
  502. p_cb->br_state);
  503. if ((p_cb->state != SMP_STATE_IDLE) || (p_cb->smp_over_br)) {
  504. SMP_TRACE_WARNING ("%s creation of local OOB data set "\
  505. "starts only in IDLE state", __FUNCTION__);
  506. return FALSE;
  507. }
  508. p_cb->sc_oob_data.loc_oob_data.addr_sent_to = *addr_to_send_to;
  509. smp_sm_event(p_cb, SMP_CR_LOC_SC_OOB_DATA_EVT, NULL);
  510. return TRUE;
  511. }
  512. #endif /* SMP_INCLUDED */