*** libs/pfl/common/pgpRMWOLock.c	2000/01/25 23:30:04	1.1.1.1
--- libs/pfl/common/pgpRMWOLock.c	2000/01/25 23:32:31	1.1.1.2
***************
*** 8,15 ****
  ____________________________________________________________________________*/
  
  #include "pgpBase.h"
  
  #include "pgpRMWOLock.h"
  
  #if PGP_UNIX_SOLARIS
  /*
--- 8,19 ----
  ____________________________________________________________________________*/
  
  #include "pgpBase.h"
  
  #include "pgpRMWOLock.h"
+ 
+ #ifdef __FreeBSD__
+ #define	NULL	0 /* undefined for some reason */
+ #endif
  
  #if PGP_UNIX_SOLARIS
  /*
*** libs/pgpcdk/priv/crypto/bignum/bni80386_aout.s	2000/01/26 03:23:29	1.1
--- libs/pgpcdk/priv/crypto/bignum/bni80386_aout.s	2000/01/26 03:23:59	1.2
***************
*** 16,24 ****
  
  # Different assemblers have different conventions here
  # These conventions are for a.out format assembler
! align4=2	# could be 2 or 4
! align8=3	# could be 3 or 8
! align16=4	# cound be 4 or 16
  
  
  .text
--- 16,26 ----
  
  # Different assemblers have different conventions here
  # These conventions are for a.out format assembler
! 
! # Changed from 2,3,4 to 4,8,16 for FreeBSD
! align4=4	# could be 2 or 4
! align8=8	# could be 3 or 8
! align16=16	# cound be 4 or 16
  
  
  .text
*** libs/pgpcdk/pub/include/pgpSockets.h	2000/01/26 03:10:46	1.1.1.1
--- libs/pgpcdk/pub/include/pgpSockets.h	2000/01/26 03:13:58	1.1.1.2
***************
*** 30,35 ****
--- 30,39 ----
  # include <netdb.h>
  #endif
  
+ #if defined( __FreeBSD__ ) || defined ( __NetBSD__ )
+ # include <sys/ioctl.h>		/* Need FIONREAD */
+ #endif
+ 
  #if PGP_WIN32
  # include <winsock.h>
  #endif
*** libs/pgpcdk/priv/networklib/keyserver/CCRSEntrustServer.cpp	2000/01/26 03:10:44	1.1.1.1
--- libs/pgpcdk/priv/networklib/keyserver/CCRSEntrustServer.cpp	2000/01/26 03:13:47	1.1.1.2
***************
*** 147,153 ****
  		if (! PGPKeySetRefIsValid(inCAsKeySet)) {
  			ThrowPGPError_(kPGPError_OptionNotFound);
  		}
