mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 04:07:49 +02:00
eliminated multiple of 16 check for AES
This commit is contained in:
parent
eb44fdf7a8
commit
a6cc2e647b
3 changed files with 7 additions and 14 deletions
15
aes.cpp
15
aes.cpp
|
@ -197,12 +197,10 @@ namespace crypto
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CBCEncryption::Encrypt (const uint8_t * in, std::size_t len, uint8_t * out)
|
||||
void CBCEncryption::Encrypt (const uint8_t * in, std::size_t len, uint8_t * out)
|
||||
{
|
||||
div_t d = div (len, 16);
|
||||
if (d.rem) return false; // len is not multipple of 16
|
||||
Encrypt (d.quot, (const ChipherBlock *)in, (ChipherBlock *)out);
|
||||
return true;
|
||||
// len/16
|
||||
Encrypt (len >> 4, (const ChipherBlock *)in, (ChipherBlock *)out);
|
||||
}
|
||||
|
||||
void CBCEncryption::Encrypt (const uint8_t * in, uint8_t * out)
|
||||
|
@ -260,12 +258,9 @@ namespace crypto
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CBCDecryption::Decrypt (const uint8_t * in, std::size_t len, uint8_t * out)
|
||||
void CBCDecryption::Decrypt (const uint8_t * in, std::size_t len, uint8_t * out)
|
||||
{
|
||||
div_t d = div (len, 16);
|
||||
if (d.rem) return false; // len is not multiple of 16
|
||||
Decrypt (d.quot, (const ChipherBlock *)in, (ChipherBlock *)out);
|
||||
return true;
|
||||
Decrypt (len >> 4, (const ChipherBlock *)in, (ChipherBlock *)out);
|
||||
}
|
||||
|
||||
void CBCDecryption::Decrypt (const uint8_t * in, uint8_t * out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue