1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-21 20:38:45 +00:00

- Merge and split existing patch-a[a-f] files.

- Fix types issues on 64-bits architectures.

PR:		ports/75878
Submitted by:	Ville-Pertti Keinonen <will@exomi.com>
Approved by:	maintainer timeout (3 months)
This commit is contained in:
Florent Thoumie 2005-04-12 09:06:25 +00:00
parent 2a6230f941
commit 84dee8dde8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=133129
17 changed files with 980 additions and 33 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= cfs
PORTVERSION= 1.4.1
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= security
MASTER_SITES= http://www.crypto.com/software/

View File

@ -1,5 +1,8 @@
--- Makefile.orig Sat Dec 20 10:57:08 1997
+++ Makefile Mon May 22 18:38:56 2000
$FreeBSD$
--- Makefile.orig
+++ Makefile
@@ -74,8 +74,9 @@
#CC=cc
#COPT=-O -DNOT_ANSI_C -DPROTOTYPES=0
@ -12,7 +15,7 @@
#1B: paths:
#some peple like /usr/local/sbin instead of /usr/local/etc
@@ -217,12 +218,18 @@
@@ -224,12 +225,18 @@
## not sure what to do for NeXT. I think this works:
#CFLAGS=$(COPT) -posix -D_BSD -DANYPORT -I$(RINCLUDES)

View File

@ -1,20 +0,0 @@
--- cfs_fh.c.orig Sat Jul 15 01:26:30 2000
+++ cfs_fh.c Sat Jul 15 01:24:02 2000
@@ -908,7 +908,7 @@
f->name=NULL;
}
} else {
- if ((f=(cfs_fileid *)malloc(sizeof(cfs_fileid)))==NULL) {
+ if ((f=(cfs_fileid *)calloc(1, sizeof(cfs_fileid)))==NULL) {
fprintf(stderr,"cfsd: out of memory\n");
cfserrno=NFSERR_STALE; /* bad news */
return -2;
@@ -1198,7 +1198,7 @@
#endif /* SHORTLINKS */
)) == NULL) {
if ((f=(cfs_fileid *)
- malloc(sizeof(cfs_fileid)))==NULL) {
+ calloc(1, sizeof(cfs_fileid)))==NULL) {
fprintf(stderr,"cfsd: no memory\n");
cfserrno=NFSERR_STALE; /* bad news */
return -2;

View File

@ -1,5 +1,8 @@
--- cfs.c.orig Fri Dec 19 01:30:50 1997
+++ cfs.c Mon May 22 18:30:01 2000
$FreeBSD$
--- cfs.c.orig
+++ cfs.c
@@ -43,7 +43,7 @@
struct in_addr validhost;
@ -9,7 +12,7 @@
void nfs_program_2();
void adm_program_2();
#include <string.h>
@@ -236,7 +236,7 @@
@@ -240,7 +240,7 @@
setuid(0);
umask(0);

View File

@ -0,0 +1,27 @@
$FreeBSD$
--- cfs.h.orig
+++ cfs.h
@@ -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 */

View File

@ -0,0 +1,14 @@
$FreeBSD$
--- cfs_bf.h.orig
+++ cfs_bf.h
@@ -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

View File

@ -0,0 +1,413 @@
$FreeBSD$
--- cfs_des.c.orig
+++ cfs_des.c
@@ -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);

View File