! 		if (accumulatedCRLs == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		pgpErr = PGPGetCRLDistributionPoints(inCAKey, inCAsKeySet, &numPoints, &points,
--- 147,153 ----
  		if (! PGPKeySetRefIsValid(inCAsKeySet)) {
  			ThrowPGPError_(kPGPError_OptionNotFound);
  		}
! 		if (accumulatedCRLs == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		pgpErr = PGPGetCRLDistributionPoints(inCAKey, inCAsKeySet, &numPoints, &points,
***************
*** 173,179 ****
  #if PGP_COMPILER_SUN
  			pgpCopyMemory(static_cast<PGPByte *>(crl), static_cast<PGPByte *>(accumulatedCRLs) + accumulatedSize, crlSize);
  #else
! 			pgpCopyMemory(crl, static_cast<PGPByte *>(accumulatedCRLs) + accumulatedSize, crlSize);
  #endif
  			accumulatedSize += crlSize;
  			currPoint += *currPointSize;
--- 173,179 ----
  #if PGP_COMPILER_SUN
  			pgpCopyMemory(static_cast<PGPByte *>(crl), static_cast<PGPByte *>(accumulatedCRLs) + accumulatedSize, crlSize);
  #else
! 			pgpCopyMemory((void *) crl, static_cast<PGPByte *>(accumulatedCRLs) + accumulatedSize, crlSize);
  #endif
  			accumulatedSize += crlSize;
  			currPoint += *currPointSize;
***************
*** 215,221 ****
  						PGPNewData(	PGPGetContextMemoryMgr(mContext),
  									GetMaxBase64EncodedBufferSize(inMessageLength),
  									kPGPMemoryMgrFlags_None));
! 	if (encodedBuffer == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	encodedSize = Base64Encode(	static_cast<const PGPByte *>(inMessage),
--- 215,221 ----
  						PGPNewData(	PGPGetContextMemoryMgr(mContext),
  									GetMaxBase64EncodedBufferSize(inMessageLength),
  									kPGPMemoryMgrFlags_None));
! 	if (encodedBuffer == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	encodedSize = Base64Encode(	static_cast<const PGPByte *>(inMessage),
***************
*** 226,232 ****
  						PGPNewData(	PGPGetContextMemoryMgr(mContext),
  									GetMaxURLEncodedBufferSize(encodedSize) + bufSize,
  									kPGPMemoryMgrFlags_None));
! 	if (encodedBuffer == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	strcpy(urlEncodedBuffer, kMessagePrefix);
--- 226,232 ----
  						PGPNewData(	PGPGetContextMemoryMgr(mContext),
  									GetMaxURLEncodedBufferSize(encodedSize) + bufSize,
  									kPGPMemoryMgrFlags_None));
! 	if (encodedBuffer == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	strcpy(urlEncodedBuffer, kMessagePrefix);
*** libs/pgpcdk/priv/networklib/keyserver/CHTTPKeyServer.cpp	2000/01/26 03:10:44	1.1.1.1
--- libs/pgpcdk/priv/networklib/keyserver/CHTTPKeyServer.cpp	2000/01/26 03:13:48	1.1.1.2
***************
*** 341,353 ****
  	tempStorage = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  														kTempStorageSize,
  														kPGPMemoryMgrFlags_None));
! 	if (tempStorage == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	buffer = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												result + 1,
  												kPGPMemoryMgrFlags_None));
! 	if (buffer == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	socketResult = PGPReceive(	mSocket,
--- 341,353 ----
  	tempStorage = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  														kTempStorageSize,
  														kPGPMemoryMgrFlags_None));
! 	if (tempStorage == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	buffer = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												result + 1,
  												kPGPMemoryMgrFlags_None));
! 	if (buffer == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	}
  	socketResult = PGPReceive(	mSocket,
*** libs/pgpcdk/priv/networklib/keyserver/CHTTPPGPKeyServer.cpp	2000/01/26 03:10:44	1.1.1.1
--- libs/pgpcdk/priv/networklib/keyserver/CHTTPPGPKeyServer.cpp	2000/01/26 03:13:48	1.1.1.2
***************
*** 92,98 ****
  		path = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													strlen(kQueryPrefix) + strlen(query) + 1,
  													kPGPMemoryMgrFlags_None));
! 		if (path == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		sprintf(path, "%s%s", kQueryPrefix, static_cast<char *>(query));
--- 92,98 ----
  		path = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													strlen(kQueryPrefix) + strlen(query) + 1,
  													kPGPMemoryMgrFlags_None));
! 		if (path == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		sprintf(path, "%s%s", kQueryPrefix, static_cast<char *>(query));
***************
*** 188,194 ****
  				PGPNewData(	PGPGetContextMemoryMgr(mContext),
  							GetMaxURLEncodedBufferSize(bufSize) + postPrefixSize,
  							kPGPMemoryMgrFlags_None));
! 			if (urlEncodedBuffer == 0) {
  				ThrowPGPError_(kPGPError_OutOfMemory);
  			}
  			strcpy(urlEncodedBuffer, kPostPrefix);
--- 188,194 ----
  				PGPNewData(	PGPGetContextMemoryMgr(mContext),
  							GetMaxURLEncodedBufferSize(bufSize) + postPrefixSize,
  							kPGPMemoryMgrFlags_None));
! 			if (urlEncodedBuffer == (StPGPDataRef) 0) {
  				ThrowPGPError_(kPGPError_OutOfMemory);
  			}
  			strcpy(urlEncodedBuffer, kPostPrefix);
