--- linux.orig/Documentation/Configure.help	2002-11-28 19:42:12 +0300
+++ linux/Documentation/Configure.help	2002-11-28 19:43:23 +0300
@@ -27486,6 +27486,30 @@
 # David Bryson <mutex@mac.com> Thu, Mar 21, 2002
 # Config.help descriptions for CryptoAPI digest functions
 
+WICKER cipher
+CONFIG_CIPHER_WICKER
+  If you answer yes to this option the WICKER cipher will be compiled into
+  your kernel.  
+
+  See also <http://www.lancrypto.com>
+
+  This driver is also available as a module ( = code which can be
+  inserted in and removed from the running kernel whenever you want).
+  The module will be called cipher-wicker.o. If you want to compile it as a
+  module, say M here and read <file:Documentation/modules.txt>.
+
+NUSH cipher
+CONFIG_CIPHER_NUSH
+  If you answer yes to this option the NUSH cipher will be compiled into
+  your kernel.  
+
+  See also <http://www.lancrypto.com>
+
+  This driver is also available as a module ( = code which can be
+  inserted in and removed from the running kernel whenever you want).
+  The module will be called cipher-nush.o. If you want to compile it as a
+  module, say M here and read <file:Documentation/modules.txt>.
+
 MD5 digest
 CONFIG_DIGEST_MD5
   If you answer yes to this option, the MD5(Message Digest 5) digest 
--- linux.orig/crypto/ciphers/Config.in	2002-11-28 19:03:35 +0300
+++ linux/crypto/ciphers/Config.in	2002-11-28 19:03:35 +0300
@@ -8,6 +8,8 @@
 	dep_tristate ' RC6 cipher' CONFIG_CIPHER_RC6 $CONFIG_CIPHERS
 	dep_tristate ' Serpent cipher' CONFIG_CIPHER_SERPENT $CONFIG_CIPHERS
 	dep_tristate ' DFC cipher' CONFIG_CIPHER_DFC $CONFIG_CIPHERS
+	dep_tristate ' WICKER cipher' CONFIG_CIPHER_WICKER $CONFIG_CRYPTO
+	dep_tristate ' NUSH cipher' CONFIG_CIPHER_NUSH $CONFIG_CRYPTO
 	comment '64 bit blocksize'
 	dep_tristate ' CAST5 cipher' CONFIG_CIPHER_CAST5 $CONFIG_CIPHERS
 	dep_tristate ' DES cipher' CONFIG_CIPHER_DES $CONFIG_CIPHERS
--- linux.orig/crypto/ciphers/Makefile	2002-11-28 19:03:35 +0300
+++ linux/crypto/ciphers/Makefile	2002-11-28 19:03:35 +0300
@@ -14,5 +14,7 @@
 obj-$(CONFIG_CIPHER_RC6)      += cipher-rc6.o
 obj-$(CONFIG_CIPHER_SERPENT)  += cipher-serpent.o
 obj-$(CONFIG_CIPHER_TWOFISH)  += cipher-twofish.o
+obj-$(CONFIG_CIPHER_WICKER)   += cipher-wicker.o
+obj-$(CONFIG_CIPHER_NUSH)     += cipher-nush.o
 
 include $(TOPDIR)/Rules.make
