To: cypherpunks@toad.com
From: Anonymous <nobody@replay.com>
Date: Thu, 14 Oct 1999 21:22:45 +0200 (CEST)
(This message did not originate from the Sender address above.It was remailed 
automatically by anonymizing remailer software.Please report problems 
or inappropriate use to theremailer administrator at abuse@replay.com.)

A patch to mcrypt-2.2.4, which is a general purpose encription package
written by Nikos Mavroyanopoulos <nmav@hellug.gr>, adding SKIPJACK.

Could someone forward this to him?

diff -c -d -N -r mcrypt-2.2.4/README mcrypt-2.2.4-skipjack/README
*** mcrypt-2.2.4/README Sat Jun 12 06:39:26 1999
--- mcrypt-2.2.4-skipjack/README        Wed Oct 13 12:18:24 1999
***************
*** 93,99 ****
   Some details have been cleared up by the paper "Soviet Encryption
   Algorithm" by Josef Pieprzyk and Leonid Tombak of the University
   of Wollongong, New South Wales.  (josef/leo@cs.adfa.oz.au)
!

   When one of these algorithms is specified, The program prompts something like:
   (for DES) Enter key (8 chars): ...
--- 93,103 ----
   Some details have been cleared up by the paper "Soviet Encryption
   Algorithm" by Josef Pieprzyk and Leonid Tombak of the University
   of Wollongong, New South Wales.  (josef/leo@cs.adfa.oz.au)
!
! SKIPJACK:
!  SKIPJACK was designed by the US NSA. It was part of the ill-fated
!  "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It
!  operates on 64bit blocks and uses a key of 80 bits.

   When one of these algorithms is specified, The program prompts something like:
   (for DES) Enter key (8 chars): ...
diff -c -d -N -r mcrypt-2.2.4/doc/magic mcrypt-2.2.4-skipjack/doc/magic
*** mcrypt-2.2.4/doc/magic      Sun Sep 19 10:12:12 1999
--- mcrypt-2.2.4-skipjack/doc/magic     Tue Oct 12 01:12:03 1999
***************
*** 35,40 ****
--- 35,41 ----
  >3     byte            104             algorithm: MARS-128,
  >3     byte            105             algorithm: MARS-192,
  >3     byte            106             algorithm: MARS-256,
+ >3     byte            107             algorithm: SKIPJACK,
  >4     byte            0               mode: CBC,
  >4     byte            1               mode: ECB,
  >4     byte            2               mode: CFB,
diff -c -d -N -r mcrypt-2.2.4/doc/mcrypt.1 mcrypt-2.2.4-skipjack/doc/mcrypt.1
*** mcrypt-2.2.4/doc/mcrypt.1   Mon Oct  4 06:25:09 1999
--- mcrypt-2.2.4-skipjack/doc/mcrypt.1  Wed Oct 13 12:15:33 1999
***************
*** 172,177 ****
--- 172,182 ----
  family of ciphers and provides for a block size of 128bits and 128, 192
  and 256 bits key length(only 256bits in mcrypt).

+ .B SKIPJACK:
+ SKIPJACK was designed by the US NSA. It was part of the ill-fated
+ "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It
+ operates on 64bit blocks and uses a key of 80 bits.
+
  .SH HINTS
  By default,
  .I mcrypt
diff -c -d -N -r mcrypt-2.2.4/doc/mcrypt.texi mcrypt-2.2.4-skipjack/doc/mcrypt.texi
*** mcrypt-2.2.4/doc/mcrypt.texi        Mon Jun 28 15:12:18 1999
--- mcrypt-2.2.4-skipjack/doc/mcrypt.texi       Wed Oct 13 12:16:22 1999
***************
*** 247,252 ****
--- 247,257 ----
  family of ciphers and provides for a block size of 128bits and 128, 192
  and 256 bits key length(only 256bits in mcrypt).

+ @item SKIPJACK:
+ SKIPJACK was designed by the US NSA. It was part of the ill-fated
+ "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It
+ operates on 64bit blocks and uses a key of 80 bits.
+
  All the above algorithms support these modes of encryption:

  @item ECB:
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/Makefile.am mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.am
*** mcrypt-2.2.4/libmcrypt/lib/Makefile.am      Mon Oct  4 06:18:53 1999
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.am     Tue Oct 12 01:21:20 1999
***************
*** 1,8 ****
  ## Process this file with automake to produce Makefile.in

  include_HEADERS = mcrypt.h