*** libs/pgpcdk/priv/networklib/keyserver/CHTTPXcertServer.cpp	2000/01/26 03:10:44	1.1.1.1
--- libs/pgpcdk/priv/networklib/keyserver/CHTTPXcertServer.cpp	2000/01/26 03:13:49	1.1.1.2
***************
*** 89,95 ****
  		digest = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													GetMaxDigestedKeyBufferSize(),
  													kPGPMemoryMgrFlags_None));
! 		if (digest == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		digestSize = DigestKey(inCAKey, digest);
--- 89,95 ----
  		digest = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													GetMaxDigestedKeyBufferSize(),
  													kPGPMemoryMgrFlags_None));
! 		if (digest == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		digestSize = DigestKey(inCAKey, digest);
***************
*** 98,104 ****
  			PGPNewData(	PGPGetContextMemoryMgr(mContext),
  						GetMaxBase64EncodedBufferSize(inBufferSize),
  						kPGPMemoryMgrFlags_None));
! 		if (encodedBuffer == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		bufSize = Base64Encode(	static_cast<const PGPByte *>(inBuffer),
--- 98,104 ----
  			PGPNewData(	PGPGetContextMemoryMgr(mContext),
  						GetMaxBase64EncodedBufferSize(inBufferSize),
  						kPGPMemoryMgrFlags_None));
! 		if (encodedBuffer == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		bufSize = Base64Encode(	static_cast<const PGPByte *>(inBuffer),
***************
*** 109,115 ****
  		cnk = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													cnkSize,
  													kPGPMemoryMgrFlags_None));
! 		if (cnk == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		pgpErr = PGPGetKeyPropertyBuffer(	inRequestKey,
--- 109,115 ----
  		cnk = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													cnkSize,
  													kPGPMemoryMgrFlags_None));
! 		if (cnk == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		pgpErr = PGPGetKeyPropertyBuffer(	inRequestKey,
***************
*** 121,127 ****
  		encodedCNK = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  														GetMaxHexEncodedBufferSize(cnkSize),
  														kPGPMemoryMgrFlags_None));
! 		if (encodedCNK == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		cnkSize = HexEncode(cnk, cnkSize, encodedCNK);
--- 121,127 ----
  		encodedCNK = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  														GetMaxHexEncodedBufferSize(cnkSize),
  														kPGPMemoryMgrFlags_None));
! 		if (encodedCNK == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		cnkSize = HexEncode(cnk, cnkSize, encodedCNK);
***************
*** 131,137 ****
  						strlen(kCA) + digestSize + strlen(kCNK) + cnkSize
  							+ strlen(kPKCS10_input) + GetMaxURLEncodedBufferSize(bufSize),
  						kPGPMemoryMgrFlags_None));
! 		if (post == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		postSize = sprintf(post, "%s%s%s%s%s", kCA, static_cast<char *>(digest), kCNK,
--- 131,137 ----
  						strlen(kCA) + digestSize + strlen(kCNK) + cnkSize
  							+ strlen(kPKCS10_input) + GetMaxURLEncodedBufferSize(bufSize),
  						kPGPMemoryMgrFlags_None));
! 		if (post == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		postSize = sprintf(post, "%s%s%s%s%s", kCA, static_cast<char *>(digest), kCNK,
***************
*** 196,202 ****
  		path = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													strlen(prefix) + strlen(query) + 1,
  													kPGPMemoryMgrFlags_None));
! 		if (path == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		sprintf(path, "%s%s", prefix, static_cast<char *>(query));
--- 196,202 ----
  		path = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													strlen(prefix) + strlen(query) + 1,
  													kPGPMemoryMgrFlags_None));
! 		if (path == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		sprintf(path, "%s%s", prefix, static_cast<char *>(query));
***************
*** 258,271 ****
  		digest = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													GetMaxDigestedKeyBufferSize(),
  													kPGPMemoryMgrFlags_None));
! 		if (digest == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		digestSize = DigestKey(inCAKey, digest);
  		path = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													strlen(prefix) + digestSize + 1,
  													kPGPMemoryMgrFlags_None));
! 		if (path == 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		sprintf(path, "%s%s", prefix, static_cast<char *>(digest));
--- 258,271 ----
  		digest = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													GetMaxDigestedKeyBufferSize(),
  													kPGPMemoryMgrFlags_None));
