6a0a5bdc |
1 | /* -*-c-*- |
2 | * |
3 | * $Id: skipjack.h,v 1.1 2000/07/15 15:39:33 mdw Exp $ |
4 | * |
5 | * The Skipjack block cipher |
6 | * |
7 | * (c) 2000 Straylight/Edgeware |
8 | */ |
9 | |
10 | /*----- Licensing notice --------------------------------------------------* |
11 | * |
12 | * This file is part of Catacomb. |
13 | * |
14 | * Catacomb is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU Library General Public License as |
16 | * published by the Free Software Foundation; either version 2 of the |
17 | * License, or (at your option) any later version. |
18 | * |
19 | * Catacomb is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | * GNU Library General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU Library General Public |
25 | * License along with Catacomb; if not, write to the Free |
26 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
27 | * MA 02111-1307, USA. |
28 | */ |
29 | |
30 | /*----- Revision history --------------------------------------------------* |
31 | * |
32 | * $Log: skipjack.h,v $ |
33 | * Revision 1.1 2000/07/15 15:39:33 mdw |
34 | * The NSA's Skipjack block cipher. |
35 | * |
36 | */ |
37 | |
38 | /*----- Notes on the Skipjack block cipher --------------------------------* |
39 | * |
40 | * Skipjack was designed by the NSA, as a type II algorithm to be used in the |
41 | * Clipper system. It was initially classified, so that it couldn't be used |
42 | * without the key escrow feature, though a team of `respectable' |
43 | * cryptographers, including Dorothy Denning, had a quick look at it and |
44 | * pronounced it `good', as if this was meant to be convincing. It is |
45 | * apparently a particular parameterization of a family which includes type I |
46 | * algorithms. Since declassification, Biham has discovered a miss-in-the- |
47 | * middle attack which breaks Skipjack with 31 rounds faster than brute |
48 | * force. |
49 | * |
50 | * This implementation is provided for interest's sake, and possibly for |
51 | * interoperability, rather than as a good cipher to use. |
52 | */ |
53 | |
54 | #ifndef CATACOMB_SKIPJACK_H |
55 | #define CATACOMB_SKIPJACK_H |
56 | |
57 | #ifdef __cplusplus |
58 | extern "C" { |
59 | #endif |
60 | |
61 | /*----- Header files ------------------------------------------------------*/ |
62 | |
63 | #include <stddef.h> |
64 | |
65 | #include <mLib/bits.h> |
66 | |
67 | /*----- Magical numbers ---------------------------------------------------*/ |
68 | |
69 | #define SKIPJACK_BLKSZ 8 |
70 | #define SKIPJACK_KEYSZ 10 |
71 | #define SKIPJACK_CLASS (N, B, 64) |
72 | |
73 | extern const octet skipjack_keysz[]; |
74 | |
75 | /*----- Data structures ---------------------------------------------------*/ |
76 | |
77 | typedef struct skipjack_ctx { |
78 | octet k[10]; |
79 | } skipjack_ctx; |
80 | |
81 | /*----- Functions provided ------------------------------------------------*/ |
82 | |
83 | /* --- @skipjack_init@ --- * |
84 | * |
85 | * Arguments: @skipjack_ctx *k@ = pointer to key block |
86 | * @const void *buf@ = pointer to key buffer |
87 | * @size_t sz@ = size of key material |
88 | * |
89 | * Returns: --- |
90 | * |
91 | * Use: Initializes a Skipjack key buffer. The key buffer must be |
92 | * exactly 10 bytes long. |
93 | */ |
94 | |
95 | extern void skipjack_init(skipjack_ctx */*k*/, |
96 | const void */*buf*/, size_t /*sz*/); |
97 | |
98 | /* --- @skipjack_eblk@, @skipjack_dblk@ --- * |
99 | * |
100 | * Arguments: @const skipjack_ctx *k@ = pointer to key block |
101 | * @const uint32 s[2]@ = pointer to source block |
102 | * @uint32 d[2]@ = pointer to skipjacktination block |
103 | * |
104 | * Returns: --- |
105 | * |
106 | * Use: Low-level block encryption and decryption. |
107 | */ |
108 | |
109 | extern void skipjack_eblk(const skipjack_ctx */*k*/, |
110 | const uint32 */*s*/, uint32 */*d*/); |
111 | extern void skipjack_dblk(const skipjack_ctx */*k*/, |
112 | const uint32 */*s*/, uint32 */*d*/); |
113 | |
114 | /*----- That's all, folks -------------------------------------------------*/ |
115 | |
116 | #ifdef __cplusplus |
117 | } |
118 | #endif |
119 | |
120 | #endif |