aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/twofish/twofish.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/twofish/twofish.h')
-rw-r--r--src/libstrongswan/plugins/twofish/twofish.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/twofish/twofish.h b/src/libstrongswan/plugins/twofish/twofish.h
new file mode 100644
index 000000000..f9013f90f
--- /dev/null
+++ b/src/libstrongswan/plugins/twofish/twofish.h
@@ -0,0 +1,23 @@
+#ifndef TWOFISH_H
+#define TWOFISH_H
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <sys/types.h>
+#endif
+
+/* Structure for an expanded Twofish key. s contains the key-dependent
+ * S-boxes composed with the MDS matrix; w contains the eight "whitening"
+ * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note
+ * that k[i] corresponds to what the Twofish paper calls K[i+8]. */
+typedef struct twofish_context {
+ u_int32_t s[4][256], w[8], k[32];
+} TWOFISH_context;
+
+typedef struct twofish_context twofish_context;
+
+int twofish_set_key(twofish_context *tf_ctx, const u_int8_t * in_key, int key_len);
+int twofish_encrypt(twofish_context *tf_ctx, const u_int8_t * in, u_int8_t * out);
+int twofish_decrypt(twofish_context * tf_ctx, const u_int8_t * in, u_int8_t * out);
+
+#endif /* TWOFISH_H */