! EXTRA_DIST = rijndael.h debug.h twofish.h loki97.h saferplus.h cast-256.h sha1.h libdefs.h des.h 3-way.h safer.h gost.h blowfish.h mcrypt.h cast-128.h tean.h swap.h bzero.h xmemory.h rc2.h rc6.h idea.h cast-128_sboxes.h
  lib_LTLIBRARIES = libmcrypt.la
! libmcrypt_la_SOURCES = rijndael.c debug.c loki97.c saferplus.c cast-256.c mcrypt_extra.c des.c 3-way.c safer.c gost.c blowfish.c mcrypt.c cast-128.c sha1.c tean.c swap.c bzero.c twofish.c xmemory.c rc2.c rc6.c idea.c md5.h md5.c
  libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
              -release $(LT_RELEASE)
--- 1,8 ----
  ## Process this file with automake to produce Makefile.in

  include_HEADERS = mcrypt.h
! EXTRA_DIST = rijndael.h debug.h twofish.h loki97.h saferplus.h cast-256.h sha1.h libdefs.h des.h 3-way.h safer.h gost.h blowfish.h mcrypt.h cast-128.h tean.h swap.h bzero.h xmemory.h rc2.h rc6.h idea.h skipjack.h cast-128_sboxes.h
  lib_LTLIBRARIES = libmcrypt.la
! libmcrypt_la_SOURCES = rijndael.c debug.c loki97.c saferplus.c cast-256.c mcrypt_extra.c des.c 3-way.c safer.c gost.c blowfish.c mcrypt.c cast-128.c sha1.c tean.c swap.c bzero.c twofish.c xmemory.c rc2.c rc6.c idea.c skipjack.c md5.h md5.c
  libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
              -release $(LT_RELEASE)
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/Makefile.in mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.in
*** mcrypt-2.2.4/libmcrypt/lib/Makefile.in      Mon Oct 11 13:21:14 1999
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.in     Wed Oct 13 14:51:11 1999
***************
*** 81,89 ****
  VERSION = @VERSION@

  include_HEADERS = mcrypt.h
! EXTRA_DIST = rijndael.h debug.h twofish.h loki97.h saferplus.h cast-256.h sha1.h libdefs.h des.h 3-way.h safer.h gost.h blowfish.h mcrypt.h cast-128.h tean.h swap.h bzero.h xmemory.h rc2.h rc6.h idea.h cast-128_sboxes.h
  lib_LTLIBRARIES = libmcrypt.la
! libmcrypt_la_SOURCES = rijndael.c debug.c loki97.c saferplus.c cast-256.c mcrypt_extra.c des.c 3-way.c safer.c gost.c blowfish.c mcrypt.c cast-128.c sha1.c tean.c swap.c bzero.c twofish.c xmemory.c rc2.c rc6.c idea.c md5.h md5.c
  libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)                   -release $(LT_RELEASE)

  mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
--- 81,89 ----
  VERSION = @VERSION@

  include_HEADERS = mcrypt.h
! EXTRA_DIST = rijndael.h debug.h twofish.h loki97.h saferplus.h cast-256.h sha1.h libdefs.h des.h 3-way.h safer.h gost.h blowfish.h mcrypt.h cast-128.h tean.h swap.h bzero.h xmemory.h rc2.h rc6.h idea.h cast-128_sboxes.h skipjack.h
  lib_LTLIBRARIES = libmcrypt.la
! libmcrypt_la_SOURCES = rijndael.c debug.c loki97.c saferplus.c cast-256.c mcrypt_extra.c des.c 3-way.c safer.c gost.c blowfish.c mcrypt.c cast-128.c sha1.c tean.c swap.c bzero.c twofish.c xmemory.c rc2.c rc6.c idea.c md5.h md5.c skipjack.c
  libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)                   -release $(LT_RELEASE)

  mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
***************
*** 100,106 ****
  libmcrypt_la_OBJECTS =  rijndael.lo debug.lo loki97.lo saferplus.lo \
  cast-256.lo mcrypt_extra.lo des.lo 3-way.lo safer.lo gost.lo \
  blowfish.lo mcrypt.lo cast-128.lo sha1.lo tean.lo swap.lo bzero.lo \
