diff --git a/.cvsignore b/.cvsignore
index ac18acf86733f360e3592b9f0ea151b15774b13b..a7773e72e4ce8b95e816d13a6794b1872db8898d 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -17,6 +17,8 @@ desSmallCore.c
 desSmallFips.c
 desTest
 desdata
+generate_q
 keymap.h
 parity.h
 rotors.h
+twofish_test
diff --git a/.gitignore b/.gitignore
index a103d4bf8194dabdeac6084e2198f0e2dbbe4c31..5c4a5b09f5a287b02ebdd06784f866a0ebf10883 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,8 @@ core
 /desSmallFips.c
 /desTest
 /desdata
+/generate_q
 /keymap.h
 /parity.h
 /rotors.h
+/twofish_test
diff --git a/twofish_test.c b/twofish_test.c
new file mode 100644
index 0000000000000000000000000000000000000000..1e89fc672b24f109f9c775b85a6da1fe2a8b497f
--- /dev/null
+++ b/twofish_test.c
@@ -0,0 +1,42 @@
+/* twofish_test.c
+ *
+ * $Id$
+ */
+
+/* lsh, an implementation of the ssh protocol
+ *
+ * Copyright (C) 1998 Niels M�ller
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "twofish.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc UNUSED, char **argv UNUSED)
+{
+  if (twofish_selftest())
+    {
+      fprintf(stderr, "Twofish works.\n");
+      return EXIT_SUCCESS;
+    }
+  else
+    {
+      fprintf(stderr, "ERROR: Twofish failed.\n");
+      return EXIT_FAILURE;
+    }
+}