Major restructuring of the internals of SILC Cipher API
[crypto.git] / lib / silccrypt / cast.c
index e1e1a816ad47fc06f060f79116c0c1a9d71b21ff..ac8aa770b50d60daff1474a079c66ee258335102 100644 (file)
@@ -58,7 +58,7 @@ Mean:          674 cycles =    38.0 mbits/sec
 
 */
 
-#include "silc.h"
+#include "silccrypto.h"
 #include "cast_internal.h"
 #include "cast.h"
 
@@ -80,11 +80,27 @@ SILC_CIPHER_API_SET_KEY(cast_cbc)
   return TRUE;
 }
 
-/* Returns the size of the cipher context. */
+/* Sets IV for the cipher. */
 
-SILC_CIPHER_API_CONTEXT_LEN(cast_cbc)
+SILC_CIPHER_API_SET_IV(cast_cbc)
 {
-  return sizeof(CastContext);
+
+}
+
+/* Initialize */
+
+SILC_CIPHER_API_INIT(cast_cbc)
+{
+  return silc_calloc(1, sizeof(CastContext));
+}
+
+/* Uninitialize */
+
+SILC_CIPHER_API_UNINIT(cast_cbc)
+{
+  CastContext *cast = context;
+  memset(cast, 0, sizeof(*cast));
+  silc_free(cast);
 }
 
 /* Encrypts with the cipher in CBC mode. Source and destination buffers