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