Browse Source

check # of block to encrypt/decrypt for zero

pull/173/head
orignal 10 years ago
parent
commit
00ac1f7ec9
  1. 8
      aes.cpp

8
aes.cpp

@ -192,7 +192,9 @@ namespace crypto @@ -192,7 +192,9 @@ namespace crypto
void CBCEncryption::Encrypt (const uint8_t * in, std::size_t len, uint8_t * out)
{
// len/16
Encrypt (len >> 4, (const ChipherBlock *)in, (ChipherBlock *)out);
int numBlocks = len >> 4;
if (numBlocks > 0)
Encrypt (numBlocks, (const ChipherBlock *)in, (ChipherBlock *)out);
}
void CBCEncryption::Encrypt (const uint8_t * in, uint8_t * out)
@ -252,7 +254,9 @@ namespace crypto @@ -252,7 +254,9 @@ namespace crypto
void CBCDecryption::Decrypt (const uint8_t * in, std::size_t len, uint8_t * out)
{
Decrypt (len >> 4, (const ChipherBlock *)in, (ChipherBlock *)out);
int numBlocks = len >> 4;
if (numBlocks > 0)
Decrypt (numBlocks, (const ChipherBlock *)in, (ChipherBlock *)out);
}
void CBCDecryption::Decrypt (const uint8_t * in, uint8_t * out)

Loading…
Cancel
Save