--- linux.orig/crypto/ciphers/cipher-wicker.c	2002-11-21 21:44:28 +0300
+++ linux/crypto/ciphers/cipher-wicker.c	2002-11-28 19:32:19 +0300
@@ -0,0 +1,235 @@
+/*
+ * WICKER CIPHER module
+ * (www.lancrypto.com)
+*/
+
+#include <asm/byteorder.h>
+#include <linux/crypto.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/string.h>
+
+#ifdef MODULE_LICENSE
+MODULE_LICENSE("GPL");
+#endif
+
+#define WICKER_BLOCK_SIZE          16
+#define WICKER_KEY_SIZE            16
+
+typedef struct {
+
+   u32 KS[ 44 ];
+
+} WICKER_context;
+
+
+typedef u8 byte;
+
+#ifdef BIG_ENDIAN_HOST
+#define U32TOBYTES( u, b )          b[0]=((byte*)&u)[0];b[1]=((byte*)&u)[1];b[2]=((byte*)&u)[2];b[3]=((byte*)&u)[3];
+#else
+#define U32TOBYTES( u, b )          b[0]=((byte*)&u)[3];b[1]=((byte*)&u)[2];b[2]=((byte*)&u)[1];b[3]=((byte*)&u)[0];
+#endif
+
+#ifdef BIG_ENDIAN_HOST
+#define BYTESTOU32( u, b )          ((byte*)&u)[0]=b[0];((byte*)&u)[1]=b[1];((byte*)&u)[2]=b[2];((byte*)&u)[3]=b[3];
+#else
+#define BYTESTOU32( u, b )          ((byte*)&u)[0]=b[3];((byte*)&u)[1]=b[2];((byte*)&u)[2]=b[1];((byte*)&u)[3]=b[0];
+#endif
+
+
+static void
+_wicker_encrypt( WICKER_context * ctx, const u8 * inbuf, u8 * outbuf )
+{
+   u32 a, b, c, d, r, rr;
+   u32 * ks = ctx->KS;
+
+   BYTESTOU32( a, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( b, inbuf )
+	inbuf += 4;
+   BYTESTOU32( c, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( d, inbuf )
+
+   a+=ks[0]; b+=ks[1]; c+=ks[2]; d+=ks[3]; c+=ks[4]; c+=b;
+   r=c; c>>=1;  r<<=31; rr=d; c^=r; r=ks[5];  rr&=c; d^=r; a+=rr; d+=c;
+   r=d; d>>=2;  r<<=30; rr=a; d^=r; r=ks[6];  rr&=d; a+=r; b+=rr; a^=d;
+   r=a; a>>=4;  r<<=28; rr=b; a^=r; r=ks[7];  rr&=a; b^=r; c+=rr; b^=a;
+   r=b; b>>=8;  r<<=24; rr=c; b^=r; r=ks[8];  rr&=b; c+=r; d+=rr; c+=b;
+   r=c; c>>=16; r<<=16; rr=d; c^=r; r=ks[9];  rr&=c; d^=r; a^=rr; d+=c;
+   r=d; d>>=21; r<<=11; rr=a; d^=r; r=ks[10]; rr|=d; a+=r; b^=rr; a^=d;
+   r=a; a>>=6;  r<<=26; rr=b; a^=r; r=ks[11]; rr|=a; b+=r; c^=rr; b+=a;
+   r=b; b>>=12; r<<=20; rr=c; b^=r; r=ks[12]; rr&=b; c^=r; d+=rr; c+=b;
+   r=c; c>>=24; r<<=8;  rr=d; c^=r; r=ks[13]; rr|=c; d+=r; a+=rr; d^=c;
+   r=d; d>>=16; r<<=16; rr=a; d^=r; r=ks[14]; rr&=d; a^=r; b+=rr; a^=d;
+   r=a; a>>=11; r<<=21; rr=b; a^=r; r=ks[15]; rr&=a; b+=r; c+=rr; b+=a;
+   r=b; b>>=10; r<<=22; rr=c; b^=r; r=ks[16]; rr|=b; c^=r; d^=rr; c+=b;
+   r=c; c>>=20; r<<=12; rr=d; c^=r; r=ks[17]; rr&=c; d+=r; a^=rr; d^=c;
+   r=d; d>>=8;  r<<=24; rr=a; d^=r; r=ks[18]; rr|=d; a+=r; b^=rr; a+=d;
+   r=a; a>>=16; r<<=16; rr=b; a^=r; r=ks[19]; rr&=a; b^=r; c+=rr; b+=a;
+   r=b; b>>=25; r<<=7;  rr=c; b^=r; r=ks[20]; rr|=b; c+=r; d+=rr; c^=b;
+   r=c; c>>=14; r<<=18; rr=d; c^=r; r=ks[21]; rr|=c; d^=r; a+=rr; d^=c;
+   r=d; d>>=28; r<<=4;  rr=a; d^=r; r=ks[22]; rr|=d; a+=r; b+=rr; a+=d;
+   r=a; a>>=24; r<<=8;  rr=b; a^=r; r=ks[23]; rr|=a; b^=r; c^=rr; b+=a;
+   r=b; b>>=16; r<<=16; rr=c; b^=r; r=ks[24]; rr|=b; c+=r; d^=rr; c^=b;
+   r=c; c>>=19; r<<=13; rr=d; c^=r; r=ks[25]; rr|=c; d+=r; a^=rr; d+=c;
+   r=d; d>>=22; r<<=10; rr=a; d^=r; r=ks[26]; rr|=d; a^=r; b+=rr; a+=d;
+   r=a; a>>=12; r<<=20; rr=b; a^=r; r=ks[27]; rr&=a; b+=r; c+=rr; b^=a;
+   r=b; b>>=24; r<<=8;  rr=c; b^=r; r=ks[28]; rr&=b; c^=r; d+=rr; c^=b;
+   r=c; c>>=16; r<<=16; rr=d; c^=r; r=ks[29]; rr|=c; d+=r; a+=rr; d+=c;
+   r=d; d>>=27; r<<=5;  rr=a; d^=r; r=ks[30]; rr&=d; a^=r; b^=rr; a+=d;
+   r=a; a>>=26; r<<=6;  rr=b; a^=r; r=ks[31]; rr|=a; b+=r; c^=rr; b^=a;
+   r=b; b>>=20; r<<=12; rr=c; b^=r; r=ks[32]; rr&=b; c+=r; d^=rr; c+=b;
+   r=c; c>>=8;  r<<=24; rr=d; c^=r; r=ks[33]; rr&=c; d^=r; a+=rr; d+=c;
+   r=d; d>>=16; r<<=16; rr=a; d^=r; r=ks[34]; rr&=d; a+=r; b+=rr; a^=d;
+   r=a; a>>=25; r<<=7;  rr=b; a^=r; r=ks[35]; rr|=a; b^=r; c+=rr; b^=a;
+   r=b; b>>=18; r<<=14; rr=c; b^=r; r=ks[36]; rr|=b; c+=r; d+=rr; c+=b;
+   r=c; c>>=4;  r<<=28; rr=d; c^=r; r=ks[37]; rr&=c; d^=r; a^=rr; d+=c;
+   r=d; d>>=8;  r<<=24; rr=a; d^=r; r=ks[38]; rr&=d; a+=r; b^=rr; a^=d;
+   r=a; a>>=16; r<<=16; rr=b; a^=r; r=ks[39]; rr&=a; b+=r; c^=rr; b+=a;
+   r=b; b>>=1;  r<<=31; rr=c; b^=r; rr&=b; d+=rr;
+   a^=ks[41]; b^=ks[40]; c^=ks[43]; d^=ks[42];
+
+   U32TOBYTES( a, outbuf )
+	outbuf += 4;
+   U32TOBYTES( b, outbuf )
+	outbuf += 4;
+   U32TOBYTES( c, outbuf )
+	outbuf += 4;
+   U32TOBYTES( d, outbuf )
+}
+
+
+static void
+_wicker_decrypt( WICKER_context * ctx, const u8 * inbuf, u8 * outbuf )
+{
+   u32 a, b, c, d, r, rr;
+   u32 * ks = ctx->KS;
+
+   BYTESTOU32( a, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( b, inbuf )
+	inbuf += 4;
+   BYTESTOU32( c, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( d, inbuf )
+
+   a^=ks[41]; b^=ks[40]; c^=ks[43]; d^=ks[42];
+   rr=b; r=b; b>>=31; r<<=1;  rr&=c; b^=r; r=ks[39]; b-=a; d-=rr; b-=r;
+   rr=a; r=a; a>>=16; r<<=16; rr&=b; a^=r; r=ks[38]; a^=d; c^=rr; a-=r;
+   rr=d; r=d; d>>=24; r<<=8;  rr&=a; d^=r; r=ks[37]; d-=c; b^=rr; d^=r;
+   rr=c; r=c; c>>=28; r<<=4;  rr&=d; c^=r; r=ks[36]; c-=b; a^=rr; c-=r;
+   rr=b; r=b; b>>=14; r<<=18; rr|=c; b^=r; r=ks[35]; b^=a; d-=rr; b^=r;
+   rr=a; r=a; a>>=7;  r<<=25; rr|=b; a^=r; r=ks[34]; a^=d; c-=rr; a-=r;
+   rr=d; r=d; d>>=16; r<<=16; rr&=a; d^=r; r=ks[33]; d-=c; b-=rr; d^=r;
+   rr=c; r=c; c>>=24; r<<=8;  rr&=d; c^=r; r=ks[32]; c-=b; a-=rr; c-=r;
+   rr=b; r=b; b>>=12; r<<=20; rr&=c; b^=r; r=ks[31]; b^=a; d^=rr; b-=r;
+   rr=a; r=a; a>>=6;  r<<=26; rr|=b; a^=r; r=ks[30]; a-=d; c^=rr; a^=r;
+   rr=d; r=d; d>>=5;  r<<=27; rr&=a; d^=r; r=ks[29]; d-=c; b^=rr; d-=r;
+   rr=c; r=c; c>>=16; r<<=16; rr|=d; c^=r; r=ks[28]; c^=b; a-=rr; c^=r;
+   rr=b; r=b; b>>=8;  r<<=24; rr&=c; b^=r; r=ks[27]; b^=a; d-=rr; b-=r;
+   rr=a; r=a; a>>=20; r<<=12; rr&=b; a^=r; r=ks[26]; a-=d; c-=rr; a^=r;
+   rr=d; r=d; d>>=10; r<<=22; rr|=a; d^=r; r=ks[25]; d-=c; b-=rr; d-=r;
+   rr=c; r=c; c>>=13; r<<=19; rr|=d; c^=r; r=ks[24]; c^=b; a^=rr; c-=r;
+   rr=b; r=b; b>>=16; r<<=16; rr|=c; b^=r; r=ks[23]; b-=a; d^=rr; b^=r;
+   rr=a; r=a; a>>=8;  r<<=24; rr|=b; a^=r; r=ks[22]; a-=d; c^=rr; a-=r;
+   rr=d; r=d; d>>=4;  r<<=28; rr|=a; d^=r; r=ks[21]; d^=c; b-=rr; d^=r;
+   rr=c; r=c; c>>=18; r<<=14; rr|=d; c^=r; r=ks[20]; c^=b; a-=rr; c-=r;
+   rr=b; r=b; b>>=7;  r<<=25; rr|=c; b^=r; r=ks[19]; b-=a; d-=rr; b^=r;
+   rr=a; r=a; a>>=16; r<<=16; rr&=b; a^=r; r=ks[18]; a-=d; c-=rr; a-=r;
+   rr=d; r=d; d>>=24; r<<=8;  rr|=a; d^=r; r=ks[17]; d^=c; b^=rr; d-=r;
+   rr=c; r=c; c>>=12; r<<=20; rr&=d; c^=r; r=ks[16]; c-=b; a^=rr; c^=r;
+   rr=b; r=b; b>>=22; r<<=10; rr|=c; b^=r; r=ks[15]; b-=a; d^=rr; b-=r;
+   rr=a; r=a; a>>=21; r<<=11; rr&=b; a^=r; r=ks[14]; a^=d; c-=rr; a^=r;
+   rr=d; r=d; d>>=16; r<<=16; rr&=a; d^=r; r=ks[13]; d^=c; b-=rr; d-=r;
+   rr=c; r=c; c>>=8;  r<<=24; rr|=d; c^=r; r=ks[12]; c-=b; a-=rr; c^=r;
+   rr=b; r=b; b>>=20; r<<=12; rr&=c; b^=r; r=ks[11]; b-=a; d-=rr; b-=r;
+   rr=a; r=a; a>>=26; r<<=6;  rr|=b; a^=r; r=ks[10]; a^=d; c^=rr; a-=r;
+   rr=d; r=d; d>>=11; r<<=21; rr|=a; d^=r; r=ks[9];  d-=c; b^=rr; d^=r;
+   rr=c; r=c; c>>=16; r<<=16; rr&=d; c^=r; r=ks[8];  c-=b; a^=rr; c-=r;
+   rr=b; r=b; b>>=24; r<<=8;  rr&=c; b^=r; r=ks[7];  b^=a; d-=rr; b^=r;
+   rr=a; r=a; a>>=28; r<<=4;  rr&=b; a^=r; r=ks[6];  a^=d; c-=rr; a-=r;
+   rr=d; r=d; d>>=30; r<<=2;  rr&=a; d^=r; r=ks[5];  d-=c; b-=rr; d^=r;
+   rr=c; r=c; c>>=31; r<<=1;  rr&=d; c^=r; r=ks[4];  c-=b; a-=rr; c-=r;
+   a-=ks[0]; b-=ks[1]; c-=ks[2]; d-=ks[3];
+
+   U32TOBYTES( a, outbuf )
+	outbuf += 4;
+   U32TOBYTES( b, outbuf )
+	outbuf += 4;
+   U32TOBYTES( c, outbuf )
+	outbuf += 4;
+   U32TOBYTES( d, outbuf )
+}
+
+
+static int
+wicker_encrypt( struct cipher_context * cx, const u8 * inbuf, u8 * outbuf, int size, int atomic )
+{
+   WICKER_context * ctx = ( WICKER_context * )( cx->keyinfo );
+
+   while( size >= WICKER_BLOCK_SIZE ) 
+   {
+      _wicker_encrypt( ctx, inbuf, outbuf );
+
+      inbuf  += WICKER_BLOCK_SIZE;
+      outbuf += WICKER_BLOCK_SIZE;
+      size   -= WICKER_BLOCK_SIZE;
+   }
+
+   return 0;
+}
+
+
+static int
+wicker_decrypt( struct cipher_context * cx, const u8  * inbuf, u8 * outbuf, int size, int atomic )
+{
+   WICKER_context * ctx = ( WICKER_context * )cx->keyinfo;
+
+   while( size >= WICKER_BLOCK_SIZE ) 
+   {
+     _wicker_decrypt( ctx, inbuf, outbuf );
+
+      inbuf  += WICKER_BLOCK_SIZE;
+      outbuf += WICKER_BLOCK_SIZE;
+      size   -= WICKER_BLOCK_SIZE;
+   }
+
+   return 0;
+}
+
+
+static int
+wicker_set_key( struct cipher_context * cx, const unsigned char * key, int key_len, int atomic )
+{
+   u32 * ks = ( ( WICKER_context * )( cx->keyinfo ) )->KS;
+   int i;
+
+   if( key_len != WICKER_KEY_SIZE )
+      return -EINVAL; // unsupported key length
+
+   for( i = 0; i < 4; i++, key += 4 ) 
+   {
+      BYTESTOU32( ks[ i ], key )
+   }
+
+   for( i = 0; i < 40; i++ ) 
+      ks[ i + 4 ] = ks[ i ];
+
+   cx->key_length = key_len;
+
+   return 0;
+}
+
+
+#define CIPHER_ID							wicker
+#define CIPHER_BLOCKSIZE				( WICKER_BLOCK_SIZE * 8 )
+#define CIPHER_KEY_SIZE_MASK			CIPHER_KEYSIZE_128
+#define CIPHER_KEY_SCHEDULE_SIZE		sizeof( WICKER_context )
+
+#include "gen-cipher.h"
+
+EXPORT_NO_SYMBOLS;
+
--- linux.orig/crypto/ciphers/cipher-nush.c	2002-11-21 21:44:28 +0300
+++ linux/crypto/ciphers/cipher-nush.c	2002-11-28 19:32:33 +0300
@@ -0,0 +1,432 @@
+/*
+ * NUSH CIPHER module
+ * (www.lancrypto.com)
+*/
+
+#include <asm/byteorder.h>
+#include <linux/crypto.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/string.h>
+
+#ifdef MODULE_LICENSE
+MODULE_LICENSE("GPL");
+#endif
+
+#define NUSH_BLOCK_SIZE             16
+#define NUSH_KEY_SIZE               32
+#define NUSH_n                      32
+#define NUSH_N                      (NUSH_n*4)
+#define NUSH_l                      17
+#define NUSH_L                      (NUSH_l*4)
+#define NUSH_KEYLEN_BIT             256
+#define NUSH_KEYLEN_LONG            8
+
+typedef u8 byte;
+
+#define ROTR32( p, t )                             (((p)>>(t))|((p)<<(32-(t))))
+#define ROTL32( p, t )                             (((p)<<(t))|((p)>>(32-(t))))
+#define Iter_OR( a1, b1, c1, d1, k, r, s, i )      c1=(c1^(k[i]+r[i]))+ b1;if(s[i])c1=ROTR32(c1,s[i]);a1+=(c1|d1);
+#define Iter_AND( a1, b1, c1, d1, k, r, s, i )     c1=(c1^(k[i]+r[i]))+b1;if(s[i])c1=ROTR32(c1,s[i]);a1+=(c1&d1);
+#define Iter_OR_1( a1, b1, c1, d1, k, r, s, i )    a1-=(c1|d1);if(s[i])c1=ROTL32(c1,s[i]);c1=(c1-b1)^(k[i]+r[i]);
+#define Iter_AND_1( a1, b1, c1, d1, k, r, s, i )   a1-=(c1&d1);if(s[i])c1=ROTL32(c1,s[i]);c1=(c1-b1)^(k[i]+r[i]);
+
+
+static const u32 C_128[ NUSH_L ] =
+{
+	0x9B28A37B, 0x9DE5B521, 0x0B8EE0D7, 0x672AA715,
+	0x0E356C9F, 0xBF54692A, 0xDC9E15C8, 0x06D736E8,
+	0x9263E8CF, 0x1FCD682D, 0x7368B074, 0x2654F15A,
+	0x00EB3E4D, 0x18D62F6D, 0x632A557A, 0x1D953D21,
+	0xCD4B2ACD, 0x49A0D3F4, 0xC443F6CC, 0xE84C5BCB,
+	0xF750A732, 0x2CDE9942, 0x370C437A, 0xDA8B5654,
+	0x99A76750, 0xA1559437, 0x9EA46718, 0x83E984F8,
+	0xAB5692E4, 0xA6C5C46A, 0x25FB110E, 0x55955B2E,
+	0xFA639063, 0x027E4DC6, 0x919E96B2, 0x62E96D0C,
+	0xAA7DE138, 0xA674A66C, 0xB3F54983, 0xAE29D0DB,
+	0x599470CB, 0x3B2E3FA0, 0xA354CC6F, 0x516AF8C4,
+	0xADE11D33, 0x860D95F2, 0xBC2731A4, 0xCCD12BAA,
+	0xBA518E95, 0x22F7583A, 0x6C0A5FE8, 0x8FAC2D74,
+	0xD129E934, 0x11DCE4C9, 0x362F2F4A, 0x6CCB630D,
+	0x97919D88, 0x823F95AC, 0x67C99A98, 0x8E91D0CB,
+	0xAB796817, 0x356459A7, 0x668D9FA8, 0x0D4DBF40,
+	0x1ACCE5D8, 0xF53B24C1, 0x6DB89876, 0x5C965DA5
+};
+
+
+static const u16 S_128[ NUSH_L ] =
+{
+	7,  5,  15, 14,
+	3,  30, 4,  23,
+	13, 12, 26, 16,
+	9,  28, 8,  18,
+	23, 8,  26, 4,
+	29, 16, 2,  22,
+	23, 11, 26, 13,
+	20, 5,  28, 17,
+	19, 22, 6,  25,
+	12, 24, 27, 10,
+	16, 24, 9,  13,
+	5,  10, 26, 30,
+	9,  16, 28, 24,
+	27, 6,  7,  15,
+	1,  13, 15, 1,
+	23, 28, 12, 2,
+	28, 14, 15, 12
+};
+
+
+typedef struct {
+
+   u32 CC[ NUSH_L ];
+   u32 KS[ 4 ];       // start key
+   u32 KF[ 4 ];       // final key
+   u32 KR[ NUSH_L ];  // iteration key
+
+} NUSH_context;
+
+
+#ifdef BIG_ENDIAN_HOST
+#define U32TOBYTES( u, b )          b[0]=((byte*)&u)[0];b[1]=((byte*)&u)[1];b[2]=((byte*)&u)[2];b[3]=((byte*)&u)[3];
+#else
+#define U32TOBYTES( u, b )          b[0]=((byte*)&u)[3];b[1]=((byte*)&u)[2];b[2]=((byte*)&u)[1];b[3]=((byte*)&u)[0];
+#endif
+
+#ifdef BIG_ENDIAN_HOST
+#define BYTESTOU32( u, b )          ((byte*)&u)[0]=b[0];((byte*)&u)[1]=b[1];((byte*)&u)[2]=b[2];((byte*)&u)[3]=b[3];
+#else
+#define BYTESTOU32( u, b )          ((byte*)&u)[0]=b[3];((byte*)&u)[1]=b[2];((byte*)&u)[2]=b[1];((byte*)&u)[3]=b[0];
+#endif
+
+
+static void
+_nush_encrypt( NUSH_context * ctx, const u8 * inbuf, u8 * outbuf )
+{
+   u32 a, b, c, d;
+   u32 * ks = ctx->KS;
+   u32 * kf = ctx->KF;
+   u32 * kr = ctx->KR;
+   u32 * cc = ctx->CC;
+
+   BYTESTOU32( a, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( b, inbuf )
+	inbuf += 4;
+   BYTESTOU32( c, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( d, inbuf )
+
+   // start
+   a ^= ks[ 0 ];
+   b ^= ks[ 1 ];
+   c ^= ks[ 2 ];
+   d ^= ks[ 3 ];
+   // round 1
+   Iter_AND( a, b, c, d, kr, cc, S_128, 0 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 1 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 2 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 3 )
+   // round 2
+   Iter_OR( a, b, c, d, kr, cc, S_128, 4 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 5 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 6 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 7 )
+   // round 3
+   Iter_AND( a, b, c, d, kr, cc, S_128, 8 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 9 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 10 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 11 )
+   // round 4
+   Iter_OR( a, b, c, d, kr, cc, S_128, 12 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 13 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 14 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 15 )
+   // round 5
+   Iter_OR( a, b, c, d, kr, cc, S_128, 16 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 17 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 18 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 19 )
+   // round 6
+   Iter_AND( a, b, c, d, kr, cc, S_128, 20 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 21 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 22 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 23 )
+   // round 7
+   Iter_AND( a, b, c, d, kr, cc, S_128, 24 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 25 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 26 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 27 )
+   // round 8
+   Iter_AND( a, b, c, d, kr, cc, S_128, 28 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 29 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 30 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 31 )
+   // round 9
+   Iter_OR( a, b, c, d, kr, cc, S_128, 32 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 33 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 34 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 35 )
+   // round 10
+   Iter_OR( a, b, c, d, kr, cc, S_128, 36 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 37 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 38 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 39 )
+   // round 11
+   Iter_OR( a, b, c, d, kr, cc, S_128, 40 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 41 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 42 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 43 )
+   // round 12
+   Iter_OR( a, b, c, d, kr, cc, S_128, 44 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 45 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 46 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 47 )
+   // round 13
+   Iter_AND( a, b, c, d, kr, cc, S_128, 48 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 49 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 50 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 51 )
+   // round 14
+   Iter_AND( a, b, c, d, kr, cc, S_128, 52 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 53 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 54 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 55 )
+   // round 15
+   Iter_OR( a, b, c, d, kr, cc, S_128, 56 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 57 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 58 )
+   Iter_AND( d, a, b, c, kr, cc, S_128, 59 )
+   // round 16
+   Iter_AND( a, b, c, d, kr, cc, S_128, 60 )
+   Iter_AND( b, c, d, a, kr, cc, S_128, 61 )
+   Iter_OR( c, d, a, b, kr, cc, S_128, 62 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 63 )
+   // round 17
+   Iter_AND( a, b, c, d, kr, cc, S_128, 64 )
+   Iter_OR( b, c, d, a, kr, cc, S_128, 65 )
+   Iter_AND( c, d, a, b, kr, cc, S_128, 66 )
+   Iter_OR( d, a, b, c, kr, cc, S_128, 67 )
+   // final
+   a ^= kf[ 0 ];
+   b ^= kf[ 1 ];
+   c ^= kf[ 2 ];
+   d ^= kf[ 3 ];
+
+   U32TOBYTES( a, outbuf )
+	outbuf += 4;
+   U32TOBYTES( b, outbuf )
+	outbuf += 4;
+   U32TOBYTES( c, outbuf )
+	outbuf += 4;
+   U32TOBYTES( d, outbuf )
+}
+
+
+static void
+_nush_decrypt( NUSH_context * ctx, const u8 * inbuf, u8 * outbuf )
+{
+   u32 a, b, c, d;
+   u32 * ks = ctx->KS;
+   u32 * kf = ctx->KF;
+   u32 * kr = ctx->KR;
+   u32 * cc = ctx->CC;
+
+   BYTESTOU32( a, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( b, inbuf )
+	inbuf += 4;
+   BYTESTOU32( c, inbuf ) 
+	inbuf += 4;
+   BYTESTOU32( d, inbuf )
+
+   // final-1
+   a ^= kf[ 0 ];
+   b ^= kf[ 1 ];
+   c ^= kf [2 ];
+   d ^= kf[ 3 ];
+   // round 17
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 67 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 66 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 65 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 64 )
+   // round 16
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 63 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 62 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 61 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 60 )
+   // round 15
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 59 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 58 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 57 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 56 )
+   // round 14
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 55 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 54 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 53 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 52 )
+   // round 13
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 51 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 50 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 49 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 48 )
+   // round 12
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 47 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 46 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 45 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 44 )
+   // round 11
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 43 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 42 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 41 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 40 )
+   // round 10
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 39 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 38 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 37 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 36 )
+   // round 9
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 35 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 34 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 33 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 32 )
+   // round 8
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 31 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 30 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 29 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 28 )
+   // round 7
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 27 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 26 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 25 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 24 )
+   // round 6
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 23 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 22 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 21 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 20 )
+   // round 5
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 19 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 18 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 17 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 16 )
+   // round 4
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 15 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 14 )
+   Iter_AND_1( b, c, d, a, kr, cc, S_128, 13 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 12 )
+   // round 3
+   Iter_AND_1( d, a, b, c, kr, cc, S_128, 11 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 10 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 9 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 8 )
+   // round 2
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 7 )
+   Iter_OR_1( c, d, a, b, kr, cc, S_128, 6 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 5 )
+   Iter_OR_1( a, b, c, d, kr, cc, S_128, 4 )
+   // round 1
+   Iter_OR_1( d, a, b, c, kr, cc, S_128, 3 )
+   Iter_AND_1( c, d, a, b, kr, cc, S_128, 2 )
+   Iter_OR_1( b, c, d, a, kr, cc, S_128, 1 )
+   Iter_AND_1( a, b, c, d, kr, cc, S_128, 0 )
+   // start-1
+   a ^= ks[ 0 ];
+   b ^= ks[ 1 ];
+   c ^= ks[ 2 ];
+   d ^= ks[ 3 ];
+
+   U32TOBYTES( a, outbuf )
+	outbuf += 4;
+   U32TOBYTES( b, outbuf )
+	outbuf += 4;
+   U32TOBYTES( c, outbuf )
+	outbuf += 4;
+   U32TOBYTES( d, outbuf )
+}
+
+
+static int
+nush_encrypt( struct cipher_context * cx, const u8 * inbuf, u8 * outbuf, int size, int atomic )
+{
+   NUSH_context * ctx = ( NUSH_context * )cx->keyinfo;
+
+   while( size >= NUSH_BLOCK_SIZE ) 
+   {
+      _nush_encrypt( ctx, inbuf, outbuf );
+
+      inbuf  += NUSH_BLOCK_SIZE;
+      outbuf += NUSH_BLOCK_SIZE;
+      size   -= NUSH_BLOCK_SIZE;
+   }
+
+   return 0;
+}
+
+
+static int
+nush_decrypt( struct cipher_context * cx, const u8  * inbuf, u8 * outbuf, int size, int atomic )
+{
+   NUSH_context * ctx = ( NUSH_context * )cx->keyinfo;
+
+   while( size >= NUSH_BLOCK_SIZE ) 
+   {
+      _nush_decrypt( ctx, inbuf, outbuf );
+
+      inbuf  += NUSH_BLOCK_SIZE;
+      outbuf += NUSH_BLOCK_SIZE;
+      size   -= NUSH_BLOCK_SIZE;
+   }
+
+   return 0;
+}
+
+
+static int
+nush_set_key( struct cipher_context * cx, const unsigned char * key, int key_len, int atomic )
+{
+   u32 k[ 8 ];
+   u32 * ks = ( ( NUSH_context * )cx->keyinfo )->KS;
+   u32 * kf = ( ( NUSH_context * )cx->keyinfo )->KF;
+   u32 * kr = ( ( NUSH_context * )cx->keyinfo )->KR;
+   u32 * cc = ( ( NUSH_context * )cx->keyinfo )->CC;
+   int i;
+
+   if( key_len != NUSH_KEY_SIZE )
+     return -EINVAL; // unsupported key length
+
+   for( i = 0; i < 8; i++, key += 4 ) 
+   {
+      BYTESTOU32( k[ i ], key )
+   }
+
+   ks[ 0 ] = k[ 4 ];
+   ks[ 1 ] = k[ 5 ];
+   ks[ 2 ] = k[ 6 ];
+   ks[ 3 ] = k[ 7 ];
+   kf[ 0 ] = k[ 5 ];
+   kf[ 1 ] = k[ 4 ];
+   kf[ 2 ] = k[ 7 ];
+   kf[ 3 ] = k[ 6 ];
+
+   for( i = 0; i < NUSH_L; i++ )
+   {
+      kr[ i ] = k[ i % NUSH_KEYLEN_LONG ];
+      cc[ i ] = C_128[ i ];
+   }
+
+   cx->key_length = key_len;
+
+   return 0;
+}
+
+
+#define CIPHER_ID							nush
+#define CIPHER_BLOCKSIZE				( NUSH_BLOCK_SIZE * 8 )
+#define CIPHER_KEY_SIZE_MASK			CIPHER_KEYSIZE_256
+#define CIPHER_KEY_SCHEDULE_SIZE		sizeof( NUSH_context )
+
+#include "gen-cipher.h"
+
+EXPORT_NO_SYMBOLS;
+
