If if argument is NULL, use cipher's internal IV automatically.
[crypto.git] / lib / silccrypt / silccipher.c
index b233e3f9485d3668fd1cb87769f01f5a623729a4..72d984b35cebbcf324ae9fac7ba17814134668ec 100644 (file)
@@ -315,7 +315,8 @@ bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
                         unsigned char *dst, SilcUInt32 len, 
                         unsigned char *iv)
 {
-  return cipher->cipher->encrypt(cipher->context, src, dst, len, iv);
+  return cipher->cipher->encrypt(cipher->context, src, dst, len,
+                                iv ? iv : cipher->iv);
 }
 
 /* Decrypts */
@@ -324,7 +325,8 @@ bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
                         unsigned char *dst, SilcUInt32 len, 
                         unsigned char *iv)
 {
-  return cipher->cipher->decrypt(cipher->context, src, dst, len, iv);
+  return cipher->cipher->decrypt(cipher->context, src, dst, len,
+                                iv ? iv : cipher->iv);
 }
 
 /* Sets the key for the cipher */