projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(mpx_udiv): Fix bug in quotient digit estimation.
[u/mdw/catacomb]
/
rc5.c
diff --git
a/rc5.c
b/rc5.c
index
5d03be7
..
a1cae70
100644
(file)
--- a/
rc5.c
+++ b/
rc5.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: rc5.c,v 1.
1 1999/09/03 08:41:12
mdw Exp $
+ * $Id: rc5.c,v 1.
2 2000/06/17 11:56:00
mdw Exp $
*
* The RC5-32/12 block cipher
*
*
* The RC5-32/12 block cipher
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: rc5.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: rc5.c,v $
+ * Revision 1.2 2000/06/17 11:56:00 mdw
+ * New key size interface. Use secure arena for memory allocation.
+ *
* Revision 1.1 1999/09/03 08:41:12 mdw
* Initial import.
*
* Revision 1.1 1999/09/03 08:41:12 mdw
* Initial import.
*
@@
-44,12
+47,16
@@
#include <mLib/alloc.h>
#include <mLib/bits.h>
#include <mLib/alloc.h>
#include <mLib/bits.h>
+#include "arena.h"
#include "blkc.h"
#include "blkc.h"
+#include "gcipher.h"
#include "rc5.h"
#include "rc5.h"
-/*-----
Internal magical constants
----------------------------------------*/
+/*-----
Global variables ----------
----------------------------------------*/
-#define RC5_ROUNDS 12
+const octet rc5_keysz[] = { KSZ_RANGE, RC5_KEYSZ, 1, 255, 1 };
+
+/*----- Internal magical constants ----------------------------------------*/
#define T ((RC5_ROUNDS + 1) * 2)
#define P 0xb7e15163
#define T ((RC5_ROUNDS + 1) * 2)
#define P 0xb7e15163
@@
-78,7
+85,7
@@
void rc5_init(rc5_ctx *k, const void *sbuf, size_t sz)
* This is slightly unfortunately defined.
*/
* This is slightly unfortunately defined.
*/
-
assert(((void)"RC5 does not support zero-length keys", sz != 0)
);
+
KSZ_ASSERT(rc5, sz
);
{
int i;
{
int i;
@@
-87,7
+94,7
@@
void rc5_init(rc5_ctx *k, const void *sbuf, size_t sz)
/* --- Create the buffer --- */
w = (sz + 3) / 4;
/* --- Create the buffer --- */
w = (sz + 3) / 4;
- l =
xmalloc
(w * sizeof(uint32));
+ l =
XS_ALLOC
(w * sizeof(uint32));
/* --- Extract the key material --- */
/* --- Extract the key material --- */
@@
-137,7
+144,8
@@
void rc5_init(rc5_ctx *k, const void *sbuf, size_t sz)
}
}
}
}
- free(l);
+ memset(l, 0, w * sizeof(uint32));
+ XS_FREE(l);
}
/* --- @EROUND@, @DROUND@ --- */
}
/* --- @EROUND@, @DROUND@ --- */