Skip to content

Commit 628ffea

Browse files
committed
BLE - Cordio PAL SM: Forward local keys
1 parent 18c9399 commit 628ffea

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalSecurityManager.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -503,22 +503,16 @@ bool CordioSecurityManager::sm_handler(const wsfMsgHdr_t* msg) {
503503

504504
switch(evt->type) {
505505
case DM_KEY_LOCAL_LTK:
506-
// FIXME: forward local ltk
507-
#if 0
508-
printf("local ltk: ");
509-
for (size_t i = 0; i < sizeof(ltk_t); ++i) {
510-
printf("%02X ", evt->keyData.ltk.key[i]);
511-
}
512-
printf("\r\n");
513-
514-
printf("local ediv: %04X\r\n", evt->keyData.ltk.ediv);
515-
printf("local rand: ");
516-
for (size_t i = 0; i < sizeof(rand_t); ++i) {
517-
printf("%02X ", evt->keyData.ltk.rand[i]);
518-
}
519-
printf("\r\n");
520-
memcpy(local_ltk, evt->keyData.ltk.key, sizeof(local_ltk));
521-
#endif
506+
handler->on_keys_distributed_local_ltk(
507+
connection,
508+
ltk_t(reinterpret_cast<uint8_t*>(evt->keyData.ltk.key))
509+
);
510+
511+
handler->on_keys_distributed_local_ediv_rand(
512+
connection,
513+
ediv_t(reinterpret_cast<uint8_t*>(&(evt->keyData.ltk.ediv))),
514+
evt->keyData.ltk.rand
515+
);
522516
break;
523517

524518
case DM_KEY_PEER_LTK:

0 commit comments

Comments
 (0)