From c25cfb494f6873338f6654c2ff668acbc59f0ce3 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 13 Nov 2009 17:07:38 +0200 Subject: [PATCH] Fixed compiler errors under 64-bit FPC using Linux. --- Ciphers/dcpserpent.pas | 20 ++++++++++---------- Ciphers/dcptwofish.pas | 20 ++++++++++---------- dcpcrypt2.pas | 6 ++++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Ciphers/dcpserpent.pas b/Ciphers/dcpserpent.pas index 9a39b26..27a073f 100644 --- a/Ciphers/dcpserpent.pas +++ b/Ciphers/dcpserpent.pas @@ -24,8 +24,8 @@ {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} {* DEALINGS IN THE SOFTWARE. *} {******************************************************************************} -unit DCPserpent; - +unit DCPserpent; + {$MODE Delphi} interface @@ -217,10 +217,10 @@ begin end; a:= a xor l_key[128]; b:= b xor l_key[128+1]; c:= c xor l_key[128+2]; d:= d xor l_key[128+3]; - PDWord(longword(@OutData)+ 0)^:= a; - PDWord(longword(@OutData)+ 4)^:= b; - PDWord(longword(@OutData)+ 8)^:= c; - PDWord(longword(@OutData)+12)^:= d; + PDWord(PtrUInt(@OutData)+ 0)^:= a; + PDWord(PtrUInt(@OutData)+ 4)^:= b; + PDWord(PtrUInt(@OutData)+ 8)^:= c; + PDWord(PtrUInt(@OutData)+12)^:= d; end; procedure TDCP_serpent.DecryptECB(const InData; var OutData); @@ -272,10 +272,10 @@ begin Dec(i,8); end; - PDWord(longword(@OutData)+ 0)^:= a; - PDWord(longword(@OutData)+ 4)^:= b; - PDWord(longword(@OutData)+ 8)^:= c; - PDWord(longword(@OutData)+12)^:= d; + PDWord(PtrUInt(@OutData)+ 0)^:= a; + PDWord(PtrUInt(@OutData)+ 4)^:= b; + PDWord(PtrUInt(@OutData)+ 8)^:= c; + PDWord(PtrUInt(@OutData)+12)^:= d; end; end. diff --git a/Ciphers/dcptwofish.pas b/Ciphers/dcptwofish.pas index 314de21..9703fcc 100644 --- a/Ciphers/dcptwofish.pas +++ b/Ciphers/dcptwofish.pas @@ -22,8 +22,8 @@ {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} {* DEALINGS IN THE SOFTWARE. *} {******************************************************************************} -unit DCPtwofish; - +unit DCPtwofish; + {$MODE Delphi} interface @@ -482,10 +482,10 @@ begin x[0]:= (x[0] shr 1) or (x[0] shl 31); Inc(i,2); end; - PDWord(longword(@OutData)+ 0)^:= x[2] xor SubKeys[OUTPUTWHITEN]; - PDWord(longword(@OutData)+ 4)^:= x[3] xor SubKeys[OUTPUTWHITEN+1]; - PDWord(longword(@OutData)+ 8)^:= x[0] xor SubKeys[OUTPUTWHITEN+2]; - PDWord(longword(@OutData)+12)^:= x[1] xor SubKeys[OUTPUTWHITEN+3]; + PDWord(PtrUInt(@OutData)+ 0)^:= x[2] xor SubKeys[OUTPUTWHITEN]; + PDWord(PtrUInt(@OutData)+ 4)^:= x[3] xor SubKeys[OUTPUTWHITEN+1]; + PDWord(PtrUInt(@OutData)+ 8)^:= x[0] xor SubKeys[OUTPUTWHITEN+2]; + PDWord(PtrUInt(@OutData)+12)^:= x[1] xor SubKeys[OUTPUTWHITEN+3]; end; procedure TDCP_twofish.DecryptECB(const InData; var OutData); @@ -522,10 +522,10 @@ begin x[3]:= (x[3] shr 1) or (x[3] shl 31); Dec(i,2); end; - PDWord(longword(@OutData)+ 0)^:= X[0] xor SubKeys[INPUTWHITEN]; - PDWord(longword(@OutData)+ 4)^:= X[1] xor SubKeys[INPUTWHITEN+1]; - PDWord(longword(@OutData)+ 8)^:= X[2] xor SubKeys[INPUTWHITEN+2]; - PDWord(longword(@OutData)+12)^:= X[3] xor SubKeys[INPUTWHITEN+3]; + PDWord(PtrUInt(@OutData)+ 0)^:= X[0] xor SubKeys[INPUTWHITEN]; + PDWord(PtrUInt(@OutData)+ 4)^:= X[1] xor SubKeys[INPUTWHITEN+1]; + PDWord(PtrUInt(@OutData)+ 8)^:= X[2] xor SubKeys[INPUTWHITEN+2]; + PDWord(PtrUInt(@OutData)+12)^:= X[3] xor SubKeys[INPUTWHITEN+3]; end; procedure PreCompMDS; diff --git a/dcpcrypt2.pas b/dcpcrypt2.pas index 2991946..be465db 100644 --- a/dcpcrypt2.pas +++ b/dcpcrypt2.pas @@ -22,8 +22,8 @@ {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} {* DEALINGS IN THE SOFTWARE. *} {******************************************************************************} -unit DCPcrypt2; - +unit DCPcrypt2; + {$MODE Delphi} interface @@ -40,7 +40,9 @@ type Pword= ^word; Pdword= ^dword; Pint64= ^int64; + {$IFNDEF FPC} dword= longword; + {$ENDIF} Pwordarray= ^Twordarray; Twordarray= array[0..19383] of word; Pdwordarray= ^Tdwordarray;