math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / symm / skipjack.h
CommitLineData
6a0a5bdc 1/* -*-c-*-
2 *
6a0a5bdc 3 * The Skipjack block cipher
4 *
5 * (c) 2000 Straylight/Edgeware
6 */
7
45c0fd36 8/*----- Licensing notice --------------------------------------------------*
6a0a5bdc 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.
45c0fd36 16 *
6a0a5bdc 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.
45c0fd36 21 *
6a0a5bdc 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
6a0a5bdc 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
63extern const octet skipjack_keysz[];
64
65/*----- Data structures ---------------------------------------------------*/
66
67typedef struct skipjack_ctx {
fe371977 68 uint32 ka, kb, kc, kd, ke;
6a0a5bdc 69} skipjack_ctx;
70
71/*----- Functions provided ------------------------------------------------*/
72
73/* --- @skipjack_init@ --- *
74 *
45c0fd36
MW
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
6a0a5bdc 78 *
45c0fd36 79 * Returns: ---
6a0a5bdc 80 *
45c0fd36 81 * Use: Initializes a Skipjack key buffer. The key buffer must be
6a0a5bdc 82 * exactly 10 bytes long.
83 */
84
85extern void skipjack_init(skipjack_ctx */*k*/,
86 const void */*buf*/, size_t /*sz*/);
87
88/* --- @skipjack_eblk@, @skipjack_dblk@ --- *
89 *
45c0fd36
MW
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
6a0a5bdc 93 *
45c0fd36 94 * Returns: ---
6a0a5bdc 95 *
45c0fd36 96 * Use: Low-level block encryption and decryption.
6a0a5bdc 97 */
98
99extern void skipjack_eblk(const skipjack_ctx */*k*/,
100 const uint32 */*s*/, uint32 */*d*/);
101extern 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