0ba18b90 |
1 | /* -*-c-*- |
2 | * |
3 | * $Id: noekeon.h,v 1.1 2001/05/08 22:17:41 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 | /*----- Revision history --------------------------------------------------* |
31 | * |
32 | * $Log: noekeon.h,v $ |
33 | * Revision 1.1 2001/05/08 22:17:41 mdw |
34 | * New cipher Noekeon added. |
35 | * |
36 | * Revision 1.3 2001/05/07 17:31:53 mdw |
37 | * Separate out key scheduling. |
38 | * |
39 | * Revision 1.2 2000/10/08 15:48:58 mdw |
40 | * Update comments now that AES has been chosen. |
41 | * |
42 | * Revision 1.1 2000/06/17 11:56:07 mdw |
43 | * New cipher. |
44 | * |
45 | */ |
46 | |
47 | /*----- Notes on the Noekeon block cipher --------------------------------* |
48 | * |
49 | * A Nessie entry, by Joan Daemen, Michael Peeters, Gilles Van Assche and |
50 | * Vincent Rijmen, two of whom were the designers of the AES winner |
51 | * Rijndael. It's a simple cipher, based on Serpent-style bit-slicing. |
52 | * Speed is about middle-of-the-road -- about as fast as SAFER, faster than |
53 | * MARS. |
54 | */ |
55 | |
56 | #ifndef CATACOMB_NOEKEON_H |
57 | #define CATACOMB_NOEKEON_H |
58 | |
59 | #ifdef __cplusplus |
60 | extern "C" { |
61 | #endif |
62 | |
63 | /*----- Header files ------------------------------------------------------*/ |
64 | |
65 | #include <stddef.h> |
66 | |
67 | #include <mLib/bits.h> |
68 | |
69 | /*----- Magical numbers ---------------------------------------------------*/ |
70 | |
71 | #define NOEKEON_BLKSZ 16 |
72 | #define NOEKEON_KEYSZ 16 |
73 | #define NOEKEON_CLASS (N, B, 128) |
74 | |
75 | extern const octet noekeon_keysz[]; |
76 | |
77 | /*----- Data structures ---------------------------------------------------*/ |
78 | |
79 | typedef struct noekeon_ctx { |
80 | uint32 k[4]; |
81 | } noekeon_ctx; |
82 | |
83 | /*----- Functions provided ------------------------------------------------*/ |
84 | |
85 | /* --- @noekeon_init@ --- * |
86 | * |
87 | * Arguments: @noekeon_ctx *k@ = pointer to context to initialize |
88 | * @const void *buf@ = pointer to buffer of key material |
89 | * @size_t sz@ = size of the key material |
90 | * |
91 | * Returns: --- |
92 | * |
93 | * Use: Initializes a Noekeon context with a particular key. This |
94 | * uses indirect keying. The key must be 128 bits long. |
95 | */ |
96 | |
97 | extern void noekeon_init(noekeon_ctx */*k*/, |
98 | const void */*buf*/, size_t /*sz*/); |
99 | |
100 | /* --- @noekeon_eblk@, @noekeon_dblk@ --- * |
101 | * |
102 | * Arguments: @const noekeon_ctx *k@ = pointer to Noekeon context |
103 | * @const uint32 s[4]@ = pointer to source block |
104 | * @uint32 d[4]@ = pointer to destination block |
105 | * |
106 | * Returns: --- |
107 | * |
108 | * Use: Low-level block encryption and decryption. |
109 | */ |
110 | |
111 | extern void noekeon_eblk(const noekeon_ctx */*k*/, |
112 | const uint32 */*s*/, uint32 */*dst*/); |
113 | extern void noekeon_dblk(const noekeon_ctx */*k*/, |
114 | const uint32 */*s*/, uint32 */*dst*/); |
115 | |
116 | /*----- That's all, folks -------------------------------------------------*/ |
117 | |
118 | #ifdef __cplusplus |
119 | } |
120 | #endif |
121 | |
122 | #endif |