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