%n pgp %v 263i %c * %l * %b * %d * %f * %t pgp-263i.tgz %w Nonfree %% [ -d $BUILDDIR ] || mkdir -p $BUILDDIR cd $BUILDDIR rm -rf $NAME-$VERSION mkdir $NAME-$VERSION cd $NAME-$VERSION tar xivzfp $SRCTARDIR/$TARFILE tar xivvfp pgp263ii.tar patch -u -p1 <<'ENDPATCH' diff -ru2N pgp-263i/Makefile pgp-MCC/Makefile --- pgp-263i/Makefile Thu Jan 1 01:00:00 1970 +++ pgp-MCC/Makefile Fri Sep 13 20:31:16 1996 @@ -0,0 +1,19 @@ +BIN= src/pgp +DATA= config.txt en.hlp doc/keyserv.doc language.txt doc/mitlicen.txt \ + pgp.hlp doc/pgpdoc1.txt doc/pgpdoc2.txt +DATADIR= /usr/share/pgp + +all: $(BIN) + +$(BIN): force + $(MAKE) -C src linux + +install: $(BIN) + install -s -m 555 $(BIN) /usr/bin + install -d -m 555 $(DATADIR) + install -m 444 $(DATA) $(DATADIR) + mv -f $(DATADIR)/mitlicen.txt $(DATADIR)/License.txt + install -m 444 doc/pgp.1 /usr/man/man1/ + gzip -9f /usr/man/man1/pgp.1 + +.PHONY: force diff -ru2N pgp-263i/config.txt pgp-MCC/config.txt --- pgp-263i/config.txt Thu Jan 18 10:49:42 1996 +++ pgp-MCC/config.txt Fri Sep 13 20:03:43 1996 @@ -62,4 +62,5 @@ # # CharSet = cp850 +CharSet = latin1 # TMP is the directory name for PGP scratch files, usually a RAM disk. diff -ru2N pgp-263i/doc/pgp.1 pgp-MCC/doc/pgp.1 --- pgp-263i/doc/pgp.1 Sun Aug 6 18:06:00 1995 +++ pgp-MCC/doc/pgp.1 Fri Sep 13 20:09:02 1996 @@ -486,17 +486,17 @@ .nf .\" set tabstop to longest possible filename -.ta \w'/usr/local/lib/pgp/language.txt'u +.ta \w'/usr/share/pgp/language.txt'u *.pgp ciphertext, signature, or key file *.asc ascii armor file -/usr/local/lib/config.txt system-wide configuration file +/usr/share/pgp/config.txt system-wide configuration file $PGPPATH/config.txt per-user configuration file $PGPPATH/pubring.pgp public key ring $PGPPATH/secring.pgp secret key ring $PGPPATH/randseed.bin random number seed file -/usr/local/lib/pgp/language.txt +/usr/share/pgp/language.txt $PGPPATH/language.txt foreign language translation file -/usr/local/lib/pgp/pgp.hlp +/usr/share/pgp/pgp.hlp $PGPPATH/pgp/pgp.hlp online help text file -/usr/local/lib/pgp/pgpkey.hlp +/usr/share/pgp/pgpkey.hlp $PGPPATH/pgp/pgpkey.hlp online key-management help text file diff -ru2N pgp-263i/src/fileio.h pgp-MCC/src/fileio.h --- pgp-263i/src/fileio.h Sat Jan 6 19:46:36 1996 +++ pgp-MCC/src/fileio.h Fri Sep 13 20:09:44 1996 @@ -27,5 +27,5 @@ */ #ifdef LINUX -# define PGP_SYSTEM_DIR "/var/lib/pgp/" +# define PGP_SYSTEM_DIR "/usr/share/pgp/" #else # define PGP_SYSTEM_DIR "/usr/local/lib/pgp/" diff -ru2N pgp-263i/src/makefile pgp-MCC/src/makefile --- pgp-263i/src/makefile Thu Jan 18 10:42:36 1996 +++ pgp-MCC/src/makefile Fri Sep 13 20:04:48 1996 @@ -166,5 +166,6 @@ linux: $(MAKE) all CC=gcc LD=gcc OBJS_EXT="_80386.o _zmatch.o" \ - CFLAGS="$(RSAINCDIR) -O6 -g3 -DUNIX -DLINUX -DIDEA32 -DASM" + CFLAGS="$(RSAINCDIR) -O6 -DUNIX -DLINUX -DIDEA32 -DASM" \ + ASMDEF=-DSYSV linux-68k: diff -ru2N pgp-263i/src/random.c pgp-MCC/src/random.c --- pgp-263i/src/random.c Sat Jan 6 20:02:10 1996 +++ pgp-MCC/src/random.c Fri Sep 13 20:03:03 1996 @@ -42,4 +42,19 @@ #endif +/* The patches to this file random.c come from Theodore Y. Ts'o + (tytso@mit.edu). Here is his comment about using /dev/random: + + Here's a better way of integrating PGP with /dev/random, though. + It uses /dev/random as an adjunct to PGP's normal randomness + harvesting routines. Naturally, it fails safely if /dev/random + isn't available, or if /dev/random doesn't have any bytes + available. +*/ + +#ifdef UNIX +#include +#include +#endif + #include "system.h" /* For ttycbreak, getch, etc. */ #include "idea.h" @@ -209,7 +224,25 @@ cryptRandByte(void) { + byte ch = 0; +#ifdef UNIX + static int fd = -1; + int n; + + if (fd == -1) { + fd = open("/dev/random", O_RDONLY); + if (fd < 0) + fd = -2; + } + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { + close(fd); + fd = -1; + } + if (fd >= 0) + read(fd, &ch, 1); +#endif + if (!randSeedOpen) cryptRandOpen((struct IdeaCfbContext *)0); - return ideaRandByte(&randContext); + return ideaRandByte(&randContext) ^ ch; } @@ -396,4 +429,41 @@ /* + * Get the hardware random numbers out... + */ +#ifdef UNIX +void getHardwareRandomNumbers(unsigned count) +{ + static int fd = -1; + char randbuf[1024]; + unsigned n, i; + + if (fd == -2) + return; + if (fd == -1) { + fd = open("/dev/random", O_RDONLY); + if (fd < 0) { + fd = -2; + return; + } + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { + close(fd); + fd = -1; + } + } + + n = read(fd, randbuf, count/8); + if (n > 0) { + randPoolAddBytes(randbuf, n); + trueRandBits += n*8; + } +} +#else +void getHardwareRandomNumbers(unsigned count) +{ + return; +} +#endif + +/* * Returns a truly random byte if any are available. It degenerates to * a pseudorandom value if there are none. It is not an error to call @@ -408,4 +478,6 @@ if (trueRandPending) trueRandAccum(0); + if (trueRandBits < 128) + getHardwareRandomNumbers(128); #ifdef MACTC5 while( trueRandBits < 8 ) { @@ -512,4 +584,9 @@ count = RANDPOOLBITS; + if (trueRandBits >= count) + return; + + getHardwareRandomNumbers(count); + if (trueRandBits >= count) return; ENDPATCH make * make install %%