3 * The RC5-32/12 block cipher
5 * (c) 1999 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of Catacomb.
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.
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.
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,
28 /*----- Notes on the RC5 block cipher -------------------------------------*
30 * RC5 was designed by Ron Rivest as a test vehicle for the use of data-
31 * dependent rotations in cryptographic transformations. The algorithm is
32 * covered by a patent held by RSA Security Inc. (US Patent# 5,724,428).
33 * It's vulnerable to some clever differential attacks, which can break it in
34 * about %$2^{44}$% chosen plaintexts. I don't recommend the use of this
38 #ifndef CATACOMB_RC5_H
39 #define CATACOMB_RC5_H
45 /*----- Header files ------------------------------------------------------*/
47 #include <mLib/bits.h>
49 /*----- Magic numbers -----------------------------------------------------*/
54 #define RC5_CLASS (N, L, 64)
56 extern const octet rc5_keysz[];
58 /*----- Data structures ---------------------------------------------------*/
60 typedef struct rc5_ctx {
61 uint32 s[2 * (RC5_ROUNDS + 1)];
64 /*----- Functions provided ------------------------------------------------*/
66 /* --- @rc5_init@ --- *
68 * Arguments: @rc5_ctx *k@ = pointer to a key block
69 * @const void *sbuf@ = pointer to key material
70 * @size_t sz@ = size of the key material
74 * Use: Initializes an RC5 key block.
77 extern void rc5_init(rc5_ctx */*k*/, const void */*sbuf*/, size_t /*sz*/);
79 /* --- @rc5_eblk@, @rc5_dblk@ --- *
81 * Arguments: @const rc5_ctx *k@ = pointer to RC5 context block
82 * @const uint32 s[2]@ = pointer to source block
83 * @uint32 *d[2]@ = pointer to destination block
87 * Use: Low level block encryption and decryption.
90 extern void rc5_eblk(const rc5_ctx */*k*/,
91 const uint32 */*s*/, uint32 */*d*/);
92 extern void rc5_dblk(const rc5_ctx */*k*/,
93 const uint32 */*s*/, uint32 */*d*/);
95 /*----- That's all, folks -------------------------------------------------*/