d03ab969 |
1 | /* -*-c-*- |
2 | * |
3 | * $Id: rc5.h,v 1.1 1999/09/03 08:41:12 mdw Exp $ |
4 | * |
5 | * The RC5-32/12 block cipher |
6 | * |
7 | * (c) 1999 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: rc5.h,v $ |
33 | * Revision 1.1 1999/09/03 08:41:12 mdw |
34 | * Initial import. |
35 | * |
36 | */ |
37 | |
38 | #ifndef RC5_H |
39 | #define RC5_H |
40 | |
41 | #ifdef __cplusplus |
42 | extern "C" { |
43 | #endif |
44 | |
45 | /*----- Header files ------------------------------------------------------*/ |
46 | |
47 | #include <mLib/bits.h> |
48 | |
49 | /*----- Magic numbers -----------------------------------------------------*/ |
50 | |
51 | #define RC5_ROUNDS 12 |
52 | #define RC5_KEYSZ 0 |
53 | #define RC5_BLKSZ 8 |
54 | #define RC5_CLASS (N, L, 64) |
55 | |
56 | /*----- Data structures ---------------------------------------------------*/ |
57 | |
58 | typedef struct rc5_ctx { |
59 | uint32 s[2 * (RC5_ROUNDS + 1)]; |
60 | } rc5_ctx; |
61 | |
62 | /*----- Functions provided ------------------------------------------------*/ |
63 | |
64 | /* --- @rc5_init@ --- * |
65 | * |
66 | * Arguments: @rc5_ctx *k@ = pointer to a key block |
67 | * @const void *sbuf@ = pointer to key material |
68 | * @size_t sz@ = size of the key material |
69 | * |
70 | * Returns: --- |
71 | * |
72 | * Use: Initializes an RC5 key block. |
73 | */ |
74 | |
75 | extern void rc5_init(rc5_ctx */*k*/, const void */*sbuf*/, size_t /*sz*/); |
76 | |
77 | /* --- @rc5_eblk@, @rc5_dblk@ --- * |
78 | * |
79 | * Arguments: @const rc5_ctx *k@ = pointer to RC5 context block |
80 | * @const uint32 s[2]@ = pointer to source block |
81 | * @uint32 *d[2]@ = pointer to destination block |
82 | * |
83 | * Returns: --- |
84 | * |
85 | * Use: Low level block encryption and decryption. |
86 | */ |
87 | |
88 | extern void rc5_eblk(const rc5_ctx */*k*/, |
89 | const uint32 */*s*/, uint32 */*d*/); |
90 | extern void rc5_dblk(const rc5_ctx */*k*/, |
91 | const uint32 */*s*/, uint32 */*d*/); |
92 | |
93 | /*----- That's all, folks -------------------------------------------------*/ |
94 | |
95 | #ifdef __cplusplus |
96 | } |
97 | #endif |
98 | |
99 | #endif |