~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pub/keycheck-mp.c (keycheck_prime): Use `pgen_primep' to do the legwork.
[catacomb]
/
symm
/
rc2.c
diff --git
a/symm/rc2.c
b/symm/rc2.c
index
4ea85b6
..
97963fe
100644
(file)
--- a/
symm/rc2.c
+++ b/
symm/rc2.c
@@
-36,7
+36,6
@@
#include "gcipher.h"
#include "paranoia.h"
#include "rc2.h"
#include "gcipher.h"
#include "paranoia.h"
#include "rc2.h"
-#include "rc2-tab.h"
/*----- Global variables --------------------------------------------------*/
/*----- Global variables --------------------------------------------------*/
@@
-44,7
+43,7
@@
const octet rc2_keysz[] = { KSZ_RANGE, RC2_KEYSZ, 1, 128, 1 };
/*----- Important tables --------------------------------------------------*/
/*----- Important tables --------------------------------------------------*/
-
static const octet pi[256] = RC2_PI
;
+
extern const octet rc2_pi[256]
;
/*----- Main code ---------------------------------------------------------*/
/*----- Main code ---------------------------------------------------------*/
@@
-85,15
+84,15
@@
void rc2_braindamage(rc2_ctx *k, const void *buf, size_t sz, unsigned eb)
memcpy(l, buf, sz);
for (i = sz; i < sizeof(l); i++)
memcpy(l, buf, sz);
for (i = sz; i < sizeof(l); i++)
- l[i] = pi[U8(l[i - 1] + l[i - sz])];
+ l[i] =
rc2_
pi[U8(l[i - 1] + l[i - sz])];
/* --- Braindamage the key --- */
i = sizeof(l) - t8;
/* --- Braindamage the key --- */
i = sizeof(l) - t8;
- l[i] = pi[l[i] & tm];
+ l[i] =
rc2_
pi[l[i] & tm];
while (i) {
i--;
while (i) {
i--;
- l[i] = pi[U8(l[i + 1] ^ l[i + t8])];
+ l[i] =
rc2_
pi[U8(l[i + 1] ^ l[i + t8])];
}
/* --- Write it to the key block --- */
}
/* --- Write it to the key block --- */
@@
-251,6
+250,7
@@
void rc2_dblk(const rc2_ctx *k, const uint32 *s, uint32 *dst)
#ifdef TEST_RIG
#ifdef TEST_RIG
+#include <mLib/macros.h>
#include <mLib/quis.h>
#include <mLib/testrig.h>
#include <mLib/quis.h>
#include <mLib/testrig.h>
@@
-277,7
+277,7
@@
static int verify(dstr *v)
BLKC_MOVE(RC2, d, p);
rc2_eblk(&k, d, d);
BLKC_STORE(RC2, b.buf, d);
BLKC_MOVE(RC2, d, p);
rc2_eblk(&k, d, d);
BLKC_STORE(RC2, b.buf, d);
- if (
memcmp(b.buf
, v[3].buf, RC2_BLKSZ)) {
+ if (
MEMCMP(b.buf, !=
, v[3].buf, RC2_BLKSZ)) {
ok = 0;
printf("\nfail encryption:"
"\n\tkey = ");
ok = 0;
printf("\nfail encryption:"
"\n\tkey = ");
@@
-294,7
+294,7
@@
static int verify(dstr *v)
BLKC_MOVE(RC2, d, c);
rc2_dblk(&k, d, d);
BLKC_STORE(RC2, b.buf, d);
BLKC_MOVE(RC2, d, c);
rc2_dblk(&k, d, d);
BLKC_STORE(RC2, b.buf, d);
- if (
memcmp(b.buf
, v[2].buf, RC2_BLKSZ)) {
+ if (
MEMCMP(b.buf, !=
, v[2].buf, RC2_BLKSZ)) {
ok = 0;
printf("\nfail decryption:"
"\n\tkey = ");
ok = 0;
printf("\nfail decryption:"
"\n\tkey = ");