+/* Encrypts */
+
+bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
+ 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);
+}
+
+/* Decrypts */
+
+bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
+ 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);
+}
+
+/* Sets the key for the cipher */
+
+bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
+ SilcUInt32 keylen)
+{
+ return cipher->cipher->set_key(cipher->context, key, keylen);
+}
+