! 		if (digest == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		};
  		digestSize = DigestKey(inCAKey, digest);
  		path = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  													strlen(prefix) + digestSize + 1,
  													kPGPMemoryMgrFlags_None));
! 		if (path == (StPGPDataRef) 0) {
  			ThrowPGPError_(kPGPError_OutOfMemory);
  		}
  		sprintf(path, "%s%s", prefix, static_cast<char *>(digest));
***************
*** 323,329 ****
  		PGPNewData(	PGPGetContextMemoryMgr(mContext),
  					GetMaxBase64EncodedBufferSize(bufSize),
  					kPGPMemoryMgrFlags_None));
! 	if (encodedBuffer == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	bufSize = Base64Encode(	static_cast<const PGPByte *>(buffer),
--- 323,329 ----
  		PGPNewData(	PGPGetContextMemoryMgr(mContext),
  					GetMaxBase64EncodedBufferSize(bufSize),
  					kPGPMemoryMgrFlags_None));
! 	if (encodedBuffer == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	bufSize = Base64Encode(	static_cast<const PGPByte *>(buffer),
***************
*** 351,357 ****
  	buffer = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												bufSize,
  												kPGPMemoryMgrFlags_None));
! 	if (buffer == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	pgpErr = PGPFinalizeHash(hashContext, static_cast<char *>(buffer));
--- 351,357 ----
  	buffer = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												bufSize,
  												kPGPMemoryMgrFlags_None));
! 	if (buffer == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	pgpErr = PGPFinalizeHash(hashContext, static_cast<char *>(buffer));
***************
*** 400,406 ****
  	result = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												resultSize + 1,
  												kPGPMemoryMgrFlags_None));
! 	if (result == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	pgpCopyMemory(inResult, static_cast<char *>(result), resultSize + 1);
--- 400,406 ----
  	result = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												resultSize + 1,
  												kPGPMemoryMgrFlags_None));
! 	if (result == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	pgpCopyMemory(inResult, static_cast<char *>(result), resultSize + 1);
***************
*** 426,432 ****
  	decodedResult = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  														GetMaxBase64DecodedBufferSize(end - found),
  														kPGPMemoryMgrFlags_None));
! 	if (decodedResult == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	
--- 426,432 ----
  	decodedResult = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  														GetMaxBase64DecodedBufferSize(end - found),
  														kPGPMemoryMgrFlags_None));
! 	if (decodedResult == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	
***************
*** 470,476 ****
  	result = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												GetMaxBase64DecodedBufferSize(end - found),
  												kPGPMemoryMgrFlags_None));
