{ "rc6-128-cbc", 16, 128, silc_rc6_set_key, silc_rc6_set_key_with_string,
silc_rc6_encrypt_cbc, silc_rc6_decrypt_cbc,
silc_rc6_context_len },
- { "mars-256-cbc", 16, 256, silc_mars_set_key, silc_mars_set_key_with_string,
- silc_mars_encrypt_cbc, silc_mars_decrypt_cbc,
- silc_mars_context_len },
- { "mars-192-cbc", 16, 192, silc_mars_set_key, silc_mars_set_key_with_string,
- silc_mars_encrypt_cbc, silc_mars_decrypt_cbc,
- silc_mars_context_len },
- { "mars-128-cbc", 16, 128, silc_mars_set_key, silc_mars_set_key_with_string,
- silc_mars_encrypt_cbc, silc_mars_decrypt_cbc,
- silc_mars_context_len },
{ "cast-256-cbc", 16, 256, silc_cast_set_key, silc_cast_set_key_with_string,
silc_cast_encrypt_cbc, silc_cast_decrypt_cbc,
silc_cast_context_len },
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
- return cipher->cipher->encrypt(cipher->context, src, dst, len, 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);
}
/* Decrypts */
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
- return cipher->cipher->decrypt(cipher->context, src, dst, len, 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);
}
/* Sets the key for the cipher */