Skip to content

Commit ddd3588

Browse files
committed
Reduced code size of PayloadEncrypt
1 parent bdde3a1 commit ddd3588

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mac/LoRaMacCrypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static KeyAddr_t KeyAddrList[NUM_OF_SEC_CTX] =
243243
* \param[IN/OUT] buffer - Data buffer
244244
* \retval - Status of the operation
245245
*/
246-
static LoRaMacCryptoStatus_t PayloadEncrypt( uint8_t* buffer, int16_t size, KeyIdentifier_t keyID, uint32_t address, uint8_t dir, uint32_t frameCounter )
246+
static LoRaMacCryptoStatus_t PayloadEncrypt( uint8_t* buffer, int32_t size, KeyIdentifier_t keyID, uint32_t address, uint8_t dir, uint32_t frameCounter )
247247
{
248248
if( buffer == 0 )
249249
{
@@ -278,7 +278,7 @@ static LoRaMacCryptoStatus_t PayloadEncrypt( uint8_t* buffer, int16_t size, KeyI
278278
return LORAMAC_CRYPTO_ERROR_SECURE_ELEMENT_FUNC;
279279
}
280280

281-
for( uint8_t i = 0; i < ( ( size > 16 ) ? 16 : size ); i++ )
281+
for( uint8_t i = 0; i < (size>=16?16:size); i++ )
282282
{
283283
buffer[bufferIndex + i] = buffer[bufferIndex + i] ^ sBlock[i];
284284
}

0 commit comments

Comments
 (0)