! 	if (result == 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	
--- 470,476 ----
  	result = static_cast<PGPByte *>(PGPNewData(	PGPGetContextMemoryMgr(mContext),
  												GetMaxBase64DecodedBufferSize(end - found),
  												kPGPMemoryMgrFlags_None));
! 	if (result == (StPGPDataRef) 0) {
  		ThrowPGPError_(kPGPError_OutOfMemory);
  	};
  	
*** libs/network/ldaplib/liblber/io.c	2000/01/26 03:10:31	1.1.1.1
--- libs/network/ldaplib/liblber/io.c	2000/01/26 03:12:55	1.1.1.2
***************
*** 14,19 ****
--- 14,23 ----
  #include <stdio.h>
  #include <ctype.h>
  
+ #if defined( __FreeBSD__ ) || defined ( __NetBSD__ )
+ #include <sys/time.h>
+ #endif
+ 
  #if PGPSOCKETSLDAP		/* jason */
  #include "pgpSocketsLDAP.h"
  
*** libs/network/ldaplib/include/ldap.h	2000/01/26 03:10:31	1.1.1.1
--- libs/network/ldaplib/include/ldap.h	2000/01/26 03:12:53	1.1.1.2
***************
*** 90,95 ****
--- 90,99 ----
  #define GetThreadID		pthread_self
  #endif
  
+ #if defined(__FreeBSD__) || defined(__NetBSD__)
+ #define GetThreadID		pthread_self
+ #endif
+ 
  #if PGP_MACINTOSH
  #define Debug( level, fmt, arg1, arg2, arg3 )	{}	/* Nothing */
  #else
--- libs/pgpcdk/priv/crypto/random/pgpRandomPool.c.orig	Fri Aug  6 13:56:49 1999
+++ libs/pgpcdk/priv/crypto/random/pgpRandomPool.c	Fri Sep 29 20:41:26 2000
@@ -424,7 +424,7 @@
  * #define UMULH_32(r,a,b) (r) = 0
  */
 #ifndef UMULH_32
-#if defined(__GNUC__) && defined(__i386__)
+#if 0
 /* Inline asm goodies */
 #define UMULH_32(r,a,b) __asm__("mull %2" : "=d"(r) : "%a"(a), "mr"(b) : "ax")
 #elif HAVE64
--- libs/pgpcdk/unix/ui/PGPKeyServerDialogs.cpp.orig	Tue Mar  9 18:52:17 1999
+++ libs/pgpcdk/unix/ui/PGPKeyServerDialogs.cpp	Fri Sep 29 20:51:02 2000
@@ -5,6 +5,7 @@
 	$Id: pgp.patch,v 1.2 2003/07/24 09:22:10 mlelstv Exp $
 ____________________________________________________________________________*/
 #include <string.h>
+#include <stdlib.h>
 
 #include "pgpDialogs.h"
 #include "pgpKeyServerDialogCommon.h"
--- libs/pfl/common/pgpDebug.c.orig	Wed Mar 10 03:49:24 1999
+++ libs/pfl/common/pgpDebug.c	Sun Aug 19 11:27:06 2001
@@ -191,7 +191,7 @@
 					
 				case 'c':	/* Single character */
 				{
-					char			ch = va_arg(args, char);
+					char			ch = va_arg(args, int);
 					
 					AppendChars(buffer, &bufferIndex, bufferSize,
 								canonicalizeNLs, &ch, 1);
--- clients/pgp/cmdline/Makefile.in.orig	Fri Oct 19 14:53:23 2001
+++ clients/pgp/cmdline/Makefile.in	Fri Sep  1 23:11:16 2000
@@ -50,7 +50,7 @@
 
 LIBDIRS+=-L$(PFLDIR) -L$(SDKDIR)/unix -L$(RSALIBRARY)$(RSA_OS)
 
-LIBS=-lPGPui -lPGPsdkNetwork -lPGPsdk -lpfl @THREADLIB@ $(RSALIBS) @LIBS@
+LIBS=-lPGPui -lPGPsdkNetwork -lPGPsdk -lPGPui -lpfl @THREADLIB@ $(RSALIBS) @LIBS@
 
 SHAREDOBJS=$(SHAREDDIR)/pgpDiskWiper.o $(SHAREDDIR)/pgpClientErrors.o
 
--- libs/pfl/common/file/pgpStdFileIO.c.dist	2003-07-24 11:05:41.000000000 +0200
+++ libs/pfl/common/file/pgpStdFileIO.c	2003-07-24 11:13:16.000000000 +0200
@@ -23,6 +23,9 @@
 #define PGP_USE_FILE_SPEC_PRIV
 #include "pgpFileSpecPriv.h"
 
+#ifdef PGP_UNIX
+#define PGP_HAVE_SEEKO
+#endif
 
 #define GetParentVTBL()		pgpFileIOGetClassVTBL()
 
@@ -124,8 +127,12 @@
 	
 	PGPValidatePtr( self->stdioFILE );
 	
+#ifdef PGP_HAVE_SEEKO
+	result	= fseeko( self->stdioFILE, (off_t) newPos, SEEK_SET );
+#else
 	tempPos	= newPos;
 	result	= fsetpos( self->stdioFILE, &tempPos );
+#endif
 	if ( result != 0 )
 	{
 		err	= kPGPError_FileOpFailed;
@@ -192,7 +199,11 @@
 	PGPStdFileIORef	self	= (PGPStdFileIORef)ref;
 	FILE *			stdioFILE	= self->stdioFILE;
 	fpos_t			startPos;
+#ifdef PGP_HAVE_SEEKO
+    off_t           eofOff;
+#else
 	fpos_t			eofPos;
+#endif
 	int				fResult;
 	
 	*eof	= 0;
@@ -205,7 +216,11 @@
 		/* seek to the end of the file so we can get its length */
 		fResult	= fseek( stdioFILE, 0, SEEK_END );
 		if ( fResult == 0 )
+#ifdef PGP_HAVE_SEEKO
+			eofOff = ftello( stdioFILE );
+#else
 			fResult	= fgetpos( stdioFILE, &eofPos);
+#endif
 		
 		if ( fResult != 0 )
 			err	= kPGPError_FileOpFailed;
@@ -221,7 +236,11 @@
 	}
 	
 	
+#ifdef PGP_HAVE_SEEKO
+	*eof	= eofOff;
+#else
 	*eof	= eofPos;
+#endif
 	return( err );
 }
 
--- libs/pfl/common/lthread/pgpThreads.h.orig	Mon Apr 19 19:59:53 1999
+++ libs/pfl/common/lthread/pgpThreads.h	Mon Jul 28 10:29:14 2003
@@ -148,6 +148,9 @@
 #ifdef PGP_UNIX_HPUX
 #include <semaphore.h>
 typedef sem_t PGPSem_t; /* not a struct under HP-UX 10.20 */
+#elif defined(__FreeBSD__)
+#include <semaphore.h>
+typedef sem_t PGPSem_t;
 #else
 typedef struct sem_t PGPSem_t;
 #endif /* !PGP_UNIX_HPUX */
--- libs/pfl/common/pgpBase.h.dist	2003-07-31 10:17:51.000000000 +0200
+++ libs/pfl/common/pgpBase.h	2003-07-31 10:18:16.000000000 +0200
@@ -137,7 +137,7 @@
 #if ULONG_MAX > 0xfffffffful
 #if ULONG_MAX == 0xfffffffffffffffful
 
-typedef ulong		PGPUInt64;
+typedef unsigned long	PGPUInt64;
 typedef long		PGPInt64;
 #define PGP_HAVE64	1
 
--- libs/pgpcdk/priv/networklib/pgpsockets/common/pgpSockets.c.orig	1999-08-04 20:36:04.000000000 +0200
+++ libs/pgpcdk/priv/networklib/pgpsockets/common/pgpSockets.c	2004-02-09 09:19:17.000000000 +0100
@@ -42,7 +42,9 @@
 #if PGP_UNIX_LINUX || PGP_UNIX_HPUX || PGP_UNIX_AIX
 int gethostname (char * name, size_t namelen);
 #else
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
 int gethostname (char * name, int namelen);
+#endif
 #endif /* PGP_UNIX_LINUX */
 #endif
 
--- libs/network/ldaplib/build/platforms/netbsd-gcc/Make-platform.orig	2004-06-02 15:16:24.000000000 +0200
+++ libs/network/ldaplib/build/platforms/netbsd-gcc/Make-platform	2004-06-02 15:16:32.000000000 +0200
@@ -13,4 +13,4 @@
 # -------------------------------------------------------------------------
 CC	= gcc
 
-PLATFORMCFLAGS=	-Dnetbsd
+PLATFORMCFLAGS=	-Dnetbsd -DPGP_UNIX=1
Index: libs/pfl/common/classes/StPGPRefs.h
--- libs/pfl/common/classes/StPGPRefs.h.orig	1999-08-05 10:22:16 +0200
+++ libs/pfl/common/classes/StPGPRefs.h	2005-10-03 19:33:03 +0200
@@ -64,27 +64,27 @@
 
 #ifdef Included_pgpKeys_h
 	typedef StPGPRef<PGPKeySetRef>	StPGPKeySetRef;
-	inline void StPGPKeySetRef::Dispose() { PGPFreeKeySet(mRef); }
+	template <> inline void StPGPKeySetRef::Dispose() { PGPFreeKeySet(mRef); }
 
 	typedef StPGPRef<PGPKeyListRef>	StPGPKeyListRef;
-	inline void StPGPKeyListRef::Dispose() { PGPFreeKeyList(mRef); }
+	template <> inline void StPGPKeyListRef::Dispose() { PGPFreeKeyList(mRef); }
 
 	typedef StPGPRef<PGPKeyIterRef>	StPGPKeyIterRef;
-	inline void StPGPKeyIterRef::Dispose() { PGPFreeKeyIter(mRef); }
+	template <> inline void StPGPKeyIterRef::Dispose() { PGPFreeKeyIter(mRef); }
 #endif
 
 #ifdef Included_pgpHashing_h
 	typedef StPGPRef<PGPHashContextRef>	StPGPHashContextRef;
-	inline void StPGPHashContextRef::Dispose() { PGPFreeHashContext(mRef); }
+	template <> inline void StPGPHashContextRef::Dispose() { PGPFreeHashContext(mRef); }
 #endif
 
 #ifdef Included_PGPtls_h
 	typedef StPGPRef<PGPtlsSessionRef>	StPGPtlsSessionRef;
-	inline void StPGPtlsSessionRef::Dispose() { PGPFreeTLSSession(mRef); }
+	template <> inline void StPGPtlsSessionRef::Dispose() { PGPFreeTLSSession(mRef); }
 #endif
 
 #ifdef Included_pgpMemoryMgr_h
-	inline void StPGPRef<PGPByte *>::Dispose() { PGPFreeData(mRef); }
+	template <> inline void StPGPRef<PGPByte *>::Dispose() { PGPFreeData(mRef); }
 	class StPGPDataRef	:	public StPGPRef<PGPByte *> {
 	public:
 						StPGPDataRef() { }
@@ -104,22 +104,22 @@
 	};
 
 	typedef StPGPRef<PGPMemoryMgrRef>	StPGPMemoryMgrRef;
-	inline void StPGPMemoryMgrRef::Dispose() { PGPFreeMemoryMgr(mRef); }
+	template <> inline void StPGPMemoryMgrRef::Dispose() { PGPFreeMemoryMgr(mRef); }
 #endif
 
 #ifdef Included_pgpSockets_h
 	typedef StPGPRef<PGPSocketRef>	StPGPSocketRef;
-	inline void StPGPSocketRef::Dispose() { PGPCloseSocket(mRef); }
+	template <> inline void StPGPSocketRef::Dispose() { PGPCloseSocket(mRef); }
 #endif
 
 #ifdef Included_pflPrefs_h
 	typedef StPGPRef<PGPPrefRef>	StPGPPrefRef;
-	inline void StPGPPrefRef::Dispose() { PGPClosePrefFile(mRef); }
+	template <> inline void StPGPPrefRef::Dispose() { PGPClosePrefFile(mRef); }
 #endif
 
 #ifdef Included_pgpIO_h
 	typedef StPGPRef<PGPIORef>	StPGPIORef;
-	inline void StPGPIORef::Dispose() { PGPFreeIO(mRef); }
+	template <> inline void StPGPIORef::Dispose() { PGPFreeIO(mRef); }
 #endif
 
 #undef STATIC_CAST
Index: clients/pgp/cmdline/args.c
--- clients/pgp/cmdline/args.c.orig	1999-10-04 23:49:07 +0200
+++ clients/pgp/cmdline/args.c	2005-10-03 20:07:25 +0200
@@ -117,7 +117,7 @@
  * interface to the old methods
  */
 
-static int maintUpdate(PGPFileSpecRef ringfilespec, 
+int maintUpdate(PGPFileSpecRef ringfilespec, 
 					   struct newkey const *nkeys)
 { 
 	/* 
@@ -127,7 +127,7 @@
 	return 0; 
 }
 
-static int cryptRandWriteFile(char const *name, 
+int cryptRandWriteFile(char const *name, 
 							  struct IdeaCfbContext *cfb,
 							  unsigned bytes) 
 { 
Index: clients/pgp/cmdline/keymaint.c
--- clients/pgp/cmdline/keymaint.c.orig	1999-05-12 23:01:04 +0200
+++ clients/pgp/cmdline/keymaint.c	2005-10-03 20:24:24 +0200
@@ -264,7 +264,7 @@
             pgpAssertNoErr(err);
 
             if ( (PGPUInt32)traceValue == 0) {
-                (PGPUInt32)traceValue = depth;
+                traceValue = depth;
 
                 err = PGPSetKeyUserVal( key, traceValue);
                 pgpAssertNoErr(err);
