1 |
nmav |
1.1 |
To: cypherpunks@toad.com |
2 |
|
|
From: Anonymous <nobody@replay.com> |
3 |
|
|
Date: Thu, 14 Oct 1999 21:22:45 +0200 (CEST) |
4 |
|
|
(This message did not originate from the Sender address above.It was remailed |
5 |
|
|
automatically by anonymizing remailer software.Please report problems |
6 |
|
|
or inappropriate use to theremailer administrator at abuse@replay.com.) |
7 |
|
|
|
8 |
|
|
A patch to mcrypt-2.2.4, which is a general purpose encription package |
9 |
|
|
written by Nikos Mavroyanopoulos <nmav@hellug.gr>, adding SKIPJACK. |
10 |
|
|
|
11 |
|
|
Could someone forward this to him? |
12 |
|
|
|
13 |
|
|
diff -c -d -N -r mcrypt-2.2.4/README mcrypt-2.2.4-skipjack/README |
14 |
|
|
*** mcrypt-2.2.4/README Sat Jun 12 06:39:26 1999 |
15 |
|
|
--- mcrypt-2.2.4-skipjack/README Wed Oct 13 12:18:24 1999 |
16 |
|
|
*************** |
17 |
|
|
*** 93,99 **** |
18 |
|
|
Some details have been cleared up by the paper "Soviet Encryption |
19 |
|
|
Algorithm" by Josef Pieprzyk and Leonid Tombak of the University |
20 |
|
|
of Wollongong, New South Wales. (josef/leo@cs.adfa.oz.au) |
21 |
|
|
! |
22 |
|
|
|
23 |
|
|
When one of these algorithms is specified, The program prompts something like: |
24 |
|
|
(for DES) Enter key (8 chars): ... |
25 |
|
|
--- 93,103 ---- |
26 |
|
|
Some details have been cleared up by the paper "Soviet Encryption |
27 |
|
|
Algorithm" by Josef Pieprzyk and Leonid Tombak of the University |
28 |
|
|
of Wollongong, New South Wales. (josef/leo@cs.adfa.oz.au) |
29 |
|
|
! |
30 |
|
|
! SKIPJACK: |
31 |
|
|
! SKIPJACK was designed by the US NSA. It was part of the ill-fated |
32 |
|
|
! "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It |
33 |
|
|
! operates on 64bit blocks and uses a key of 80 bits. |
34 |
|
|
|
35 |
|
|
When one of these algorithms is specified, The program prompts something like: |
36 |
|
|
(for DES) Enter key (8 chars): ... |
37 |
|
|
diff -c -d -N -r mcrypt-2.2.4/doc/magic mcrypt-2.2.4-skipjack/doc/magic |
38 |
|
|
*** mcrypt-2.2.4/doc/magic Sun Sep 19 10:12:12 1999 |
39 |
|
|
--- mcrypt-2.2.4-skipjack/doc/magic Tue Oct 12 01:12:03 1999 |
40 |
|
|
*************** |
41 |
|
|
*** 35,40 **** |
42 |
|
|
--- 35,41 ---- |
43 |
|
|
>3 byte 104 algorithm: MARS-128, |
44 |
|
|
>3 byte 105 algorithm: MARS-192, |
45 |
|
|
>3 byte 106 algorithm: MARS-256, |
46 |
|
|
+ >3 byte 107 algorithm: SKIPJACK, |
47 |
|
|
>4 byte 0 mode: CBC, |
48 |
|
|
>4 byte 1 mode: ECB, |
49 |
|
|
>4 byte 2 mode: CFB, |
50 |
|
|
diff -c -d -N -r mcrypt-2.2.4/doc/mcrypt.1 mcrypt-2.2.4-skipjack/doc/mcrypt.1 |
51 |
|
|
*** mcrypt-2.2.4/doc/mcrypt.1 Mon Oct 4 06:25:09 1999 |
52 |
|
|
--- mcrypt-2.2.4-skipjack/doc/mcrypt.1 Wed Oct 13 12:15:33 1999 |
53 |
|
|
*************** |
54 |
|
|
*** 172,177 **** |
55 |
|
|
--- 172,182 ---- |
56 |
|
|
family of ciphers and provides for a block size of 128bits and 128, 192 |
57 |
|
|
and 256 bits key length(only 256bits in mcrypt). |
58 |
|
|
|
59 |
|
|
+ .B SKIPJACK: |
60 |
|
|
+ SKIPJACK was designed by the US NSA. It was part of the ill-fated |
61 |
|
|
+ "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It |
62 |
|
|
+ operates on 64bit blocks and uses a key of 80 bits. |
63 |
|
|
+ |
64 |
|
|
.SH HINTS |
65 |
|
|
By default, |
66 |
|
|
.I mcrypt |
67 |
|
|
diff -c -d -N -r mcrypt-2.2.4/doc/mcrypt.texi mcrypt-2.2.4-skipjack/doc/mcrypt.texi |
68 |
|
|
*** mcrypt-2.2.4/doc/mcrypt.texi Mon Jun 28 15:12:18 1999 |
69 |
|
|
--- mcrypt-2.2.4-skipjack/doc/mcrypt.texi Wed Oct 13 12:16:22 1999 |
70 |
|
|
*************** |
71 |
|
|
*** 247,252 **** |
72 |
|
|
--- 247,257 ---- |
73 |
|
|
family of ciphers and provides for a block size of 128bits and 128, 192 |
74 |
|
|
and 256 bits key length(only 256bits in mcrypt). |
75 |
|
|
|
76 |
|
|
+ @item SKIPJACK: |
77 |
|
|
+ SKIPJACK was designed by the US NSA. It was part of the ill-fated |
78 |
|
|
+ "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It |
79 |
|
|
+ operates on 64bit blocks and uses a key of 80 bits. |
80 |
|
|
+ |
81 |
|
|
All the above algorithms support these modes of encryption: |
82 |
|
|
|
83 |
|
|
@item ECB: |
84 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/Makefile.am mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.am |
85 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/Makefile.am Mon Oct 4 06:18:53 1999 |
86 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.am Tue Oct 12 01:21:20 1999 |
87 |
|
|
*************** |
88 |
|
|
*** 1,8 **** |
89 |
|
|
## Process this file with automake to produce Makefile.in |
90 |
|
|
|
91 |
|
|
include_HEADERS = mcrypt.h |
92 |
|
|
! 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 |
93 |
|
|
lib_LTLIBRARIES = libmcrypt.la |
94 |
|
|
! 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 |
95 |
|
|
libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ |
96 |
|
|
-release $(LT_RELEASE) |
97 |
|
|
--- 1,8 ---- |
98 |
|
|
## Process this file with automake to produce Makefile.in |
99 |
|
|
|
100 |
|
|
include_HEADERS = mcrypt.h |
101 |
|
|
! 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 |
102 |
|
|
lib_LTLIBRARIES = libmcrypt.la |
103 |
|
|
! 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 |
104 |
|
|
libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ |
105 |
|
|
-release $(LT_RELEASE) |
106 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/Makefile.in mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.in |
107 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/Makefile.in Mon Oct 11 13:21:14 1999 |
108 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/Makefile.in Wed Oct 13 14:51:11 1999 |
109 |
|
|
*************** |
110 |
|
|
*** 81,89 **** |
111 |
|
|
VERSION = @VERSION@ |
112 |
|
|
|
113 |
|
|
include_HEADERS = mcrypt.h |
114 |
|
|
! 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 |
115 |
|
|
lib_LTLIBRARIES = libmcrypt.la |
116 |
|
|
! 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 |
117 |
|
|
libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) |
118 |
|
|
|
119 |
|
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
120 |
|
|
--- 81,89 ---- |
121 |
|
|
VERSION = @VERSION@ |
122 |
|
|
|
123 |
|
|
include_HEADERS = mcrypt.h |
124 |
|
|
! 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 |
125 |
|
|
lib_LTLIBRARIES = libmcrypt.la |
126 |
|
|
! 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 |
127 |
|
|
libmcrypt_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) |
128 |
|
|
|
129 |
|
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
130 |
|
|
*************** |
131 |
|
|
*** 100,106 **** |
132 |
|
|
libmcrypt_la_OBJECTS = rijndael.lo debug.lo loki97.lo saferplus.lo \ |
133 |
|
|
cast-256.lo mcrypt_extra.lo des.lo 3-way.lo safer.lo gost.lo \ |
134 |
|
|
blowfish.lo mcrypt.lo cast-128.lo sha1.lo tean.lo swap.lo bzero.lo \ |
135 |
|
|
! twofish.lo xmemory.lo rc2.lo rc6.lo idea.lo md5.lo |
136 |
|
|
CFLAGS = @CFLAGS@ |
137 |
|
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
138 |
|
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
139 |
|
|
--- 100,106 ---- |
140 |
|
|
libmcrypt_la_OBJECTS = rijndael.lo debug.lo loki97.lo saferplus.lo \ |
141 |
|
|
cast-256.lo mcrypt_extra.lo des.lo 3-way.lo safer.lo gost.lo \ |
142 |
|
|
blowfish.lo mcrypt.lo cast-128.lo sha1.lo tean.lo swap.lo bzero.lo \ |
143 |
|
|
! twofish.lo xmemory.lo rc2.lo rc6.lo idea.lo md5.lo skipjack.lo |
144 |
|
|
CFLAGS = @CFLAGS@ |
145 |
|
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
146 |
|
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
147 |
|
|
*************** |
148 |
|
|
*** 287,292 **** |
149 |
|
|
--- 287,293 ---- |
150 |
|
|
swap.lo swap.o : swap.c libdefs.h ../config.h bzero.h swap.h xmemory.h |
151 |
|
|
tean.lo tean.o : tean.c libdefs.h ../config.h swap.h |
152 |
|
|
twofish.lo twofish.o : twofish.c libdefs.h ../config.h swap.h twofish.h |
153 |
|
|
+ skipjack.lo skipjack.o : skipjack.c skipjack.h ../config.h |
154 |
|
|
xmemory.lo xmemory.o : xmemory.c libdefs.h ../config.h bzero.h xmemory.h |
155 |
|
|
|
156 |
|
|
info-am: |
157 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/mcrypt.c mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.c |
158 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/mcrypt.c Mon Oct 4 06:56:57 1999 |
159 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.c Thu Oct 14 11:09:38 1999 |
160 |
|
|
*************** |
161 |
|
|
*** 40,45 **** |
162 |
|
|
--- 40,46 ---- |
163 |
|
|
#include <saferplus.h> |
164 |
|
|
#include <loki97.h> |
165 |
|
|
#include <rijndael.h> |
166 |
|
|
+ #include <skipjack.h> |
167 |
|
|
|
168 |
|
|
/* I think now is re-entrant */ |
169 |
|
|
|
170 |
|
|
*************** |
171 |
|
|
*** 298,303 **** |
172 |
|
|
--- 299,305 ---- |
173 |
|
|
|
174 |
|
|
case ThreeWAY: |
175 |
|
|
case TEAN: |
176 |
|
|
+ case SKIPJACK: |
177 |
|
|
return thread; |
178 |
|
|
break; |
179 |
|
|
|
180 |
|
|
*************** |
181 |
|
|
*** 425,430 **** |
182 |
|
|
--- 427,438 ---- |
183 |
|
|
return 0; |
184 |
|
|
break; |
185 |
|
|
|
186 |
|
|
+ case SKIPJACK: |
187 |
|
|
+ _mcrypt_skipjack_encrypt((unsigned char *) keyword_given[thread], |
188 |
|
|
+ (unsigned char *) plaintext); |
189 |
|
|
+ return 0; |
190 |
|
|
+ break; |
191 |
|
|
+ |
192 |
|
|
default: |
193 |
|
|
return 0; |
194 |
|
|
} |
195 |
|
|
*************** |
196 |
|
|
*** 471,477 **** |
197 |
|
|
case RC2_128: |
198 |
|
|
case RC2_256: |
199 |
|
|
case RC2_1024: |
200 |
|
|
! _mcrypt_rc2_decrypt((void *) akey[thread], |
201 |
|
|
(void *) plaintext); |
202 |
|
|
return 0; |
203 |
|
|
break; |
204 |
|
|
--- 479,485 ---- |
205 |
|
|
case RC2_128: |
206 |
|
|
case RC2_256: |
207 |
|
|
case RC2_1024: |
208 |
|
|
! _mcrypt_rc2_decrypt((void *) akey[thread], |
209 |
|
|
(void *) plaintext); |
210 |
|
|
return 0; |
211 |
|
|
break; |
212 |
|
|
*************** |
213 |
|
|
*** 545,550 **** |
214 |
|
|
--- 553,564 ---- |
215 |
|
|
return 0; |
216 |
|
|
break; |
217 |
|
|
|
218 |
|
|
+ case SKIPJACK: |
219 |
|
|
+ _mcrypt_skipjack_decrypt((unsigned char *) keyword_given[thread], |
220 |
|
|
+ (unsigned char *) plaintext); |
221 |
|
|
+ return 0; |
222 |
|
|
+ break; |
223 |
|
|
+ |
224 |
|
|
default: |
225 |
|
|
return 0; |
226 |
|
|
} |
227 |
|
|
*************** |
228 |
|
|
*** 621,626 **** |
229 |
|
|
--- 635,641 ---- |
230 |
|
|
case TEAN: |
231 |
|
|
case GOST: |
232 |
|
|
case ThreeWAY: |
233 |
|
|
+ case SKIPJACK: |
234 |
|
|
break; |
235 |
|
|
|
236 |
|
|
case CAST128: |
237 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/mcrypt.h mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.h |
238 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/mcrypt.h Sun Sep 19 10:02:18 1999 |
239 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt.h Tue Oct 12 01:15:23 1999 |
240 |
|
|
*************** |
241 |
|
|
*** 52,57 **** |
242 |
|
|
--- 52,58 ---- |
243 |
|
|
#define MARS128 104 |
244 |
|
|
#define MARS192 105 |
245 |
|
|
#define MARS256 106 |
246 |
|
|
+ #define SKIPJACK 107 |
247 |
|
|
|
248 |
|
|
#define CBC 0 |
249 |
|
|
#define ECB 1 |
250 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/mcrypt_extra.c mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt_extra.c |
251 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/mcrypt_extra.c Wed Oct 6 03:52:20 1999 |
252 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/mcrypt_extra.c Thu Oct 14 10:31:44 1999 |
253 |
|
|
*************** |
254 |
|
|
*** 55,60 **** |
255 |
|
|
--- 55,61 ---- |
256 |
|
|
case RC2_1024: |
257 |
|
|
case RC2_128: |
258 |
|
|
case RC2_256: |
259 |
|
|
+ case SKIPJACK: |
260 |
|
|
return 8; |
261 |
|
|
break; |
262 |
|
|
|
263 |
|
|
*************** |
264 |
|
|
*** 185,190 **** |
265 |
|
|
--- 186,195 ---- |
266 |
|
|
return 16; |
267 |
|
|
break; |
268 |
|
|
|
269 |
|
|
+ case SKIPJACK: |
270 |
|
|
+ return 10; |
271 |
|
|
+ break; |
272 |
|
|
+ |
273 |
|
|
default: |
274 |
|
|
return 0; |
275 |
|
|
} |
276 |
|
|
*************** |
277 |
|
|
*** 332,337 **** |
278 |
|
|
--- 337,346 ---- |
279 |
|
|
strcpy(x, "xTEA"); |
280 |
|
|
return x; |
281 |
|
|
break; |
282 |
|
|
+ case SKIPJACK: |
283 |
|
|
+ strcpy(x, "SKIPJACK"); |
284 |
|
|
+ return x; |
285 |
|
|
+ break; |
286 |
|
|
} |
287 |
|
|
return NULL; |
288 |
|
|
|
289 |
|
|
*************** |
290 |
|
|
*** 371,376 **** |
291 |
|
|
--- 380,386 ---- |
292 |
|
|
case RIJNDAEL128: |
293 |
|
|
case RIJNDAEL192: |
294 |
|
|
case RIJNDAEL256: |
295 |
|
|
+ case SKIPJACK: |
296 |
|
|
|
297 |
|
|
case LOKI97: |
298 |
|
|
return 0; |
299 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/skipjack.c mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.c |
300 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/skipjack.c Wed Dec 31 16:00:00 1969 |
301 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.c Thu Oct 14 11:30:34 1999 |
302 |
|
|
*************** |
303 |
|
|
*** 0 **** |
304 |
|
|
--- 1,160 ---- |
305 |
|
|
+ /* skipjack.c */ |
306 |
|
|
+ |
307 |
|
|
+ #include <assert.h> |
308 |
|
|
+ #include <string.h> |
309 |
|
|
+ |
310 |
|
|
+ #include "skipjack.h" |
311 |
|
|
+ |
312 |
|
|
+ #define BLOCKSIZE 8 |
313 |
|
|
+ #define KEYSIZE 10 |
314 |
|
|
+ |
315 |
|
|
+ static const unsigned char F[] = { |
316 |
|
|
+ 0xA3, 0xD7, 0x09, 0x83, 0xF8, 0x48, 0xF6, 0xF4, |
317 |
|
|
+ 0xB3, 0x21, 0x15, 0x78, 0x99, 0xB1, 0xAF, 0xF9, |
318 |
|
|
+ 0xE7, 0x2D, 0x4D, 0x8A, 0xCE, 0x4C, 0xCA, 0x2E, |
319 |
|
|
+ 0x52, 0x95, 0xD9, 0x1E, 0x4E, 0x38, 0x44, 0x28, |
320 |
|
|
+ 0x0A, 0xDF, 0x02, 0xA0, 0x17, 0xF1, 0x60, 0x68, |
321 |
|
|
+ 0x12, 0xB7, 0x7A, 0xC3, 0xE9, 0xFA, 0x3D, 0x53, |
322 |
|
|
+ 0x96, 0x84, 0x6B, 0xBA, 0xF2, 0x63, 0x9A, 0x19, |
323 |
|
|
+ 0x7C, 0xAE, 0xE5, 0xF5, 0xF7, 0x16, 0x6A, 0xA2, |
324 |
|
|
+ 0x39, 0xB6, 0x7B, 0x0F, 0xC1, 0x93, 0x81, 0x1B, |
325 |
|
|
+ 0xEE, 0xB4, 0x1A, 0xEA, 0xD0, 0x91, 0x2F, 0xB8, |
326 |
|
|
+ 0x55, 0xB9, 0xDA, 0x85, 0x3F, 0x41, 0xBF, 0xE0, |
327 |
|
|
+ 0x5A, 0x58, 0x80, 0x5F, 0x66, 0x0B, 0xD8, 0x90, |
328 |
|
|
+ 0x35, 0xD5, 0xC0, 0xA7, 0x33, 0x06, 0x65, 0x69, |
329 |
|
|
+ 0x45, 0x00, 0x94, 0x56, 0x6D, 0x98, 0x9B, 0x76, |
330 |
|
|
+ 0x97, 0xFC, 0xB2, 0xC2, 0xB0, 0xFE, 0xDB, 0x20, |
331 |
|
|
+ 0xE1, 0xEB, 0xD6, 0xE4, 0xDD, 0x47, 0x4A, 0x1D, |
332 |
|
|
+ 0x42, 0xED, 0x9E, 0x6E, 0x49, 0x3C, 0xCD, 0x43, |
333 |
|
|
+ 0x27, 0xD2, 0x07, 0xD4, 0xDE, 0xC7, 0x67, 0x18, |
334 |
|
|
+ 0x89, 0xCB, 0x30, 0x1F, 0x8D, 0xC6, 0x8F, 0xAA, |
335 |
|
|
+ 0xC8, 0x74, 0xDC, 0xC9, 0x5D, 0x5C, 0x31, 0xA4, |
336 |
|
|
+ 0x70, 0x88, 0x61, 0x2C, 0x9F, 0x0D, 0x2B, 0x87, |
337 |
|
|
+ 0x50, 0x82, 0x54, 0x64, 0x26, 0x7D, 0x03, 0x40, |
338 |
|
|
+ 0x34, 0x4B, 0x1C, 0x73, 0xD1, 0xC4, 0xFD, 0x3B, |
339 |
|
|
+ 0xCC, 0xFB, 0x7F, 0xAB, 0xE6, 0x3E, 0x5B, 0xA5, |
340 |
|
|
+ 0xAD, 0x04, 0x23, 0x9C, 0x14, 0x51, 0x22, 0xF0, |
341 |
|
|
+ 0x29, 0x79, 0x71, 0x7E, 0xFF, 0x8C, 0x0E, 0xE2, |
342 |
|
|
+ 0x0C, 0xEF, 0xBC, 0x72, 0x75, 0x6F, 0x37, 0xA1, |
343 |
|
|
+ 0xEC, 0xD3, 0x8E, 0x62, 0x8B, 0x86, 0x10, 0xE8, |
344 |
|
|
+ 0x08, 0x77, 0x11, 0xBE, 0x92, 0x4F, 0x24, 0xC5, |
345 |
|
|
+ 0x32, 0x36, 0x9D, 0xCF, 0xF3, 0xA6, 0xBB, 0xAC, |
346 |
|
|
+ 0x5E, 0x6C, 0xA9, 0x13, 0x57, 0x25, 0xB5, 0xE3, |
347 |
|
|
+ 0xBD, 0xA8, 0x3A, 0x01, 0x05, 0x59, 0x2A, 0x46 |
348 |
|
|
+ }; |
349 |
|
|
+ |
350 |
|
|
+ void g (unsigned char *key, int *i, |
351 |
|
|
+ unsigned char *high, unsigned char *low) { |
352 |
|
|
+ (*high) ^= F[(*low) ^ key[*i]]; |
353 |
|
|
+ (*i)++; (*i) %= KEYSIZE; |
354 |
|
|
+ (*low) ^= F[(*high) ^ key[*i]]; |
355 |
|
|
+ (*i)++; (*i) %= KEYSIZE; |
356 |
|
|
+ (*high) ^= F[(*low) ^ key[*i]]; |
357 |
|
|
+ (*i)++; (*i) %= KEYSIZE; |
358 |
|
|
+ (*low) ^= F[(*high) ^ key[*i]]; |
359 |
|
|
+ (*i)++; (*i) %= KEYSIZE; |
360 |
|
|
+ } |
361 |
|
|
+ |
362 |
|
|
+ void g_inverse (unsigned char *key, int *i, |
363 |
|
|
+ unsigned char *high, unsigned char *low) { |
364 |
|
|
+ (*low) ^= F[(*high) ^ key[(*i)]]; |
365 |
|
|
+ (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; } |
366 |
|
|
+ (*high) ^= F[(*low) ^ key[(*i)]]; |
367 |
|
|
+ (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; } |
368 |
|
|
+ (*low) ^= F[(*high) ^ key[(*i)]]; |
369 |
|
|
+ (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; } |
370 |
|
|
+ (*high) ^= F[(*low) ^ key[(*i)]]; |
371 |
|
|
+ (*i)--; if ((*i) < 0) { (*i) = KEYSIZE - 1; } |
372 |
|
|
+ } |
373 |
|
|
+ |
374 |
|
|
+ void _mcrypt_skipjack_encrypt (unsigned char *key, unsigned char *block) { |
375 |
|
|
+ int i = 0; |
376 |
|
|
+ unsigned char c = 0; |
377 |
|
|
+ unsigned char temp[2]; |
378 |
|
|
+ |
379 |
|
|
+ while (c < 32) { |
380 |
|
|
+ while (c % 16 != 8) { |
381 |
|
|
+ c++; |
382 |
|
|
+ // Temp := Ciphertext(6 .. 7); |
383 |
|
|
+ memcpy(&(temp[0]), &(block[6]), 2); |
384 |
|
|
+ // Ciphertext(2 .. 7) := Ciphertext(0 .. 5); |
385 |
|
|
+ memmove(&(block[2]), &(block[0]), BLOCKSIZE-2); |
386 |
|
|
+ // G(Key, I, Ciphertext(2), Ciphertext(3)); |
387 |
|
|
+ g(key, &i, &(block[2]), &(block[3])); |
388 |
|
|
+ // Ciphertext(0) := Temp(0) xor Ciphertext(2); |
389 |
|
|
+ block[0] = temp[0] ^ block[2]; |
390 |
|
|
+ // Ciphertext(1) := Temp(1) xor Ciphertext(3) xor Counter; |
391 |
|
|
+ block[1] = temp[1] ^ block[3] ^ c; |
392 |
|
|
+ } |
393 |
|
|
+ while (c % 16 != 0) { |
394 |
|
|
+ c++; |
395 |
|
|
+ // Temp := Ciphertext(6 .. 7); |
396 |
|
|
+ memcpy(&(temp[0]), &(block[6]), 2); |
397 |
|
|
+ // Ciphertext(2 .. 7) := Ciphertext(0 .. 5); |
398 |
|
|
+ memmove(&(block[2]), &(block[0]), BLOCKSIZE-2); |
399 |
|
|
+ // Ciphertext(4) := Ciphertext(4) xor Ciphertext(0); |
400 |
|
|
+ block[4] ^= block[0]; |
401 |
|
|
+ // Ciphertext(5) := Ciphertext(5) xor Ciphertext(1) xor Counter; |
402 |
|
|
+ block[5] = block[5] ^ block[1] ^ c; |
403 |
|
|
+ // G(Key, I, Ciphertext(2), Ciphertext(3)); |
404 |
|
|
+ g(key, &i, &(block[2]), &(block[3])); |
405 |
|
|
+ // Ciphertext(0 .. 1) := Temp; |
406 |
|
|
+ memcpy(&(block[0]), &(temp[0]), 2); |
407 |
|
|
+ } |
408 |
|
|
+ } |
409 |
|
|
+ } |
410 |
|
|
+ |
411 |
|
|
+ void _mcrypt_skipjack_decrypt (unsigned char *key, unsigned char *block) { |
412 |
|
|
+ int i = (4 * 4 * 8 - 1) % KEYSIZE; |
413 |
|
|
+ unsigned char c = 4 * 8; |
414 |
|
|
+ unsigned char temp[2]; |
415 |
|
|
+ |
416 |
|
|
+ while (c > 0) { |
417 |
|
|
+ while (c % 16 != 8) { |
418 |
|
|
+ // Temp := Plaintext(0 .. 1); |
419 |
|
|
+ memcpy(&(temp[0]), &(block[0]), 2); |
420 |
|
|
+ // Plaintext(0 .. 5) := Plaintext(2 .. 7); |
421 |
|
|
+ memmove(&(block[0]), &(block[2]), BLOCKSIZE-2); |
422 |
|
|
+ // G_Inverse(Key, I, Plaintext(0), Plaintext(1)); |
423 |
|
|
+ g_inverse(key, &i, &(block[0]), &(block[1])); |
424 |
|
|
+ // Plaintext(2) := Plaintext(2) xor Plaintext(0); |
425 |
|
|
+ block[2] = block[2] ^ block[0]; |
426 |
|
|
+ // Plaintext(3) := Plaintext(3) xor Plaintext(1) xor Counter; |
427 |
|
|
+ block[3] = block[3] ^ block[1] ^ c; |
428 |
|
|
+ // Plaintext(6 .. 7) := Temp; |
429 |
|
|
+ memcpy(&(block[6]), &(temp[0]), 2); |
430 |
|
|
+ c--; |
431 |
|
|
+ } |
432 |
|
|
+ while (c % 16 != 0) { |
433 |
|
|
+ // Temp(0) := Plaintext(0) xor Plaintext(2); |
434 |
|
|
+ temp[0] = block[0] ^ block[2]; |
435 |
|
|
+ // Temp(1) := Plaintext(1) xor Plaintext(3) xor Counter; |
436 |
|
|
+ temp[1] = block[1] ^ block[3] ^ c; |
437 |
|
|
+ // Plaintext(0 .. 5) := Plaintext(2 .. 7); |
438 |
|
|
+ memmove(&(block[0]), &(block[2]), BLOCKSIZE-2); |
439 |
|
|
+ // G_Inverse(Key, I, Plaintext(0), Plaintext(1)); |
440 |
|
|
+ g_inverse(key, &i, &(block[0]), &(block[1])); |
441 |
|
|
+ // Plaintext(6 .. 7) := Temp; |
442 |
|
|
+ memcpy(&(block[6]), &(temp[0]), 2); |
443 |
|
|
+ c--; |
444 |
|
|
+ } |
445 |
|
|
+ } |
446 |
|
|
+ } |
447 |
|
|
+ |
448 |
|
|
+ void _mcrypt_skipjack_selftest (void) { |
449 |
|
|
+ unsigned char k[KEYSIZE] = { 0x00, 0x99, 0x88, 0x77, 0x66, |
450 |
|
|
+ 0x55, 0x44, 0x33, 0x22, 0x11}; |
451 |
|
|
+ unsigned char bcler[BLOCKSIZE] = { 0x33, 0x22, 0x11, 0x00, |
452 |
|
|
+ 0xDD, 0xCC, 0xBB, 0xAA }; |
453 |
|
|
+ unsigned char bciph[BLOCKSIZE] = { 0x25, 0x87, 0xCA, 0xE2, |
454 |
|
|
+ 0x7A, 0x12, 0xD3, 0x00 }; |
455 |
|
|
+ unsigned char bwork[BLOCKSIZE]; |
456 |
|
|
+ |
457 |
|
|
+ memcpy(bwork, bcler, BLOCKSIZE); |
458 |
|
|
+ _mcrypt_skipjack_encrypt (k, bwork); |
459 |
|
|
+ assert(memcmp(bciph, bwork, BLOCKSIZE) == 0); |
460 |
|
|
+ _mcrypt_skipjack_decrypt (k, bwork); |
461 |
|
|
+ assert(memcmp(bcler, bwork, BLOCKSIZE) == 0); |
462 |
|
|
+ |
463 |
|
|
+ return; |
464 |
|
|
+ } |
465 |
|
|
diff -c -d -N -r mcrypt-2.2.4/libmcrypt/lib/skipjack.h mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.h |
466 |
|
|
*** mcrypt-2.2.4/libmcrypt/lib/skipjack.h Wed Dec 31 16:00:00 1969 |
467 |
|
|
--- mcrypt-2.2.4-skipjack/libmcrypt/lib/skipjack.h Thu Oct 14 09:06:34 1999 |
468 |
|
|
*************** |
469 |
|
|
*** 0 **** |
470 |
|
|
--- 1,3 ---- |
471 |
|
|
+ void _mcrypt_skipjack_encrypt (unsigned char *key, unsigned char *block); |
472 |
|
|
+ void _mcrypt_skipjack_decrypt (unsigned char *key, unsigned char *block); |
473 |
|
|
+ void _mcrypt_skipjack_selftest (void); |
474 |
|
|
diff -c -d -N -r mcrypt-2.2.4/tests/ciphertest mcrypt-2.2.4-skipjack/tests/ciphertest |
475 |
|
|
*** mcrypt-2.2.4/tests/ciphertest Wed Oct 6 03:11:42 1999 |
476 |
|
|
--- mcrypt-2.2.4-skipjack/tests/ciphertest Thu Oct 14 09:59:44 1999 |
477 |
|
|
*************** |
478 |
|
|
*** 8,13 **** |
479 |
|
|
--- 8,16 ---- |
480 |
|
|
LD_LIBRARY_PATH=../libmcrypt/lib/.libs |
481 |
|
|
export LD_LIBRARY_PATH |
482 |
|
|
|
483 |
|
|
+ ../src/mcrypt -q -k 1234567890 -a skipjack <TEST | ../src/mcrypt -q -d -k 1234567890 >TEST.skipjack |
484 |
|
|
+ if (diff TEST TEST.skipjack >/dev/null 2>&1) then (echo "SKIPJACK Ok.") else (echo "SKIPJACK Failed.") fi |
485 |
|
|
+ |
486 |
|
|
../src/mcrypt -q -k 1234567890 -a blowfish-448 <TEST | ../src/mcrypt -q -d -k 1234567890 >TEST.blowfish448 |
487 |
|
|
if (diff TEST TEST.blowfish448 >/dev/null 2>&1) then (echo "BLOWFISH-448 Ok.") else (echo "BLOWFISH-448 Failed.") fi |
488 |
|
|
|
489 |
|
|
diff -c -d -N -r mcrypt-2.2.4/tests/ciphertest.new mcrypt-2.2.4-skipjack/tests/ciphertest.new |
490 |
|
|
*** mcrypt-2.2.4/tests/ciphertest.new Mon Oct 4 06:16:26 1999 |
491 |
|
|
--- mcrypt-2.2.4-skipjack/tests/ciphertest.new Thu Oct 14 10:00:12 1999 |
492 |
|
|
*************** |
493 |
|
|
*** 2,7 **** |
494 |
|
|
--- 2,8 ---- |
495 |
|
|
LD_LIBRARY_PATH=../libmcrypt/lib/.libs |
496 |
|
|
export LD_LIBRARY_PATH |
497 |
|
|
|
498 |
|
|
+ ../src/mcrypt -q -k 1234567890 -m ecb -a skipjack <TEST >test.skipjack |
499 |
|
|
../src/mcrypt -q -k 1234567890 -m ecb -a blowfish-448 <TEST >test.blowfish448 |
500 |
|
|
../src/mcrypt -q -k 1234567890 -m ecb -a idea <TEST >test.idea |
501 |
|
|
../src/mcrypt -q -k 1234567890 -m ecb -a rc2-256 <TEST >test.rc2-256 |
502 |
|
|
|