Major restructuring of the internals of SILC Cipher API
[crypto.git] / lib / silccrypt / rc5.c
index ea377c5814e10ce2a507f85ec33943d7f3326714..3e93da32c49c1b95aa5f5d27372043853f377d82 100644 (file)
@@ -38,7 +38,7 @@
  *
  */
 
-#include "silc.h"
+#include "silccrypto.h"
 #include "rc5_internal.h"
 #include "rc5.h"
 
@@ -58,11 +58,27 @@ SILC_CIPHER_API_SET_KEY(rc5_cbc)
   return TRUE;
 }
 
-/* Returns the size of the cipher context. */
+/* Sets IV for the cipher. */
 
-SILC_CIPHER_API_CONTEXT_LEN(rc5_cbc)
+SILC_CIPHER_API_SET_IV(rc5_cbc)
 {
-  return sizeof(RC5Context);
+
+}
+
+/* Initialize */
+
+SILC_CIPHER_API_INIT(rc5_cbc)
+{
+  return silc_calloc(1, sizeof(RC5Context));
+}
+
+/* Initialize */
+
+SILC_CIPHER_API_UNINIT(rc5_cbc)
+{
+  RC5Context *rc5 = context;
+  memset(rc5, 0, sizeof(*rc5));
+  silc_free(rc5);
 }
 
 /* Encrypts with the cipher in CBC mode. Source and destination buffers