! twofish.lo xmemory.lo rc2.lo rc6.lo idea.lo md5.lo
  CFLAGS = @CFLAGS@
  COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--- 100,106 ----
  libmcrypt_la_OBJECTS =  rijndael.lo debug.lo loki97.lo saferplus.lo \
  cast-256.lo mcrypt_extra.lo des.lo 3-way.lo safer.lo gost.lo \
  blowfish.lo mcrypt.lo cast-128.lo sha1.lo tean.lo swap.lo bzero.lo \
! twofish.lo xmemory.lo rc2.lo rc6.lo idea.lo md5.lo skipjack.lo
  CFLAGS = @CFLAGS@
  COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
***************
*** 287,292 ****
--- 287,293 ----
  swap.lo swap.o : swap.c libdefs.h ../config.h bzero.h swap.h xmemory.h
  tean.lo tean.o : tean.c libdefs.h ../config.h swap.h
  twofish.lo twofish.o : twofish.c libdefs.h ../config.h swap.h twofish.h
+ skipjack.lo skipjack.o : skipjack.c skipjack.h ../config.h
  xmemory.lo xmemory.o : xmemory.c libdefs.h ../config.h bzero.h xmemory.h

  info-am:
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/mcrypt.c mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.c
*** mcrypt-2.2.4/libmcrypt/lib/mcrypt.c Mon Oct  4 06:56:57 1999
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.c        Thu Oct 14 11:09:38 1999
***************
*** 40,45 ****
--- 40,46 ----
  #include <saferplus.h>
  #include <loki97.h>
  #include <rijndael.h>
+ #include <skipjack.h>

  /* I think now is re-entrant */

***************
*** 298,303 ****
--- 299,305 ----

        case ThreeWAY:
        case TEAN:
+       case SKIPJACK:
      return thread;
      break;

***************
*** 425,430 ****
--- 427,438 ----
      return 0;
      break;

+       case SKIPJACK:
+               _mcrypt_skipjack_encrypt((unsigned char *) keyword_given[thread],
+                                        (unsigned char *) plaintext);
+               return 0;
+               break;
+
        default:
      return 0;
        }
***************
*** 471,477 ****
        case RC2_128:
        case RC2_256:
        case RC2_1024:
!               _mcrypt_rc2_decrypt((void *) akey[thread],
                          (void *) plaintext);
      return 0;
      break;
--- 479,485 ----
        case RC2_128:
        case RC2_256:
        case RC2_1024:
!               _mcrypt_rc2_decrypt((void *) akey[thread],
                          (void *) plaintext);
      return 0;
      break;
***************
*** 545,550 ****
--- 553,564 ----
      return 0;
      break;

+       case SKIPJACK:
+               _mcrypt_skipjack_decrypt((unsigned char *) keyword_given[thread],
+                                        (unsigned char *) plaintext);
+               return 0;
+               break;
+
        default:
      return 0;
        }
***************
*** 621,626 ****
--- 635,641 ----
        case TEAN:
        case GOST:
        case ThreeWAY:
+       case SKIPJACK:
      break;

        case CAST128:
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/mcrypt.h mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.h
*** mcrypt-2.2.4/libmcrypt/lib/mcrypt.h Sun Sep 19 10:02:18 1999
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.h        Tue Oct 12 01:15:23 1999
***************
*** 52,57 ****
--- 52,58 ----
  #define MARS128 104
  #define MARS192 105
  #define MARS256 106
+ #define SKIPJACK 107

  #define CBC 0
  #define ECB 1
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/mcrypt_extra.c mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt_extra.c
*** mcrypt-2.2.4/libmcrypt/lib/mcrypt_extra.c   Wed Oct  6 03:52:20 1999
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt_extra.c  Thu Oct 14 10:31:44 1999
***************
*** 55,60 ****
--- 55,61 ----
        case RC2_1024:
        case RC2_128:
        case RC2_256:
+       case SKIPJACK:
      return 8;
      break;

***************
*** 185,190 ****
--- 186,195 ----
      return 16;
      break;

+         case SKIPJACK:
+               return 10;
+               break;
+
        default:
      return 0;
        }
***************
*** 332,337 ****
--- 337,346 ----
      strcpy(x, "xTEA");
      return x;
      break;
+         case SKIPJACK:
+                 strcpy(x, "SKIPJACK");
+                 return x;
+               break;
        }
        return NULL;

***************
*** 371,376 ****
--- 380,386 ----
        case RIJNDAEL128:
        case RIJNDAEL192:
        case RIJNDAEL256:
