tags 391516 + patch
quit
On Mon, Oct 16, 2006 at 12:49:39AM +0200, Stefan Westerfeld wrote:
> I can confirm that the problem exists on Debian/AMD64. Maybe this link
> which I found with google helps to solve the problem:
>
> http://lists.freebsd.org/pipermail/freebsd-amd64/2005-January/003173.html
>
> The mail refers to a freebsd cfs tarball which was modified to be 64bit
> clean. Probably the relevant changes made to that version of cfs could
> be backfolded into the Debian package.
Hi Stefan, thanks a lot for this pointer. I found a patch that needs
just slight modifications to apply to the Debian package source.
Regards, Gerrit.
Index: cfs.h
===================================================================
RCS file: /cvs/cfs/cfs.h,v
retrieving revision 1.4
diff -u -r1.4 cfs.h
--- cfs.h 31 Mar 2002 14:59:52 -0000 1.4
+++ cfs.h 16 Oct 2006 10:06:29 -0000
@@ -23,6 +23,8 @@
#include "safer.h"
#include "cfs_bf.h"
+#include <inttypes.h>
+
#define H_REG 0
#define H_ATTACH 0 /* same as regular */
#define H_ROOT 1
@@ -57,10 +59,10 @@
u_char magic[8];/* 0x0123456789abcdef */
u_short htype; /* 0=reg, 1=attachpt, 2=root(but notused) */
u_short instance; /* which attach */
- u_long fileid; /* inode # */
+ uint32_t fileid; /* inode # */
u_char check[8];/* we just encrypt the date and copy it here */
#ifdef SHORTLINKS
- u_long linkid; /* To uniquify short links */
+ uint32_t linkid; /* To uniquify short links */
u_char pad[4]; /* empty */
#else
u_char pad[8]; /* empty */
Index: cfs_bf.h
===================================================================
RCS file: /cvs/cfs/cfs_bf.h,v
retrieving revision 1.2
diff -u -r1.2 cfs_bf.h
--- cfs_bf.h 8 Oct 2001 03:10:18 -0000 1.2
+++ cfs_bf.h 16 Oct 2006 10:06:29 -0000
@@ -70,7 +70,7 @@
* the Alpha, otherwise they will not. Strangly using the '8 byte'
* BF_LONG and the default 'non-pointer' inner loop is the best configuration
* for the Alpha */
-#define BF_LONG unsigned long
+#define BF_LONG unsigned int
#define BF_ROUNDS 16
#define BF_BLOCK 8
Index: cfs_des.c
===================================================================
RCS file: /cvs/cfs/cfs_des.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cfs_des.c
--- cfs_des.c 8 Oct 2001 02:24:39 -0000 1.1.1.1
+++ cfs_des.c 16 Oct 2006 10:06:31 -0000
@@ -22,13 +22,15 @@
* block_cipher(key, block, decrypting)
*/
+#include <inttypes.h>
+
#ifdef SOLARIS2X
#define bcopy(s, d, l) memcpy(d, s, l)
#define bcmp(s, d, l) (memcmp(s, d, l)? 1 : 0)
#endif
-static long ip_low();
-static long ip_high();
+static int32_t ip_low();
+static int32_t ip_high();
static void fp();
void des_key_setup();
@@ -36,7 +38,7 @@
* Tables for Combined S and P Boxes
*/
-static long s0p[] = {
+static int32_t s0p[] = {
0x00410100,0x00010000,0x40400000,0x40410100,0x00400000,0x40010100,0x40010000,0x40400000,
0x40010100,0x00410100,0x00410000,0x40000100,0x40400100,0x00400000,0x00000000,0x40010000,
0x00010000,0x40000000,0x00400100,0x00010100,0x40410100,0x00410000,0x40000100,0x00400100,
@@ -47,7 +49,7 @@
0x00010000,0x00400000,0x40400100,0x00410100,0x40000000,0x40410000,0x00000100,0x40010100,
};
-static long s1p[] = {
+static int32_t s1p[] = {
0x08021002,0x00000000,0x00021000,0x08020000,0x08000002,0x00001002,0x08001000,0x00021000,
0x00001000,0x08020002,0x00000002,0x08001000,0x00020002,0x08021000,0x08020000,0x00000002,
0x00020000,0x08001002,0x08020002,0x00001000,0x00021002,0x08000000,0x00000000,0x00020002,
@@ -58,7 +60,7 @@
0x08020002,0x00020000,0x00001002,0x08001000,0x08001002,0x00000002,0x08020000,0x00021000,
};
-static long s2p[] = {
+static int32_t s2p[] = {
0x20800000,0x00808020,0x00000020,0x20800020,0x20008000,0x00800000,0x20800020,0x00008020,
0x00800020,0x00008000,0x00808000,0x20000000,0x20808020,0x20000020,0x20000000,0x20808000,
0x00000000,0x20008000,0x00808020,0x00000020,0x20000020,0x20808020,0x00008000,0x20800000,
@@ -69,7 +71,7 @@
0x00800020,0x00000000,0x20808000,0x20000020,0x20800000,0x20008020,0x00000020,0x00808000,
};
-static long s3p[] = {
+static int32_t s3p[] = {
0x00080201,0x02000200,0x00000001,0x02080201,0x00000000,0x02080000,0x02000201,0x00080001,
0x02080200,0x02000001,0x02000000,0x00000201,0x02000001,0x00080201,0x00080000,0x02000000,
0x02080001,0x00080200,0x00000200,0x00000001,0x00080200,0x02000201,0x02080000,0x00000200,
@@ -80,7 +82,7 @@
0x00080001,0x00080200,0x02080000,0x02000201,0x00000201,0x02000000,0x02000001,0x02080200,
};
-static long s4p[] = {
+static int32_t s4p[] = {
0x01000000,0x00002000,0x00000080,0x01002084,0x01002004,0x01000080,0x00002084,0x01002000,
0x00002000,0x00000004,0x01000004,0x00002080,0x01000084,0x01002004,0x01002080,0x00000000,
0x00002080,0x01000000,0x00002004,0x00000084,0x01000080,0x00002084,0x00000000,0x01000004,
@@ -91,7 +93,7 @@
0x00002080,0x01002004,0x01000080,0x00000084,0x00000004,0x00002084,0x01002000,0x01000004,
};
-static long s5p[] = {
+static int32_t s5p[] = {
0x10000008,0x00040008,0x00000000,0x10040400,0x00040008,0x00000400,0x10000408,0x00040000,
0x00000408,0x10040408,0x00040400,0x10000000,0x10000400,0x10000008,0x10040000,0x00040408,
0x00040000,0x10000408,0x10040008,0x00000000,0x00000400,0x00000008,0x10040400,0x10040008,
@@ -102,7 +104,7 @@
0x00000400,0x10000008,0x10000408,0x10040400,0x10040000,0x00000408,0x00000008,0x10040008,
};
-static long s6p[] = {
+static int32_t s6p[] = {
0x00000800,0x00000040,0x00200040,0x80200000,0x80200840,0x80000800,0x00000840,0x00000000,
0x00200000,0x80200040,0x80000040,0x00200800,0x80000000,0x00200840,0x00200800,0x80000040,
0x80200040,0x00000800,0x80000800,0x80200840,0x00000000,0x00200040,0x80200000,0x00000840,
@@ -113,7 +115,7 @@
0x00200840,0x80000000,0x80000800,0x80200840,0x80200000,0x00200840,0x00200800,0x80000800,
};
-static long s7p[] = {
+static int32_t s7p[] = {
0x04100010,0x04104000,0x00004010,0x00000000,0x04004000,0x00100010,0x04100000,0x04104010,
0x00000010,0x04000000,0x00104000,0x00004010,0x00104010,0x04004010,0x04000010,0x04100000,
0x00004000,0x00104010,0x00100010,0x04004000,0x04104010,0x04000010,0x00000000,0x00104000,
@@ -134,8 +136,8 @@
int decrypting;
{
register char *key;
- register long temp;
- register long left, right;
+ register int32_t temp;
+ register int32_t left, right;
register i;
register key_offset;
int j,k;
@@ -199,8 +201,8 @@
int decrypting;
{
register char *key;
- register long temp;
- register long left, right;
+ register int32_t temp;
+ register int32_t left, right;
register i;
register key_offset;
@@ -240,78 +242,78 @@
/*
* Final Permutation
*/
-static long fph0[16] = {
+static int32_t fph0[16] = {
0x00000000,0x40000000,0x00400000,0x40400000,0x00004000,0x40004000,0x00404000,0x40404000,
0x00000040,0x40000040,0x00400040,0x40400040,0x00004040,0x40004040,0x00404040,0x40404040,
};
-static long fpl1[16] = {
+static int32_t fpl1[16] = {
0x00000000,0x40000000,0x00400000,0x40400000,0x00004000,0x40004000,0x00404000,0x40404000,
0x00000040,0x40000040,0x00400040,0x40400040,0x00004040,0x40004040,0x00404040,0x40404040,
};
-static long fph2[16] = {
+static int32_t fph2[16] = {
0x00000000,0x10000000,0x00100000,0x10100000,0x00001000,0x10001000,0x00101000,0x10101000,
0x00000010,0x10000010,0x00100010,0x10100010,0x00001010,0x10001010,0x00101010,0x10101010,
};
-static long fpl3[16] = {
+static int32_t fpl3[16] = {
0x00000000,0x10000000,0x00100000,0x10100000,0x00001000,0x10001000,0x00101000,0x10101000,
0x00000010,0x10000010,0x00100010,0x10100010,0x00001010,0x10001010,0x00101010,0x10101010,
};
-static long fph4[16] = {
+static int32_t fph4[16] = {
0x00000000,0x04000000,0x00040000,0x04040000,0x00000400,0x04000400,0x00040400,0x04040400,
0x00000004,0x04000004,0x00040004,0x04040004,0x00000404,0x04000404,0x00040404,0x04040404,
};
-static long fpl5[16] = {
+static int32_t fpl5[16] = {
0x00000000,0x04000000,0x00040000,0x04040000,0x00000400,0x04000400,0x00040400,0x04040400,
0x00000004,0x04000004,0x00040004,0x04040004,0x00000404,0x04000404,0x00040404,0x04040404,
};
-static long fph6[16] = {
+static int32_t fph6[16] = {
0x00000000,0x01000000,0x00010000,0x01010000,0x00000100,0x01000100,0x00010100,0x01010100,
0x00000001,0x01000001,0x00010001,0x01010001,0x00000101,0x01000101,0x00010101,0x01010101,
};
-static long fpl7[16] = {
+static int32_t fpl7[16] = {
0x00000000,0x01000000,0x00010000,0x01010000,0x00000100,0x01000100,0x00010100,0x01010100,
0x00000001,0x01000001,0x00010001,0x01010001,0x00000101,0x01000101,0x00010101,0x01010101,
};
-static long fph8[16] = {
+static int32_t fph8[16] = {
0x00000000,0x80000000,0x00800000,0x80800000,0x00008000,0x80008000,0x00808000,0x80808000,
0x00000080,0x80000080,0x00800080,0x80800080,0x00008080,0x80008080,0x00808080,0x80808080,
};
-static long fpl9[16] = {
+static int32_t fpl9[16] = {
0x00000000,0x80000000,0x00800000,0x80800000,0x00008000,0x80008000,0x00808000,0x80808000,
0x00000080,0x80000080,0x00800080,0x80800080,0x00008080,0x80008080,0x00808080,0x80808080,
};
-static long fpha[16] = {
+static int32_t fpha[16] = {
0x00000000,0x20000000,0x00200000,0x20200000,0x00002000,0x20002000,0x00202000,0x20202000,
0x00000020,0x20000020,0x00200020,0x20200020,0x00002020,0x20002020,0x00202020,0x20202020,
};
-static long fplb[16] = {
+static int32_t fplb[16] = {
0x00000000,0x20000000,0x00200000,0x20200000,0x00002000,0x20002000,0x00202000,0x20202000,
0x00000020,0x20000020,0x00200020,0x20200020,0x00002020,0x20002020,0x00202020,0x20202020,
};
-static long fphc[16] = {
+static int32_t fphc[16] = {
0x00000000,0x08000000,0x00080000,0x08080000,0x00000800,0x08000800,0x00080800,0x08080800,
0x00000008,0x08000008,0x00080008,0x08080008,0x00000808,0x08000808,0x00080808,0x08080808,
};
-static long fpld[16] = {
+static int32_t fpld[16] = {
0x00000000,0x08000000,0x00080000,0x08080000,0x00000800,0x08000800,0x00080800,0x08080800,
0x00000008,0x08000008,0x00080008,0x08080008,0x00000808,0x08000808,0x00080808,0x08080808,
};
-static long fphe[16] = {
+static int32_t fphe[16] = {
0x00000000,0x02000000,0x00020000,0x02020000,0x00000200,0x02000200,0x00020200,0x02020200,
0x00000002,0x02000002,0x00020002,0x02020002,0x00000202,0x02000202,0x00020202,0x02020202,
};
-static long fplf[16] = {
+static int32_t fplf[16] = {
0x00000000,0x02000000,0x00020000,0x02020000,0x00000200,0x02000200,0x00020200,0x02020200,
0x00000002,0x02000002,0x00020002,0x02020002,0x00000202,0x02000202,0x00020202,0x02020202,
};
static void
fp(left, right, text)
-long left, right;
+int32_t left, right;
char text[8];
{
- register unsigned long low, high;
- register unsigned long temp;
+ register uint32_t low, high;
+ register uint32_t temp;
temp = left;
high = fph0[temp & 0xf];
@@ -358,140 +360,140 @@
/*
* Initial Permutation
*/
-static long ipl0[16] = {
+static int32_t ipl0[16] = {
0x00000000,
0x00008000,0x00000000,0x00008000,0x00000080,0x00008080,0x00000080,0x00008080,0x00000000,
0x00008000,0x00000000,0x00008000,0x00000080,0x00008080,0x00000080,0x00008080,};
-static long iph0[16] = {
+static int32_t iph0[16] = {
0x00000000,
0x00000000,0x00008000,0x00008000,0x00000000,0x00000000,0x00008000,0x00008000,0x00000080,
0x00000080,0x00008080,0x00008080,0x00000080,0x00000080,0x00008080,0x00008080,};
-static long ipl1[16] = {
+static int32_t ipl1[16] = {
0x00000000,
0x80000000,0x00000000,0x80000000,0x00800000,0x80800000,0x00800000,0x80800000,0x00000000,
0x80000000,0x00000000,0x80000000,0x00800000,0x80800000,0x00800000,0x80800000,};
-static long iph1[16] = {
+static int32_t iph1[16] = {
0x00000000,
0x00000000,0x80000000,0x80000000,0x00000000,0x00000000,0x80000000,0x80000000,0x00800000,
0x00800000,0x80800000,0x80800000,0x00800000,0x00800000,0x80800000,0x80800000,};
-static long ipl2[16] = {
+static int32_t ipl2[16] = {
0x00000000,
0x00004000,0x00000000,0x00004000,0x00000040,0x00004040,0x00000040,0x00004040,0x00000000,
0x00004000,0x00000000,0x00004000,0x00000040,0x00004040,0x00000040,0x00004040,};
-static long iph2[16] = {
+static int32_t iph2[16] = {
0x00000000,
0x00000000,0x00004000,0x00004000,0x00000000,0x00000000,0x00004000,0x00004000,0x00000040,
0x00000040,0x00004040,0x00004040,0x00000040,0x00000040,0x00004040,0x00004040,};
-static long ipl3[16] = {
+static int32_t ipl3[16] = {
0x00000000,
0x40000000,0x00000000,0x40000000,0x00400000,0x40400000,0x00400000,0x40400000,0x00000000,
0x40000000,0x00000000,0x40000000,0x00400000,0x40400000,0x00400000,0x40400000,};
-static long iph3[16] = {
+static int32_t iph3[16] = {
0x00000000,
0x00000000,0x40000000,0x40000000,0x00000000,0x00000000,0x40000000,0x40000000,0x00400000,
0x00400000,0x40400000,0x40400000,0x00400000,0x00400000,0x40400000,0x40400000,};
-static long ipl4[16] = {
+static int32_t ipl4[16] = {
0x00000000,
0x00002000,0x00000000,0x00002000,0x00000020,0x00002020,0x00000020,0x00002020,0x00000000,
0x00002000,0x00000000,0x00002000,0x00000020,0x00002020,0x00000020,0x00002020,};
-static long iph4[16] = {
+static int32_t iph4[16] = {
0x00000000,
0x00000000,0x00002000,0x00002000,0x00000000,0x00000000,0x00002000,0x00002000,0x00000020,
0x00000020,0x00002020,0x00002020,0x00000020,0x00000020,0x00002020,0x00002020,};
-static long ipl5[16] = {
+static int32_t ipl5[16] = {
0x00000000,
0x20000000,0x00000000,0x20000000,0x00200000,0x20200000,0x00200000,0x20200000,0x00000000,
0x20000000,0x00000000,0x20000000,0x00200000,0x20200000,0x00200000,0x20200000,};
-static long iph5[16] = {
+static int32_t iph5[16] = {
0x00000000,
0x00000000,0x20000000,0x20000000,0x00000000,0x00000000,0x20000000,0x20000000,0x00200000,
0x00200000,0x20200000,0x20200000,0x00200000,0x00200000,0x20200000,0x20200000,};
-static long ipl6[16] = {
+static int32_t ipl6[16] = {
0x00000000,
0x00001000,0x00000000,0x00001000,0x00000010,0x00001010,0x00000010,0x00001010,0x00000000,
0x00001000,0x00000000,0x00001000,0x00000010,0x00001010,0x00000010,0x00001010,};
-static long iph6[16] = {
+static int32_t iph6[16] = {
0x00000000,
0x00000000,0x00001000,0x00001000,0x00000000,0x00000000,0x00001000,0x00001000,0x00000010,
0x00000010,0x00001010,0x00001010,0x00000010,0x00000010,0x00001010,0x00001010,};
-static long ipl7[16] = {
+static int32_t ipl7[16] = {
0x00000000,
0x10000000,0x00000000,0x10000000,0x00100000,0x10100000,0x00100000,0x10100000,0x00000000,
0x10000000,0x00000000,0x10000000,0x00100000,0x10100000,0x00100000,0x10100000,};
-static long iph7[16] = {
+static int32_t iph7[16] = {
0x00000000,
0x00000000,0x10000000,0x10000000,0x00000000,0x00000000,0x10000000,0x10000000,0x00100000,
0x00100000,0x10100000,0x10100000,0x00100000,0x00100000,0x10100000,0x10100000,};
-static long ipl8[16] = {
+static int32_t ipl8[16] = {
0x00000000,
0x00000800,0x00000000,0x00000800,0x00000008,0x00000808,0x00000008,0x00000808,0x00000000,
0x00000800,0x00000000,0x00000800,0x00000008,0x00000808,0x00000008,0x00000808,};
-static long iph8[16] = {
+static int32_t iph8[16] = {
0x00000000,
0x00000000,0x00000800,0x00000800,0x00000000,0x00000000,0x00000800,0x00000800,0x00000008,
0x00000008,0x00000808,0x00000808,0x00000008,0x00000008,0x00000808,0x00000808,};
-static long ipl9[16] = {
+static int32_t ipl9[16] = {
0x00000000,
0x08000000,0x00000000,0x08000000,0x00080000,0x08080000,0x00080000,0x08080000,0x00000000,
0x08000000,0x00000000,0x08000000,0x00080000,0x08080000,0x00080000,0x08080000,};
-static long iph9[16] = {
+static int32_t iph9[16] = {
0x00000000,
0x00000000,0x08000000,0x08000000,0x00000000,0x00000000,0x08000000,0x08000000,0x00080000,
0x00080000,0x08080000,0x08080000,0x00080000,0x00080000,0x08080000,0x08080000,};
-static long ipla[16] = {
+static int32_t ipla[16] = {
0x00000000,
0x00000400,0x00000000,0x00000400,0x00000004,0x00000404,0x00000004,0x00000404,0x00000000,
0x00000400,0x00000000,0x00000400,0x00000004,0x00000404,0x00000004,0x00000404,};
-static long ipha[16] = {
+static int32_t ipha[16] = {
0x00000000,
0x00000000,0x00000400,0x00000400,0x00000000,0x00000000,0x00000400,0x00000400,0x00000004,
0x00000004,0x00000404,0x00000404,0x00000004,0x00000004,0x00000404,0x00000404,};
-static long iplb[16] = {
+static int32_t iplb[16] = {
0x00000000,
0x04000000,0x00000000,0x04000000,0x00040000,0x04040000,0x00040000,0x04040000,0x00000000,
0x04000000,0x00000000,0x04000000,0x00040000,0x04040000,0x00040000,0x04040000,};
-static long iphb[16] = {
+static int32_t iphb[16] = {
0x00000000,
0x00000000,0x04000000,0x04000000,0x00000000,0x00000000,0x04000000,0x04000000,0x00040000,
0x00040000,0x04040000,0x04040000,0x00040000,0x00040000,0x04040000,0x04040000,};
-static long iplc[16] = {
+static int32_t iplc[16] = {
0x00000000,
0x00000200,0x00000000,0x00000200,0x00000002,0x00000202,0x00000002,0x00000202,0x00000000,
0x00000200,0x00000000,0x00000200,0x00000002,0x00000202,0x00000002,0x00000202,};
-static long iphc[16] = {
+static int32_t iphc[16] = {
0x00000000,
0x00000000,0x00000200,0x00000200,0x00000000,0x00000000,0x00000200,0x00000200,0x00000002,
0x00000002,0x00000202,0x00000202,0x00000002,0x00000002,0x00000202,0x00000202,};
-static long ipld[16] = {
+static int32_t ipld[16] = {
0x00000000,
0x02000000,0x00000000,0x02000000,0x00020000,0x02020000,0x00020000,0x02020000,0x00000000,
0x02000000,0x00000000,0x02000000,0x00020000,0x02020000,0x00020000,0x02020000,};
-static long iphd[16] = {
+static int32_t iphd[16] = {
0x00000000,
0x00000000,0x02000000,0x02000000,0x00000000,0x00000000,0x02000000,0x02000000,0x00020000,
0x00020000,0x02020000,0x02020000,0x00020000,0x00020000,0x02020000,0x02020000,};
-static long iple[16] = {
+static int32_t iple[16] = {
0x00000000,
0x00000100,0x00000000,0x00000100,0x00000001,0x00000101,0x00000001,0x00000101,0x00000000,
0x00000100,0x00000000,0x00000100,0x00000001,0x00000101,0x00000001,0x00000101,};
-static long iphe[16] = {
+static int32_t iphe[16] = {
0x00000000,
0x00000000,0x00000100,0x00000100,0x00000000,0x00000000,0x00000100,0x00000100,0x00000001,
0x00000001,0x00000101,0x00000101,0x00000001,0x00000001,0x00000101,0x00000101,};
-static long iplf[16] = {
+static int32_t iplf[16] = {
0x00000000,
0x01000000,0x00000000,0x01000000,0x00010000,0x01010000,0x00010000,0x01010000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00010000,0x01010000,0x00010000,0x01010000,};
-static long iphf[16] = {
+static int32_t iphf[16] = {
0x00000000,
0x00000000,0x01000000,0x01000000,0x00000000,0x00000000,0x01000000,0x01000000,0x00010000,
0x00010000,0x01010000,0x01010000,0x00010000,0x00010000,0x01010000,0x01010000,};
-static long
+static int32_t
ip_low(block)
register char block[8];
{
- register long l;
+ register int32_t l;
l = ipl1[block[0] & 0xf];
l |= ipl0[(block[0] >> 4) & 0xf];
@@ -512,11 +514,11 @@
return l;
}
-static long
+static int32_t
ip_high(block)
register char block[8];
{
- register long l;
+ register int32_t l;
l = iph1[block[0] & 0xf];
l |= iph0[(block[0] >> 4) & 0xf];
@@ -962,7 +964,7 @@
int size;
{
int i;
- struct {long fo; char key[9];} s;
+ struct {int32_t fo; char key[9];} s;
bcopy("encrypt!",s.key,8);
Index: cfs_fh.c
===================================================================
RCS file: /cvs/cfs/cfs_fh.c,v
retrieving revision 1.9
diff -u -r1.9 cfs_fh.c
--- cfs_fh.c 11 Jul 2006 21:01:24 -0000 1.9
+++ cfs_fh.c 16 Oct 2006 10:06:32 -0000
@@ -61,7 +61,7 @@
}
#endif
-#define hash(x) ((u_long)((x)&HMASK))
+#define hash(x) ((uint32_t)((x)&HMASK))
int inst = 0;/* starting point */
instance *instances[NINSTANCES];
@@ -135,7 +135,6 @@
int headlen;
int writemore=0;
struct stat sb;
- u_long mask = ~0; /*tells us whether to expand file */
char buf[8216]; /* big enough, may not even need it */
/* first, normalize to the proper boundries */
@@ -833,7 +832,7 @@
char vect[9];
union{
u_char ch[9];
- u_long i[2];
+ uint32_t i[2];
} buf;
char linkname[NFS_MAXPATHLEN+1];
@@ -862,8 +861,8 @@
/*
sprintf((char
*)buf,"%08x",(u_long)sb.st_ino+(u_long)sb.st_ctime);
*/
- buf.i[0]=(u_long)sb.st_ino;
- buf.i[1]=(u_long)sb.st_ctime;
+ buf.i[0]=(uint32_t)sb.st_ino;
+ buf.i[1]=(uint32_t)sb.st_ctime;
q_block_cipher("fixedkey",&buf,1);
/* des is just used here as a hash fn to spread the bits */
/* since we only use 32 bits of the result, its a nonperfect */
@@ -1228,7 +1227,7 @@
break anything */
struct dirent *
rootrd(cookie)
- long cookie;
+ int32_t cookie;
{
static struct dirent d;
Index: cfs_nfs.c
===================================================================
RCS file: /cvs/cfs/cfs_nfs.c,v
retrieving revision 1.3
diff -u -r1.3 cfs_nfs.c
--- cfs_nfs.c 2 Apr 2004 20:14:02 -0000 1.3
+++ cfs_nfs.c 16 Oct 2006 10:06:32 -0000
@@ -843,12 +843,11 @@
static DIR *dp=NULL;
static struct dirent *dent;
entry **prev;
- long loc;
char s1[NFS_MAXNAMLEN+1];
char *s;
cfskey *key;
- static long curcookie=0;
- long cookie;
+ static int32_t curcookie=0;
+ int32_t cookie;
int eof;
int ne;
int bytes;
@@ -910,7 +909,7 @@
else if (strcmp(s,"..")==0) /* parent */
entrytab[ne].fileid=fhpid(h);
else entrytab[ne].fileid=dent->d_fileno;
- *(unsigned long*)entrytab[ne].cookie = htonl(cookie);
+ *(int32_t*)entrytab[ne].cookie = htonl(cookie);
*prev = &entrytab[ne];
prev = &entrytab[ne].nextentry;
entrytab[ne].nextentry=NULL;
@@ -930,12 +929,12 @@
DIR *curdir;
int curdirid=0;
-long curcookie;
+int32_t curcookie;
DIR *
cfsopendir(dir,cookie)
cfs_fileid *dir;
- long cookie;
+ int32_t cookie;
{
DIR *ret;
DIR *fhopendir();
@@ -1115,7 +1114,7 @@
typedef char str[NFS_MAXNAMLEN+1];
static str names[MAXENTRIES];
entry **prev;
- long cookie;
+ int32_t cookie;
int eof;
int ne;
int bytes;
@@ -1127,7 +1126,7 @@
ne=0;
prev= &ret.readdirres_u.reply.entries;
*prev=NULL;
- cookie = ntohl(*(unsigned long*)(ap->cookie));
+ cookie = ntohl(*(int32_t*)(ap->cookie));
eof=1;
ret.status=NFS_OK;
@@ -1146,7 +1145,7 @@
else entrytab[ne].fileid=dent->d_fileno;
cookie=dent->d_reclen; /* may not work everywhere */
*prev = &entrytab[ne];
- *(unsigned long*)entrytab[ne].cookie = htonl(cookie);
+ *(int32_t*)entrytab[ne].cookie = htonl(cookie);
prev = &entrytab[ne].nextentry;
entrytab[ne].nextentry=NULL;
ne++;
Index: esm_cipher.c
===================================================================
RCS file: /cvs/cfs/esm_cipher.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 esm_cipher.c
--- esm_cipher.c 8 Oct 2001 02:24:39 -0000 1.1.1.1
+++ esm_cipher.c 16 Oct 2006 10:06:33 -0000
@@ -157,7 +157,7 @@
unsigned int n;
int i;
struct timeval tv;
- unsigned long truerand();
+ uint32_t truerand();
unsigned char b[20];
R_RandomInit(&rs);
Index: shs.c
===================================================================
RCS file: /cvs/cfs/shs.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 shs.c
--- shs.c 8 Oct 2001 02:24:39 -0000 1.1.1.1
+++ shs.c 16 Oct 2006 10:06:33 -0000
@@ -50,9 +50,9 @@
#include <stdio.h>
#include "shs.h"
-static long nbits;
-static unsigned long *h;
-static unsigned long *w;
+static int32_t nbits;
+static uint32_t *h;
+static uint32_t *w;
static void shs1();
/*
static void packl (unsigned long);
@@ -61,7 +61,7 @@
static void opack(unsigned char);
*/
-#define MASK (unsigned long)0xffffffffL /* in case more than 32
bits per long */
+#define MASK (uint32_t)0xffffffffL /* in case more than 32 bits
per long */
/*
* stick one byte into the current block; process the block when full
@@ -70,14 +70,14 @@
unsigned char c;
{
int n32, nd32, shiftbits;
- register unsigned long x, mask, y;
+ register uint32_t x, mask, y;
nd32 = (int)(nbits >> 5); /* nbits/32 */
n32 = (int)(nbits & 0x1f); /* nbits%32 */
shiftbits = 24-n32;
- x = (unsigned long)(c<<shiftbits);
- mask = (unsigned long)(0xff << shiftbits);
+ x = (uint32_t)(c<<shiftbits);
+ mask = (uint32_t)(0xff << shiftbits);
mask = ~mask;
y = w[nd32];
@@ -97,7 +97,7 @@
int nd32;
nd32 = (int)(nbits >> 5);
- w[nd32] = (u_long)(((u_long)c0<<24) | ((u_long)c1<<16) |
((u_long)c2<<8) | (u_long)c3);
+ w[nd32] = (uint32_t)(((uint32_t)c0<<24) | ((uint32_t)c1<<16) |
((uint32_t)c2<<8) | (uint32_t)c3);
nbits += 32;
if(nbits==512){
@@ -111,7 +111,7 @@
*/
static void
packl(x)
- unsigned long x;
+ uint32_t x;
{
pack((unsigned char)(x>>24), (unsigned char)(x>>16),
(unsigned char)(x>>8), (unsigned char)(x>>0));
@@ -123,24 +123,24 @@
static void
shs1()
{
- unsigned long *wp;
- unsigned long temp;
- unsigned long A, B, C, D, E;
+ uint32_t *wp;
+ uint32_t temp;
+ uint32_t A, B, C, D, E;
int t;
-#define S(n,x) (u_long)(((x)<<(n))|((MASK&(x))>>(32-(n))))
+#define S(n,x) (uint32_t)(((x)<<(n))|((MASK&(x))>>(32-(n))))
wp = w;
t = 8;
do {
- wp[16] = S(1, (u_long)(wp[13]^wp[8]^wp[2]^wp[0]));
- wp[17] = S(1, (u_long)(wp[14]^wp[9]^wp[3]^wp[1]));
- wp[18] = S(1, (u_long)(wp[15]^wp[10]^wp[4]^wp[2]));
- wp[19] = S(1, (u_long)(wp[16]^wp[11]^wp[5]^wp[3]));
- wp[20] = S(1, (u_long)(wp[17]^wp[12]^wp[6]^wp[4]));
- wp[21] = S(1, (u_long)(wp[18]^wp[13]^wp[7]^wp[5]));
- wp[22] = S(1, (u_long)(wp[19]^wp[14]^wp[8]^wp[6]));
- wp[23] = S(1, (u_long)(wp[20]^wp[15]^wp[9]^wp[7]));
+ wp[16] = S(1, (uint32_t)(wp[13]^wp[8]^wp[2]^wp[0]));
+ wp[17] = S(1, (uint32_t)(wp[14]^wp[9]^wp[3]^wp[1]));
+ wp[18] = S(1, (uint32_t)(wp[15]^wp[10]^wp[4]^wp[2]));
+ wp[19] = S(1, (uint32_t)(wp[16]^wp[11]^wp[5]^wp[3]));
+ wp[20] = S(1, (uint32_t)(wp[17]^wp[12]^wp[6]^wp[4]));
+ wp[21] = S(1, (uint32_t)(wp[18]^wp[13]^wp[7]^wp[5]));
+ wp[22] = S(1, (uint32_t)(wp[19]^wp[14]^wp[8]^wp[6]));
+ wp[23] = S(1, (uint32_t)(wp[20]^wp[15]^wp[9]^wp[7]));
wp += 8;
t--;
} while (t > 0);
@@ -154,22 +154,22 @@
t = 0;
while (t<20) {
temp = S(5,A) + E + w[t++];
- temp += (unsigned long)0x5a827999L + ((B&C)|(D&~B));
+ temp += (uint32_t)0x5a827999L + ((B&C)|(D&~B));
E = D; D = C; C = S(30,B); B = A; A = temp;
}
while (t<40) {
temp = S(5,A) + E + w[t++];
- temp += (unsigned long)0x6ed9eba1L + (B^C^D);
+ temp += (uint32_t)0x6ed9eba1L + (B^C^D);
E = D; D = C; C = S(30,B); B = A; A = temp;
}
while (t<60) {
temp = S(5,A) + E + w[t++];
- temp += (unsigned long)0x8f1bbcdcL + ((B&C)|(B&D)|(C&D));
+ temp += (uint32_t)0x8f1bbcdcL + ((B&C)|(B&D)|(C&D));
E = D; D = C; C = S(30,B); B = A; A = temp;
}
while (t<80) {
temp = S(5,A) + E + w[t++];
- temp += (unsigned long)0xca62c1d6L + (B^C^D);
+ temp += (uint32_t)0xca62c1d6L + (B^C^D);
E = D; D = C; C = S(30,B); B = A; A = temp;
}
h[0] = MASK&(h[0] + A);
@@ -179,7 +179,7 @@
h[4] = MASK&(h[4] + E);
}
-#define CHARSTOLONG(wp,s,i) {*wp++ =
(u_long)((((u_long)(s[i])&0xff)<<24)|(((u_long)(s[i+1])&0xff)<<16)|(((u_long)(s[i+2])&0xff)<<8)|(u_long)(s[i+3]&0xff));}
+#define CHARSTOLONG(wp,s,i) {*wp++ =
(uint32_t)((((uint32_t)(s[i])&0xff)<<24)|(((uint32_t)(s[i+1])&0xff)<<16)|(((uint32_t)(s[i+2])&0xff)<<8)|(uint32_t)(s[i+3]&0xff));}
void
@@ -187,11 +187,11 @@
SHS_CTX *mdContext;
{
nbits = 0;
- mdContext->h[0] = (unsigned long)0x67452301L;
- mdContext->h[1] = (unsigned long)0xefcdab89L;
- mdContext->h[2] = (unsigned long)0x98badcfeL;
- mdContext->h[3] = (unsigned long)0x10325476L;
- mdContext->h[4] = (unsigned long)0xc3d2e1f0L;
+ mdContext->h[0] = (uint32_t)0x67452301L;
+ mdContext->h[1] = (uint32_t)0xefcdab89L;
+ mdContext->h[2] = (uint32_t)0x98badcfeL;
+ mdContext->h[3] = (uint32_t)0x10325476L;
+ mdContext->h[4] = (uint32_t)0xc3d2e1f0L;
mdContext->totalLength = 0;
}
@@ -202,16 +202,16 @@
unsigned char *s;
unsigned int n;
{
- register unsigned long *wp;
- long nn = n;
- long i;
+ register uint32_t *wp;
+ int32_t nn = n;
+ int32_t i;
w = mdContext->w;
h = mdContext->h;
mdContext->totalLength += n;
nbits = 0;
- n = n/(u_long)64;
+ n = n/(uint32_t)64;
wp = w;
while(n>0){
@@ -240,7 +240,7 @@
while(i>3) {
CHARSTOLONG(wp,s,0);
s = (s + 4);
- nbits += (u_long)32;
+ nbits += (uint32_t)32;
i -= 4;
}
while (i) {
@@ -253,14 +253,14 @@
shsFinal(mdContext)
SHS_CTX *mdContext;
{
- long nn = mdContext->totalLength;
+ int32_t nn = mdContext->totalLength;
w = mdContext->w;
h = mdContext->h;
opack(128);
while(nbits != 448)opack(0);
- packl((unsigned long)(nn>>29));
- packl((unsigned long)(nn<<3));
+ packl((uint32_t)(nn>>29));
+ packl((uint32_t)(nn<<3));
/* if(nbits != 0)
handle_exception(CRITICAL,"shsFinal(): nbits != 0\n");*/
@@ -269,7 +269,7 @@
unsigned char *
qshs(s, n)
unsigned char *s;
- long n;
+ int32_t n;
{
SHS_CTX *mdContext;
static SHS_CTX mdC;
@@ -291,6 +291,7 @@
return ret;
}
+#if 0 /* This doesn't work and isn't used. */
/*int fread(char *, int, int, FILE *);*/
unsigned long *
@@ -316,6 +317,5 @@
return mdContext->h;
}
-
-
+#endif
Index: shs.h
===================================================================
RCS file: /cvs/cfs/shs.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 shs.h
--- shs.h 8 Oct 2001 02:24:39 -0000 1.1.1.1
+++ shs.h 16 Oct 2006 10:06:33 -0000
@@ -1,7 +1,9 @@
+#include <inttypes.h>
+
typedef struct {
- long totalLength;
- unsigned long h[5];
- unsigned long w[80];
+ int32_t totalLength;
+ uint32_t h[5];
+ uint32_t w[80];
} SHS_CTX;
unsigned char *qshs();
Index: truerand.c
===================================================================
RCS file: /cvs/cfs/truerand.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 truerand.c
--- truerand.c 8 Oct 2001 02:27:34 -0000 1.1.1.2
+++ truerand.c 16 Oct 2006 10:06:33 -0000
@@ -89,6 +89,8 @@
#include <math.h>
#include <stdio.h>
+#include <inttypes.h>
+
static jmp_buf env;
static unsigned count;
static unsigned ocount;
@@ -115,7 +117,7 @@
tick();
}
-static unsigned long
+static uint32_t
roulette()
{
if (setjmp(env))
@@ -131,15 +133,15 @@
* basic interface to 32 bit truerand.
* note that any scheduled SIGALRM will be delayed by about .3 secs.
*/
-unsigned long
+uint32_t
raw_truerand()
{
void (*oldalrm)();
struct itimerval it;
- unsigned long counts[12];
+ uint32_t counts[12];
unsigned char *qshs();
unsigned char *r;
- unsigned long buf;
+ uint32_t buf;
int i;
getitimer(ITIMER_REAL, &it);
@@ -153,7 +155,7 @@
setitimer(ITIMER_REAL, &it, NULL);
r = qshs(counts,sizeof(counts));
- buf = *((unsigned long *) r);
+ buf = *((uint32_t *) r);
return buf;
}
@@ -182,8 +184,8 @@
* usage:
* unsigned char r8;
* unsigned short r16;
- * unsigned long r32;
- * unsigned long trand8(), trand16(), trand32();
+ * uint32_t r32;
+ * uint32_t trand8(), trand16(), trand32();
* r8=trand8();
* r16=trand16();
* r32=trand32();
@@ -206,11 +208,11 @@
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-unsigned long randbyte()
+uint32_t randbyte()
{
- unsigned long raw_truerand();
+ uint32_t raw_truerand();
unsigned char *qshs();
- unsigned long r[2];
+ uint32_t r[2];
unsigned char *hash;
r[0]=raw_truerand(); r[1]=raw_truerand();
@@ -218,17 +220,17 @@
return ((int) (*hash)) & 0xff;
}
-unsigned long trand8()
+uint32_t trand8()
{
return randbyte();
}
-unsigned long trand16()
+uint32_t trand16()
{
return randbyte() ^ (randbyte()<<8);
}
-unsigned long trand32()
+uint32_t trand32()
{
return randbyte() ^ (randbyte()<<8)
^ (randbyte()<<16) ^ (randbyte()<<24);
Index: debian/changelog
===================================================================
RCS file: /cvs/cfs/debian/changelog,v
retrieving revision 1.38
diff -u -r1.38 changelog
--- debian/changelog 13 Sep 2006 11:49:08 -0000 1.38
+++ debian/changelog 16 Oct 2006 10:06:33 -0000
@@ -1,3 +1,11 @@
+cfs (1.4.1-17.1) unstable; urgency=low
+
+ * apply patch from Ville-Pertti Keinonen to fix type issues on 64bit
+ archs, http://www.freebsd.org/cgi/query-pr.cgi?pr=75878 (closes:
+ #391516, thx Stefan Westerfeld).
+
+ -- Gerrit Pape <[EMAIL PROTECTED]> Mon, 16 Oct 2006 10:05:56 +0000
+
cfs (1.4.1-17) unstable; urgency=high
* cfs_fh.c: doencrypt(), dodecrypt(): make salt unsigned long, not int,