Skip to content

Commit 72f68eb

Browse files
committed
Issue #936 - Removed unused version parameter from SecureElementDeriveAndStoreKey API
Merge-request #937
1 parent b6e5b0e commit 72f68eb

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

src/mac/LoRaMacCrypto.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ static LoRaMacCryptoStatus_t DeriveSessionKey10x( KeyIdentifier_t keyID, uint8_t
657657
memcpy1( compBase + 4, netID, 3 );
658658
memcpy1( compBase + 7, devNonce, 2 );
659659

660-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBase, NWK_KEY, keyID ) != SECURE_ELEMENT_SUCCESS )
660+
if( SecureElementDeriveAndStoreKey( compBase, NWK_KEY, keyID ) != SECURE_ELEMENT_SUCCESS )
661661
{
662662
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
663663
}
@@ -708,7 +708,7 @@ static LoRaMacCryptoStatus_t DeriveSessionKey11x( KeyIdentifier_t keyID, uint8_t
708708
memcpyr( compBase + 4, joinEUI, 8 );
709709
memcpy1( compBase + 12, devNonce, 2 );
710710

711-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBase, rootKeyId, keyID ) != SECURE_ELEMENT_SUCCESS )
711+
if( SecureElementDeriveAndStoreKey( compBase, rootKeyId, keyID ) != SECURE_ELEMENT_SUCCESS )
712712
{
713713
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
714714
}
@@ -746,7 +746,7 @@ static LoRaMacCryptoStatus_t DeriveLifeTimeSessionKey( KeyIdentifier_t keyID, ui
746746

747747
memcpyr( compBase + 1, devEUI, 8 );
748748

749-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBase, NWK_KEY, keyID ) != SECURE_ELEMENT_SUCCESS )
749+
if( SecureElementDeriveAndStoreKey( compBase, NWK_KEY, keyID ) != SECURE_ELEMENT_SUCCESS )
750750
{
751751
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
752752
}
@@ -1589,7 +1589,7 @@ LoRaMacCryptoStatus_t LoRaMacCryptoDeriveMcRootKey( KeyIdentifier_t keyID )
15891589
{
15901590
compBase[0] = 0x20;
15911591
}
1592-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBase, keyID, MC_ROOT_KEY ) != SECURE_ELEMENT_SUCCESS )
1592+
if( SecureElementDeriveAndStoreKey( compBase, keyID, MC_ROOT_KEY ) != SECURE_ELEMENT_SUCCESS )
15931593
{
15941594
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
15951595
}
@@ -1606,7 +1606,7 @@ LoRaMacCryptoStatus_t LoRaMacCryptoDeriveMcKEKey( KeyIdentifier_t keyID )
16061606
}
16071607
uint8_t compBase[16] = { 0 };
16081608

1609-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBase, keyID, MC_KE_KEY ) != SECURE_ELEMENT_SUCCESS )
1609+
if( SecureElementDeriveAndStoreKey( compBase, keyID, MC_KE_KEY ) != SECURE_ELEMENT_SUCCESS )
16101610
{
16111611
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
16121612
}
@@ -1649,12 +1649,12 @@ LoRaMacCryptoStatus_t LoRaMacCryptoDeriveMcSessionKeyPair( AddressIdentifier_t a
16491649
compBaseNwkS[3] = ( mcAddr >> 16 ) & 0xFF;
16501650
compBaseNwkS[4] = ( mcAddr >> 24 ) & 0xFF;
16511651

1652-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBaseAppS, curItem->RootKey, curItem->AppSkey ) != SECURE_ELEMENT_SUCCESS )
1652+
if( SecureElementDeriveAndStoreKey( compBaseAppS, curItem->RootKey, curItem->AppSkey ) != SECURE_ELEMENT_SUCCESS )
16531653
{
16541654
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
16551655
}
16561656

1657-
if( SecureElementDeriveAndStoreKey( CryptoCtx.NvmCtx->LrWanVersion, compBaseNwkS, curItem->RootKey, curItem->NwkSkey ) != SECURE_ELEMENT_SUCCESS )
1657+
if( SecureElementDeriveAndStoreKey( compBaseNwkS, curItem->RootKey, curItem->NwkSkey ) != SECURE_ELEMENT_SUCCESS )
16581658
{
16591659
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
16601660
}

src/mac/secure-element.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,12 @@ SecureElementStatus_t SecureElementAesEncrypt( uint8_t* buffer, uint16_t size, K
178178
/*!
179179
* Derives and store a key
180180
*
181-
* \param[IN] version - LoRaWAN specification version currently in use.
182181
* \param[IN] input - Input data from which the key is derived ( 16 byte )
183182
* \param[IN] rootKeyID - Key identifier of the root key to use to perform the derivation
184183
* \param[IN] targetKeyID - Key identifier of the key which will be derived
185184
* \retval - Status of the operation
186185
*/
187-
SecureElementStatus_t SecureElementDeriveAndStoreKey( Version_t version, uint8_t* input, KeyIdentifier_t rootKeyID, KeyIdentifier_t targetKeyID );
186+
SecureElementStatus_t SecureElementDeriveAndStoreKey( uint8_t* input, KeyIdentifier_t rootKeyID, KeyIdentifier_t targetKeyID );
188187

189188
/*!
190189
* Process JoinAccept message.

src/peripherals/atecc608a-tnglora-se/atecc608a-tnglora-se.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ SecureElementStatus_t SecureElementAesEncrypt( uint8_t* buffer, uint16_t size, K
430430
return retval;
431431
}
432432

433-
SecureElementStatus_t SecureElementDeriveAndStoreKey( Version_t version, uint8_t* input, KeyIdentifier_t rootKeyID,
433+
SecureElementStatus_t SecureElementDeriveAndStoreKey( uint8_t* input, KeyIdentifier_t rootKeyID,
434434
KeyIdentifier_t targetKeyID )
435435
{
436436
if( input == NULL )

src/peripherals/lr1110-se/lr1110-se.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ SecureElementStatus_t SecureElementAesEncrypt( uint8_t* buffer, uint16_t size, K
260260
return status;
261261
}
262262

263-
SecureElementStatus_t SecureElementDeriveAndStoreKey( Version_t version, uint8_t* input, KeyIdentifier_t rootKeyID,
263+
SecureElementStatus_t SecureElementDeriveAndStoreKey( uint8_t* input, KeyIdentifier_t rootKeyID,
264264
KeyIdentifier_t targetKeyID )
265265
{
266266
SecureElementStatus_t status = SECURE_ELEMENT_ERROR;

src/peripherals/soft-se/soft-se.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ SecureElementStatus_t SecureElementAesEncrypt( uint8_t* buffer, uint16_t size, K
342342
return retval;
343343
}
344344

345-
SecureElementStatus_t SecureElementDeriveAndStoreKey( Version_t version, uint8_t* input, KeyIdentifier_t rootKeyID,
345+
SecureElementStatus_t SecureElementDeriveAndStoreKey( uint8_t* input, KeyIdentifier_t rootKeyID,
346346
KeyIdentifier_t targetKeyID )
347347
{
348348
if( input == NULL )

0 commit comments

Comments
 (0)