/* -*-c-*-
*
- * $Id: rc5.c,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: rc5.c,v 1.3 2004/04/08 01:36:15 mdw Exp $
*
* The RC5-32/12 block cipher
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: rc5.c,v $
- * Revision 1.1 1999/09/03 08:41:12 mdw
- * Initial import.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <assert.h>
#include <mLib/alloc.h>
#include <mLib/bits.h>
+#include "arena.h"
#include "blkc.h"
+#include "gcipher.h"
#include "rc5.h"
-/*----- Internal magical constants ----------------------------------------*/
+/*----- Global variables --------------------------------------------------*/
+
+const octet rc5_keysz[] = { KSZ_RANGE, RC5_KEYSZ, 1, 255, 1 };
-#define RC5_ROUNDS 12
+/*----- Internal magical constants ----------------------------------------*/
#define T ((RC5_ROUNDS + 1) * 2)
#define P 0xb7e15163
* This is slightly unfortunately defined.
*/
- assert(((void)"RC5 does not support zero-length keys", sz != 0));
+ KSZ_ASSERT(rc5, sz);
{
int i;
/* --- Create the buffer --- */
w = (sz + 3) / 4;
- l = xmalloc(w * sizeof(uint32));
+ l = XS_ALLOC(w * sizeof(uint32));
/* --- Extract the key material --- */
}
}
- free(l);
+ memset(l, 0, w * sizeof(uint32));
+ XS_FREE(l);
}
/* --- @EROUND@, @DROUND@ --- */