chiark / gitweb /
hashsum.c: Document `--progress' in the `--help' display.
[catacomb] / skipjack.h
1 /* -*-c-*-
2  *
3  * $Id: skipjack.h,v 1.3 2004/04/08 01:36:15 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 /*----- Notes on the Skipjack block cipher --------------------------------*
31  *
32  * Skipjack was designed by the NSA, as a type II algorithm to be used in the
33  * Clipper system.  It was initially classified, so that it couldn't be used
34  * without the key escrow feature, though a team of `respectable'
35  * cryptographers, including Dorothy Denning, had a quick look at it and
36  * pronounced it `good', as if this was meant to be convincing.  It is
37  * apparently a particular parameterization of a family which includes type I
38  * algorithms.  Since declassification, Biham has discovered a miss-in-the-
39  * middle attack which breaks Skipjack with 31 rounds faster than brute
40  * force.
41  *
42  * This implementation is provided for interest's sake, and possibly for
43  * interoperability, rather than as a good cipher to use.
44  */
45
46 #ifndef CATACOMB_SKIPJACK_H
47 #define CATACOMB_SKIPJACK_H
48
49 #ifdef __cplusplus
50   extern "C" {
51 #endif
52
53 /*----- Header files ------------------------------------------------------*/
54
55 #include <stddef.h>
56
57 #include <mLib/bits.h>
58
59 /*----- Magical numbers ---------------------------------------------------*/
60
61 #define SKIPJACK_BLKSZ 8
62 #define SKIPJACK_KEYSZ 10
63 #define SKIPJACK_CLASS (N, B, 64)
64
65 extern const octet skipjack_keysz[];
66
67 /*----- Data structures ---------------------------------------------------*/
68
69 typedef struct skipjack_ctx {
70   uint32 ka, kb, kc, kd, ke;
71 } skipjack_ctx;
72
73 /*----- Functions provided ------------------------------------------------*/
74
75 /* --- @skipjack_init@ --- *
76  *
77  * Arguments:   @skipjack_ctx *k@ = pointer to key block
78  *              @const void *buf@ = pointer to key buffer
79  *              @size_t sz@ = size of key material
80  *
81  * Returns:     ---
82  *
83  * Use:         Initializes a Skipjack key buffer.  The key buffer must be
84  *              exactly 10 bytes long.
85  */
86
87 extern void skipjack_init(skipjack_ctx */*k*/,
88                           const void */*buf*/, size_t /*sz*/);
89
90 /* --- @skipjack_eblk@, @skipjack_dblk@ --- *
91  *
92  * Arguments:   @const skipjack_ctx *k@ = pointer to key block
93  *              @const uint32 s[2]@ = pointer to source block
94  *              @uint32 d[2]@ = pointer to skipjacktination block
95  *
96  * Returns:     ---
97  *
98  * Use:         Low-level block encryption and decryption.
99  */
100
101 extern void skipjack_eblk(const skipjack_ctx */*k*/,
102                           const uint32 */*s*/, uint32 */*d*/);
103 extern void skipjack_dblk(const skipjack_ctx */*k*/,
104                           const uint32 */*s*/, uint32 */*d*/);
105
106 /*----- That's all, folks -------------------------------------------------*/
107
108 #ifdef __cplusplus
109   }
110 #endif
111
112 #endif