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