Add an internal-representation no-op function.
[u/mdw/catacomb] / rc5.h
1 /* -*-c-*-
2 *
3 * $Id: rc5.h,v 1.3 2000/06/17 11:55:50 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.3 2000/06/17 11:55:50 mdw
34 * New key size interface. Add notes about the cipher.
35 *
36 * Revision 1.2 1999/12/10 23:29:48 mdw
37 * Change header file guard names.
38 *
39 * Revision 1.1 1999/09/03 08:41:12 mdw
40 * Initial import.
41 *
42 */
43
44 /*----- Notes on the RC5 block cipher -------------------------------------*
45 *
46 * RC5 was designed by Ron Rivest as a test vehicle for the use of data-
47 * dependent rotations in cryptographic transformations. The algorithm is
48 * covered by a patent held by RSA Security Inc. (US Patent# 5,724,428).
49 * It's vulnerable to some clever differential attacks, which can break it in
50 * about %$2^{44}$% chosen plaintexts. I don't recommend the use of this
51 * cipher.
52 */
53
54 #ifndef CATACOMB_RC5_H
55 #define CATACOMB_RC5_H
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 /*----- Header files ------------------------------------------------------*/
62
63 #include <mLib/bits.h>
64
65 /*----- Magic numbers -----------------------------------------------------*/
66
67 #define RC5_ROUNDS 12
68 #define RC5_KEYSZ 10
69 #define RC5_BLKSZ 8
70 #define RC5_CLASS (N, L, 64)
71
72 extern const octet rc5_keysz[];
73
74 /*----- Data structures ---------------------------------------------------*/
75
76 typedef struct rc5_ctx {
77 uint32 s[2 * (RC5_ROUNDS + 1)];
78 } rc5_ctx;
79
80 /*----- Functions provided ------------------------------------------------*/
81
82 /* --- @rc5_init@ --- *
83 *
84 * Arguments: @rc5_ctx *k@ = pointer to a key block
85 * @const void *sbuf@ = pointer to key material
86 * @size_t sz@ = size of the key material
87 *
88 * Returns: ---
89 *
90 * Use: Initializes an RC5 key block.
91 */
92
93 extern void rc5_init(rc5_ctx */*k*/, const void */*sbuf*/, size_t /*sz*/);
94
95 /* --- @rc5_eblk@, @rc5_dblk@ --- *
96 *
97 * Arguments: @const rc5_ctx *k@ = pointer to RC5 context block
98 * @const uint32 s[2]@ = pointer to source block
99 * @uint32 *d[2]@ = pointer to destination block
100 *
101 * Returns: ---
102 *
103 * Use: Low level block encryption and decryption.
104 */
105
106 extern void rc5_eblk(const rc5_ctx */*k*/,
107 const uint32 */*s*/, uint32 */*d*/);
108 extern void rc5_dblk(const rc5_ctx */*k*/,
109 const uint32 */*s*/, uint32 */*d*/);
110
111 /*----- That's all, folks -------------------------------------------------*/
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #endif