Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions wolfcrypt/src/des3.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
}
#endif

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

while (len > 0)
{
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
Expand Down Expand Up @@ -926,6 +931,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
}
#endif

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

while (len > 0)
{
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
Expand Down Expand Up @@ -973,6 +983,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
}
#endif

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

while (len > 0)
{
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
Expand Down Expand Up @@ -1023,6 +1038,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
}
#endif

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

while (len > 0)
{
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
Expand Down Expand Up @@ -1073,6 +1093,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
}
#endif

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

while (len > 0)
{
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
Expand Down Expand Up @@ -1110,6 +1135,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
}
#endif

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

while (len > 0)
{
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
Expand Down Expand Up @@ -1149,6 +1179,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
return MISSING_KEY;
}

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

#ifdef FREESCALE_MMCAU_CLASSIC
if ((wc_ptr_t)out % WOLFSSL_MMCAU_ALIGNMENT) {
WOLFSSL_MSG("Bad 3ede cau_des_encrypt alignment");
Expand Down Expand Up @@ -1199,6 +1234,11 @@ static WC_INLINE void wc_Stm32_CrypDesBlock(const byte* in, byte* out)
return MISSING_KEY;
}

if (sz & (DES_BLOCK_SIZE - 1)) {
WOLFSSL_MSG("Buffer length was not a multiple of DES block size");
return BAD_LENGTH_E;
}

#ifdef FREESCALE_MMCAU_CLASSIC
if ((wc_ptr_t)out % WOLFSSL_MMCAU_ALIGNMENT) {
WOLFSSL_MSG("Bad 3ede cau_des_decrypt alignment");
Expand Down
Loading