+         case SKIPJACK:

        case LOKI97:
      return 0;
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/skipjack.c mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.c
*** mcrypt-2.2.4/libmcrypt/lib/skipjack.c       Wed Dec 31 16:00:00 1969
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.c      Thu Oct 14 11:30:34 1999
***************
*** 0 ****
--- 1,160 ----
+ /* skipjack.c */
+
+ #include <assert.h>
+ #include <string.h>
+
+ #include "skipjack.h"
+
+ #define BLOCKSIZE 8
+ #define KEYSIZE 10
+
+ static const unsigned char F[]  = {
+     0xA3, 0xD7, 0x09, 0x83, 0xF8, 0x48, 0xF6, 0xF4,
+     0xB3, 0x21, 0x15, 0x78, 0x99, 0xB1, 0xAF, 0xF9,
+     0xE7, 0x2D, 0x4D, 0x8A, 0xCE, 0x4C, 0xCA, 0x2E,
+     0x52, 0x95, 0xD9, 0x1E, 0x4E, 0x38, 0x44, 0x28,
+     0x0A, 0xDF, 0x02, 0xA0, 0x17, 0xF1, 0x60, 0x68,
+     0x12, 0xB7, 0x7A, 0xC3, 0xE9, 0xFA, 0x3D, 0x53,
+     0x96, 0x84, 0x6B, 0xBA, 0xF2, 0x63, 0x9A, 0x19,
+     0x7C, 0xAE, 0xE5, 0xF5, 0xF7, 0x16, 0x6A, 0xA2,
+     0x39, 0xB6, 0x7B, 0x0F, 0xC1, 0x93, 0x81, 0x1B,
+     0xEE, 0xB4, 0x1A, 0xEA, 0xD0, 0x91, 0x2F, 0xB8,
+     0x55, 0xB9, 0xDA, 0x85, 0x3F, 0x41, 0xBF, 0xE0,
+     0x5A, 0x58, 0x80, 0x5F, 0x66, 0x0B, 0xD8, 0x90,
+     0x35, 0xD5, 0xC0, 0xA7, 0x33, 0x06, 0x65, 0x69,
+     0x45, 0x00, 0x94, 0x56, 0x6D, 0x98, 0x9B, 0x76,
+     0x97, 0xFC, 0xB2, 0xC2, 0xB0, 0xFE, 0xDB, 0x20,
+     0xE1, 0xEB, 0xD6, 0xE4, 0xDD, 0x47, 0x4A, 0x1D,
+     0x42, 0xED, 0x9E, 0x6E, 0x49, 0x3C, 0xCD, 0x43,
+     0x27, 0xD2, 0x07, 0xD4, 0xDE, 0xC7, 0x67, 0x18,
+     0x89, 0xCB, 0x30, 0x1F, 0x8D, 0xC6, 0x8F, 0xAA,
+     0xC8, 0x74, 0xDC, 0xC9, 0x5D, 0x5C, 0x31, 0xA4,
+     0x70, 0x88, 0x61, 0x2C, 0x9F, 0x0D, 0x2B, 0x87,
+     0x50, 0x82, 0x54, 0x64, 0x26, 0x7D, 0x03, 0x40,
+     0x34, 0x4B, 0x1C, 0x73, 0xD1, 0xC4, 0xFD, 0x3B,
+     0xCC, 0xFB, 0x7F, 0xAB, 0xE6, 0x3E, 0x5B, 0xA5,
+     0xAD, 0x04, 0x23, 0x9C, 0x14, 0x51, 0x22, 0xF0,
+     0x29, 0x79, 0x71, 0x7E, 0xFF, 0x8C, 0x0E, 0xE2,
+     0x0C, 0xEF, 0xBC, 0x72, 0x75, 0x6F, 0x37, 0xA1,
+     0xEC, 0xD3, 0x8E, 0x62, 0x8B, 0x86, 0x10, 0xE8,
+     0x08, 0x77, 0x11, 0xBE, 0x92, 0x4F, 0x24, 0xC5,
+     0x32, 0x36, 0x9D, 0xCF, 0xF3, 0xA6, 0xBB, 0xAC,
+     0x5E, 0x6C, 0xA9, 0x13, 0x57, 0x25, 0xB5, 0xE3,
+     0xBD, 0xA8, 0x3A, 0x01, 0x05, 0x59, 0x2A, 0x46
+ };
+
+ void g (unsigned char *key, int *i,
+       unsigned char *high, unsigned char *low) {
+   (*high) ^= F[(*low)  ^ key[*i]];
+   (*i)++; (*i) %= KEYSIZE;
+   (*low)  ^= F[(*high) ^ key[*i]];
+   (*i)++; (*i) %= KEYSIZE;
+   (*high) ^= F[(*low)  ^ key[*i]];
+   (*i)++; (*i) %= KEYSIZE;
+   (*low)  ^= F[(*high) ^ key[*i]];
+   (*i)++; (*i) %= KEYSIZE;
+ }
+
+ void g_inverse (unsigned char *key, int *i,
+               unsigned char *high, unsigned char *low) {
+   (*low)  ^= F[(*high) ^ key[(*i)]];
+   (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; }
+   (*high) ^= F[(*low)  ^ key[(*i)]];
+   (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; }
+   (*low)  ^= F[(*high) ^ key[(*i)]];
+   (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; }
+   (*high) ^= F[(*low)  ^ key[(*i)]];
+   (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; }
+ }
+
+ void _mcrypt_skipjack_encrypt (unsigned char *key, unsigned char *block) {
+   int i = 0;
+   unsigned char c = 0;
+   unsigned char temp[2];
+
+   while (c < 32) {
+     while (c % 16 != 8) {
+       c++;
+       // Temp := Ciphertext(6 .. 7);
+       memcpy(&(temp[0]), &(block[6]), 2);
+       // Ciphertext(2 .. 7) := Ciphertext(0 .. 5);
+       memmove(&(block[2]), &(block[0]), BLOCKSIZE-2);
+       // G(Key, I, Ciphertext(2), Ciphertext(3));
+       g(key, &i, &(block[2]), &(block[3]));
+       // Ciphertext(0) := Temp(0) xor Ciphertext(2);
+       block[0] = temp[0] ^ block[2];
+       // Ciphertext(1) := Temp(1) xor Ciphertext(3) xor Counter;
+       block[1] = temp[1] ^ block[3] ^ c;
+     }
+     while (c % 16 != 0) {
+       c++;
+       // Temp := Ciphertext(6 .. 7);
+       memcpy(&(temp[0]), &(block[6]), 2);
+       // Ciphertext(2 .. 7) := Ciphertext(0 .. 5);
+       memmove(&(block[2]), &(block[0]), BLOCKSIZE-2);
+       // Ciphertext(4) := Ciphertext(4) xor Ciphertext(0);
+       block[4] ^= block[0];
+       // Ciphertext(5) := Ciphertext(5) xor Ciphertext(1) xor Counter;
+       block[5] = block[5] ^ block[1] ^ c;
+       // G(Key, I, Ciphertext(2), Ciphertext(3));
+       g(key, &i, &(block[2]), &(block[3]));
+       // Ciphertext(0 .. 1) := Temp;
+       memcpy(&(block[0]), &(temp[0]), 2);
+     }
+   }
+ }
+
+ void _mcrypt_skipjack_decrypt (unsigned char *key, unsigned char *block) {
+   int i = (4 * 4 * 8 - 1) % KEYSIZE;
+   unsigned char c = 4 * 8;
+   unsigned char temp[2];
+
+   while (c > 0) {
+     while (c % 16 != 8) {
+       // Temp := Plaintext(0 .. 1);
+       memcpy(&(temp[0]), &(block[0]), 2);
+       // Plaintext(0 .. 5) := Plaintext(2 .. 7);
+       memmove(&(block[0]), &(block[2]), BLOCKSIZE-2);
+       // G_Inverse(Key, I, Plaintext(0), Plaintext(1));
+       g_inverse(key, &i, &(block[0]), &(block[1]));
+       // Plaintext(2) := Plaintext(2) xor Plaintext(0);
+       block[2] = block[2] ^ block[0];
+       // Plaintext(3) := Plaintext(3) xor Plaintext(1) xor Counter;
+       block[3] = block[3] ^ block[1] ^ c;
+       // Plaintext(6 .. 7) := Temp;
+       memcpy(&(block[6]), &(temp[0]), 2);
+       c--;
+     }
+     while (c % 16 != 0) {
+       // Temp(0) := Plaintext(0) xor Plaintext(2);
+       temp[0] = block[0] ^ block[2];
+       // Temp(1) := Plaintext(1) xor Plaintext(3) xor Counter;
+       temp[1] = block[1] ^ block[3] ^ c;
+       // Plaintext(0 .. 5) := Plaintext(2 .. 7);
+       memmove(&(block[0]), &(block[2]), BLOCKSIZE-2);
+       // G_Inverse(Key, I, Plaintext(0), Plaintext(1));
+       g_inverse(key, &i, &(block[0]), &(block[1]));
+       // Plaintext(6 .. 7) := Temp;
+       memcpy(&(block[6]), &(temp[0]), 2);
+       c--;
+     }
+   }
+ }
+
+ void _mcrypt_skipjack_selftest (void) {
+   unsigned char k[KEYSIZE] =  { 0x00, 0x99, 0x88, 0x77, 0x66,
+                               0x55, 0x44, 0x33, 0x22, 0x11};
+   unsigned char bcler[BLOCKSIZE] = { 0x33, 0x22, 0x11, 0x00,
+                                    0xDD, 0xCC, 0xBB, 0xAA };
+   unsigned char bciph[BLOCKSIZE] = { 0x25, 0x87, 0xCA, 0xE2,
+                                    0x7A, 0x12, 0xD3, 0x00 };
+   unsigned char bwork[BLOCKSIZE];
+
+   memcpy(bwork, bcler, BLOCKSIZE);
+   _mcrypt_skipjack_encrypt (k, bwork);
+   assert(memcmp(bciph, bwork, BLOCKSIZE) == 0);
+   _mcrypt_skipjack_decrypt (k, bwork);
+   assert(memcmp(bcler, bwork, BLOCKSIZE) == 0);
+
+   return;
+ }
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/skipjack.h mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.h
*** mcrypt-2.2.4/libmcrypt/lib/skipjack.h       Wed Dec 31 16:00:00 1969
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.h      Thu Oct 14 09:06:34 1999
***************
*** 0 ****
--- 1,3 ----
+ void _mcrypt_skipjack_encrypt (unsigned char *key, unsigned char *block);
+ void _mcrypt_skipjack_decrypt (unsigned char *key, unsigned char *block);
+ void _mcrypt_skipjack_selftest (void);
diff -c -d -N -r mcrypt-2.2.4/tests/ciphertest mcrypt-2.2.4-skipjack/tests/ciphertest
*** mcrypt-2.2.4/tests/ciphertest       Wed Oct  6 03:11:42 1999
--- mcrypt-2.2.4-skipjack/tests/ciphertest      Thu Oct 14 09:59:44 1999
***************
*** 8,13 ****
--- 8,16 ----
  LD_LIBRARY_PATH=../libmcrypt/lib/.libs
  export LD_LIBRARY_PATH