@ -0,0 +1,69 @@
$FreeBSD$
--- cfs_fh.c.orig
+++ cfs_fh.c
@@ -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 */
@@ -763,7 +762,7 @@
char vect[9];
union{
u_char ch[9];
- u_long i[2];
+ uint32_t i[2];
} buf;
char linkname[NFS_MAXPATHLEN+1];
@@ -792,8 +791,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 */
@@ -908,7 +907,7 @@
f->name=NULL;
}
} else {
- if ((f=(cfs_fileid *)malloc(sizeof(cfs_fileid)))==NULL) {
+ if ((f=(cfs_fileid *)calloc(1, sizeof(cfs_fileid)))==NULL) {
fprintf(stderr,"cfsd: out of memory\n");
cfserrno=NFSERR_STALE; /* bad news */
return -2;
@@ -1146,7 +1145,7 @@
break anything */
struct dirent *
rootrd(cookie)
- long cookie;
+ int32_t cookie;
{
static struct dirent d;
@@ -1198,7 +1197,7 @@
#endif /* SHORTLINKS */
)) == NULL) {
if ((f=(cfs_fileid *)
- malloc(sizeof(cfs_fileid)))==NULL) {
+ calloc(1, sizeof(cfs_fileid)))==NULL) {
fprintf(stderr,"cfsd: no memory\n");
cfserrno=NFSERR_STALE; /* bad news */
return -2;

View File

@ -0,0 +1,71 @@
$FreeBSD$
--- cfs_nfs.c.orig
+++ cfs_nfs.c
@@ -877,12 +877,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;
@@ -944,7 +943,7 @@
else if (strcmp(s,"..")==0) /* parent */
entrytab[ne].fileid=fhpid(h);
else entrytab[ne].fileid=dent->d_fileno;
- bcopy(&cookie,entrytab[ne].cookie,sizeof(long));
+ bcopy(&cookie,entrytab[ne].cookie,sizeof(int32_t));
*prev = &entrytab[ne];
prev = &entrytab[ne].nextentry;
entrytab[ne].nextentry=NULL;
@@ -964,12 +963,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();
@@ -1151,7 +1150,7 @@
typedef char str[NFS_MAXNAMLEN+1];
static str names[MAXENTRIES];
entry **prev;
- long cookie;
+ int32_t cookie;
int eof;
int ne;
int bytes;
@@ -1163,7 +1162,7 @@
ne=0;
prev= &ret.readdirres_u.reply.entries;
*prev=NULL;
- bcopy(ap->cookie,&cookie,sizeof(long));
+ bcopy(ap->cookie,&cookie,sizeof(int32_t));
eof=1;
ret.status=NFS_OK;
@@ -1182,7 +1181,7 @@
else entrytab[ne].fileid=dent->d_fileno;
cookie=dent->d_reclen; /* may not work everywhere */
*prev = &entrytab[ne];
- bcopy(&cookie,entrytab[ne].cookie,sizeof(long));
+ bcopy(&cookie,entrytab[ne].cookie,sizeof(int32_t));
prev = &entrytab[ne].nextentry;
entrytab[ne].nextentry=NULL;
ne++;

View File

@ -1,5 +1,8 @@
--- cfsd.8.orig Sat Jan 1 04:35:00 1994
+++ cfsd.8 Sun Sep 20 18:35:45 1998
$FreeBSD$
--- cfsd.8.orig
+++ cfsd.8
@@ -3,6 +3,7 @@
cfsd - cryptographic file system daemon
.SH SYNOPSIS

View File

@ -1,5 +1,8 @@
--- cfssh.orig Wed Dec 3 16:21:40 1997
+++ cfssh Tue Apr 20 19:45:17 2004
$FreeBSD$
--- cfssh.orig
+++ cfssh
@@ -1,15 +1,16 @@
-#!/bin/ksh
+#!/bin/sh

View File

@ -1,5 +1,8 @@
--- cmkdir.c.orig Mon Jun 21 20:23:18 1999
+++ cmkdir.c Mon Jun 21 20:23:45 1999
$FreeBSD$
--- cmkdir.c.orig
+++ cmkdir.c
@@ -43,7 +43,7 @@
struct timeval tv;
u_long r;

View File

@ -0,0 +1,14 @@
$FreeBSD$
--- esm_cipher.c.orig
+++ esm_cipher.c
@@ -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);

View File

@ -0,0 +1,226 @@
$FreeBSD$
--- shs.c.orig
+++ shs.c
@@ -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

View File

@ -0,0 +1,18 @@
$FreeBSD$
--- shs.h.orig
+++ shs.h
@@ -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();

View File

@ -0,0 +1,98 @@
$FreeBSD$
--- truerand.c.orig
+++ truerand.c
@@ -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);

View File

@ -11,4 +11,6 @@ and the manual pages. There is a paper describing CFS at:
Under FreeBSD, the mount command for the CFS tree must include
"-o port=3049,nfsv2".
WWW: http://www.crypto.com/software/
John Polstra <jdp@polstra.com>