Skip to content

Commit 95bc031

Browse files
dhineshkumarmcciterrillmoore
authored andcommitted
validate the keyselector in imeplementation of get session key APIs
1 parent 62a22c6 commit 95bc031

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/se/drivers/default/lmic_se_default.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ In this function the nwkskey is passed to upper layer of LMIC.
154154

155155
LMIC_SecureElement_Error_t
156156
LMIC_SecureElement_Default_getNwkSKey(LMIC_SecureElement_Aes128Key_t *pNwkSKey, LMIC_SecureElement_KeySelector_t iKey) {
157+
if (iKey != LMIC_SecureElement_KeySelector_Unicast)
158+
return LMIC_SecureElement_Error_InvalidParameter;
157159
os_copyMem(pNwkSKey->bytes, s_nwkSKey.bytes, sizeof(pNwkSKey->bytes));
158160
}
159161

@@ -169,6 +171,8 @@ In this function the appskey is passed to upper layer of LMIC.
169171

170172
LMIC_SecureElement_Error_t
171173
LMIC_SecureElement_Default_getAppSKey(LMIC_SecureElement_Aes128Key_t *pAppSKey, LMIC_SecureElement_KeySelector_t iKey) {
174+
if (iKey != LMIC_SecureElement_KeySelector_Unicast)
175+
return LMIC_SecureElement_Error_InvalidParameter;
172176
os_copyMem(pAppSKey->bytes, s_appSKey.bytes, sizeof(pAppSKey->bytes));
173177
}
174178

0 commit comments

Comments
 (0)