+ ../src/mcrypt -q -k 1234567890 -a skipjack <TEST | ../src/mcrypt -q -d -k 1234567890 >TEST.skipjack
+ if (diff TEST TEST.skipjack >/dev/null 2>&1) then (echo "SKIPJACK Ok.") else (echo "SKIPJACK Failed.") fi
+
  ../src/mcrypt -q -k 1234567890 -a blowfish-448 <TEST | ../src/mcrypt -q -d -k 1234567890 >TEST.blowfish448
  if (diff TEST TEST.blowfish448 >/dev/null 2>&1) then (echo "BLOWFISH-448 Ok.") else (echo "BLOWFISH-448 Failed.") fi

diff -c -d -N -r mcrypt-2.2.4/tests/ciphertest.new mcrypt-2.2.4-skipjack/tests/ciphertest.new
*** mcrypt-2.2.4/tests/ciphertest.new   Mon Oct  4 06:16:26 1999
--- mcrypt-2.2.4-skipjack/tests/ciphertest.new  Thu Oct 14 10:00:12 1999
***************
*** 2,7 ****
--- 2,8 ----
  LD_LIBRARY_PATH=../libmcrypt/lib/.libs
  export LD_LIBRARY_PATH

+ ../src/mcrypt -q -k 1234567890 -m ecb -a skipjack <TEST >test.skipjack
  ../src/mcrypt -q -k 1234567890 -m ecb -a blowfish-448 <TEST >test.blowfish448
  ../src/mcrypt -q -k 1234567890 -m ecb -a idea <TEST >test.idea
  ../src/mcrypt -q -k 1234567890 -m ecb -a rc2-256 <TEST >test.rc2-256

