Skip to content

Commit ceb9844

Browse files
committed
Changed improved the way USE_LRWAN_1_1_X_CRYPTO pre-processing directive is used
1 parent 62b0864 commit ceb9844

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/mac/LoRaMacCrypto.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ static LoRaMacCryptoStatus_t PrepareB0( uint16_t msgLen, KeyIdentifier_t keyID,
280280

281281
b0[0] = 0x49;
282282

283+
#if( USE_LRWAN_1_1_X_CRYPTO == 1 )
283284
if( ( isAck == true ) && ( dir == DOWNLINK ) )
284285
{
285286
// confFCnt contains the frame counter value modulo 2^16 of the "confirmed" uplink or downlink frame that is being acknowledged
@@ -291,6 +292,7 @@ static LoRaMacCryptoStatus_t PrepareB0( uint16_t msgLen, KeyIdentifier_t keyID,
291292
b0[2] = ( confFCnt >> 8 ) & 0xFF;
292293
}
293294
else
295+
#endif
294296
{
295297
b0[1] = 0x00;
296298
b0[2] = 0x00;
@@ -915,9 +917,9 @@ LoRaMacCryptoStatus_t LoRaMacCryptoGetFCntDown( FCntIdentifier_t fCntID, uint32_
915917
return LORAMAC_CRYPTO_SUCCESS;
916918
}
917919

918-
#if( USE_LRWAN_1_1_X_CRYPTO == 1 )
919920
LoRaMacCryptoStatus_t LoRaMacCryptoGetRJcount( FCntIdentifier_t fCntID, uint16_t* rJcount )
920921
{
922+
#if( USE_LRWAN_1_1_X_CRYPTO == 1 )
921923
if( rJcount == 0 )
922924
{
923925
return LORAMAC_CRYPTO_ERROR_NPE;
@@ -934,8 +936,10 @@ LoRaMacCryptoStatus_t LoRaMacCryptoGetRJcount( FCntIdentifier_t fCntID, uint16_t
934936
return LORAMAC_CRYPTO_FAIL_FCNT_ID;
935937
}
936938
return LORAMAC_CRYPTO_SUCCESS;
937-
}
939+
#else
940+
return LORAMAC_CRYPTO_ERROR;
938941
#endif
942+
}
939943

940944
LoRaMacCryptoStatus_t LoRaMacCryptoSetMulticastReference( MulticastCtx_t* multicastList )
941945
{
@@ -1024,9 +1028,9 @@ LoRaMacCryptoStatus_t LoRaMacCryptoPrepareJoinRequest( LoRaMacMessageJoinRequest
10241028
return LORAMAC_CRYPTO_SUCCESS;
10251029
}
10261030

1027-
#if( USE_LRWAN_1_1_X_CRYPTO == 1 )
10281031
LoRaMacCryptoStatus_t LoRaMacCryptoPrepareReJoinType1( LoRaMacMessageReJoinType1_t* macMsg )
10291032
{
1033+
#if( USE_LRWAN_1_1_X_CRYPTO == 1 )
10301034
if( macMsg == 0 )
10311035
{
10321036
return LORAMAC_CRYPTO_ERROR_NPE;
@@ -1061,10 +1065,14 @@ LoRaMacCryptoStatus_t LoRaMacCryptoPrepareReJoinType1( LoRaMacMessageReJoinType1
10611065
CryptoNvm->FCntList.RJcount1++;
10621066

10631067
return LORAMAC_CRYPTO_SUCCESS;
1068+
#else
1069+
return LORAMAC_CRYPTO_ERROR;
1070+
#endif
10641071
}
10651072

10661073
LoRaMacCryptoStatus_t LoRaMacCryptoPrepareReJoinType0or2( LoRaMacMessageReJoinType0or2_t* macMsg )
10671074
{
1075+
#if( USE_LRWAN_1_1_X_CRYPTO == 1 )
10681076
if( macMsg == 0 )
10691077
{
10701078
return LORAMAC_CRYPTO_ERROR_NPE;
@@ -1099,8 +1107,10 @@ LoRaMacCryptoStatus_t LoRaMacCryptoPrepareReJoinType0or2( LoRaMacMessageReJoinTy
10991107
RJcount0++;
11001108

11011109
return LORAMAC_CRYPTO_SUCCESS;
1102-
}
1110+
#else
1111+
return LORAMAC_CRYPTO_ERROR;
11031112
#endif
1113+
}
11041114

11051115
LoRaMacCryptoStatus_t LoRaMacCryptoHandleJoinAccept( JoinReqIdentifier_t joinReqType, uint8_t* joinEUI, LoRaMacMessageJoinAccept_t* macMsg )
11061116
{

0 commit comments

Comments
 (0)