Skip to content

Commit 09dc5f9

Browse files
dhineshkumarmcciterrillmoore
authored andcommitted
added function calls to get session keys from lmic secure element
1 parent 256481c commit 09dc5f9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lmic/lmic.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,7 @@ static bit_t processJoinAccept (void) {
15501550
}
15511551

15521552
LMIC_SecureElement_Error_t seErr;
1553+
LMIC_SecureElement_Aes128Key_t AppSKey, NwkSKey;
15531554

15541555
seErr = LMIC_SecureElement_Default_decodeJoinAccept(
15551556
LMIC.frame, dlen,
@@ -1559,6 +1560,12 @@ static bit_t processJoinAccept (void) {
15591560

15601561
if (seErr != LMIC_SecureElement_Error_OK)
15611562
return processJoinAccept_badframe();
1563+
1564+
LMIC_SecureElement_getAppSKey(&AppSKey, 0);
1565+
LMIC_SecureElement_getNwkSKey(&NwkSKey, 0);
1566+
1567+
memcpy(LMIC.artKey, AppSKey.bytes, sizeof(LMIC.artKey));
1568+
memcpy(LMIC.nwkKey, NwkSKey.bytes, sizeof(LMIC.nwkKey));
15621569

15631570
u4_t addr = os_rlsbf4(LMIC.frame+OFF_JA_DEVADDR);
15641571
LMIC.devaddr = addr;

0 commit comments

Comments
 (0)