summaryrefslogtreecommitdiff
path: root/ipif/blowfish.h
diff options
context:
space:
mode:
authorian <ian>1997-12-18 00:51:00 +0000
committerian <ian>1997-12-18 00:51:00 +0000
commit2dc682257fa1bb6a443c69c56ed724ec3b8dffd9 (patch)
tree34674128242ad411d0eae9b0ef4e93ccb0b5d3fb /ipif/blowfish.h
downloaduserv-utils-2dc682257fa1bb6a443c69c56ed724ec3b8dffd9.tar.gz
Initial checkin to CVS.
Diffstat (limited to 'ipif/blowfish.h')
-rw-r--r--ipif/blowfish.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/ipif/blowfish.h b/ipif/blowfish.h
new file mode 100644
index 0000000..8eb3275
--- /dev/null
+++ b/ipif/blowfish.h
@@ -0,0 +1,42 @@
+/**/
+
+#ifndef BLOWFISH__H_INCLUDED
+#define BLOWFISH__H_INCLUDED
+
+#define BLOWFISH_BLOCKBYTES 8
+#define BLOWFISH_MAXKEYBYTES 56
+#define BLOWFISH__N 16
+#define BLOWFISH__PSIZE BLOWFISH__N+2
+
+typedef uint32 blowfish__p[BLOWFISH__PSIZE];
+typedef uint32 blowfish__s[4][256];
+
+struct blowfish_expandedkey {
+ blowfish__p p;
+ blowfish__s s;
+};
+
+void blowfish_loadkey(struct blowfish_expandedkey *ek,
+ const uint8 *key, int keybytes);
+void blowfish_encrypt(const struct blowfish_expandedkey *ek,
+ const uint8 plain[BLOWFISH_BLOCKBYTES],
+ uint8 cipher[BLOWFISH_BLOCKBYTES]);
+void blowfish_decrypt(const struct blowfish_expandedkey *ek,
+ const uint8 cipher[BLOWFISH_BLOCKBYTES],
+ uint8 plain[BLOWFISH_BLOCKBYTES]);
+
+struct blowfish_cbc_state {
+ struct blowfish_expandedkey ek;
+ uint32 chainl, chainr;
+};
+
+void blowfish_cbc_setiv(struct blowfish_cbc_state *cs,
+ const uint8 iv[BLOWFISH_BLOCKBYTES]);
+void blowfish_cbc_encrypt(struct blowfish_cbc_state *cs,
+ const uint8 plain[BLOWFISH_BLOCKBYTES],
+ uint8 cipher[BLOWFISH_BLOCKBYTES]);
+void blowfish_cbc_decrypt(struct blowfish_cbc_state *cs,
+ const uint8 cipher[BLOWFISH_BLOCKBYTES],
+ uint8 plain[BLOWFISH_BLOCKBYTES]);
+
+#endif