chiark / gitweb /
keyutil.c: Only copy the shared parts of a parameters key.
[catacomb] / noekeon.h
1 /* -*-c-*-
2  *
3  * $Id: noekeon.h,v 1.2 2004/04/08 01:36:15 mdw Exp $
4  *
5  * The Noekeon 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 Noekeon block cipher --------------------------------*
31  *
32  * A Nessie entry, by Joan Daemen, Michael Peeters, Gilles Van Assche and
33  * Vincent Rijmen, two of whom were the designers of the AES winner
34  * Rijndael.  It's a simple cipher, based on Serpent-style bit-slicing.
35  * Speed is about middle-of-the-road -- about as fast as SAFER, faster than
36  * MARS.
37  */
38
39 #ifndef CATACOMB_NOEKEON_H
40 #define CATACOMB_NOEKEON_H
41
42 #ifdef __cplusplus
43   extern "C" {
44 #endif
45
46 /*----- Header files ------------------------------------------------------*/
47
48 #include <stddef.h>
49
50 #include <mLib/bits.h>
51
52 /*----- Magical numbers ---------------------------------------------------*/
53
54 #define NOEKEON_BLKSZ 16
55 #define NOEKEON_KEYSZ 16
56 #define NOEKEON_CLASS (N, B, 128)
57
58 extern const octet noekeon_keysz[];
59
60 /*----- Data structures ---------------------------------------------------*/
61
62 typedef struct noekeon_ctx {
63   uint32 k[4];
64 } noekeon_ctx;
65
66 /*----- Functions provided ------------------------------------------------*/
67
68 /* --- @noekeon_init@ --- *
69  *
70  * Arguments:   @noekeon_ctx *k@ = pointer to context to initialize
71  *              @const void *buf@ = pointer to buffer of key material
72  *              @size_t sz@ = size of the key material
73  *
74  * Returns:     ---
75  *
76  * Use:         Initializes a Noekeon context with a particular key.  This
77  *              uses indirect keying.  The key must be 128 bits long.
78  */
79
80 extern void noekeon_init(noekeon_ctx */*k*/,
81                          const void */*buf*/, size_t /*sz*/);
82
83 /* --- @noekeon_eblk@, @noekeon_dblk@ --- *
84  *
85  * Arguments:   @const noekeon_ctx *k@ = pointer to Noekeon context
86  *              @const uint32 s[4]@ = pointer to source block
87  *              @uint32 d[4]@ = pointer to destination block
88  *
89  * Returns:     ---
90  *
91  * Use:         Low-level block encryption and decryption.
92  */
93
94 extern void noekeon_eblk(const noekeon_ctx */*k*/,
95                          const uint32 */*s*/, uint32 */*dst*/);
96 extern void noekeon_dblk(const noekeon_ctx */*k*/,
97                          const uint32 */*s*/, uint32 */*dst*/);
98
99 /*----- That's all, folks -------------------------------------------------*/
100
101 #ifdef __cplusplus
102   }
103 #endif
104
105 #endif