Split cipher_set_iv() out of cipher_reset()
diff --git a/library/pkcs5.c b/library/pkcs5.c
index 2b6a75a..6582fd0 100644
--- a/library/pkcs5.c
+++ b/library/pkcs5.c
@@ -187,7 +187,10 @@
     if( ( ret = cipher_setkey( &cipher_ctx, key, keylen, mode ) ) != 0 )
         goto exit;
 
-    if( ( ret = cipher_reset( &cipher_ctx, iv, 0, NULL, 0 ) ) != 0 )
+    if( ( ret = cipher_set_iv( &cipher_ctx, iv, 0 ) ) != 0 )
+        goto exit;
+
+    if( ( ret = cipher_reset( &cipher_ctx, NULL, 0 ) ) != 0 )
         goto exit;
 
     if( ( ret = cipher_update( &cipher_ctx, data, datalen,