projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged from silc_1_0_branch.
[silc.git]
/
lib
/
silccrypt
/
silccipher.c
diff --git
a/lib/silccrypt/silccipher.c
b/lib/silccrypt/silccipher.c
index 72d984b35cebbcf324ae9fac7ba17814134668ec..53c938b69a17e475d44ba9f7392bf993911a99ea 100644
(file)
--- a/
lib/silccrypt/silccipher.c
+++ b/
lib/silccrypt/silccipher.c
@@
-315,6
+315,11
@@
bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
+#ifdef SILC_DEBUG
+ assert((len & (cipher->cipher->block_len - 1)) == 0);
+#endif
+ if (len & (cipher->cipher->block_len - 1))
+ return FALSE;
return cipher->cipher->encrypt(cipher->context, src, dst, len,
iv ? iv : cipher->iv);
}
return cipher->cipher->encrypt(cipher->context, src, dst, len,
iv ? iv : cipher->iv);
}
@@
-325,6
+330,11
@@
bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
+#ifdef SILC_DEBUG
+ assert((len & (cipher->cipher->block_len - 1)) == 0);
+#endif
+ if (len & (cipher->cipher->block_len - 1))
+ return FALSE;
return cipher->cipher->decrypt(cipher->context, src, dst, len,
iv ? iv : cipher->iv);
}
return cipher->cipher->decrypt(cipher->context, src, dst, len,
iv ? iv : cipher->iv);
}