1
0
mirror of https://git.code.sf.net/p/lazarus-ccr/dcpcrypt synced 2025-11-28 21:49:45 +02:00

Rather large fix to correctly support 64-bit platforms.

* My previous attempt was not thorough enough and I missed a
  lot of details.
* More testing was done and now it seems to work correctly on 32-bit
  and 64-bit Linux.
This commit is contained in:
Graeme Geldenhuys
2009-11-17 17:07:00 +02:00
parent 4ab5087350
commit a6a0258b48
20 changed files with 178 additions and 171 deletions

View File

@@ -236,9 +236,9 @@ begin
if not fInitialized then
raise EDCP_blockcipher.Create('Cipher not initialized');
PDword(@a[0,0])^:= PDword(@InData)^;
PDword(@a[1,0])^:= PDword(dword(@InData)+4)^;
PDword(@a[2,0])^:= PDword(dword(@InData)+8)^;
PDword(@a[3,0])^:= PDword(dword(@InData)+12)^;
PDword(@a[1,0])^:= PDword(pointer(@InData)+4)^;
PDword(@a[2,0])^:= PDword(pointer(@InData)+8)^;
PDword(@a[3,0])^:= PDword(pointer(@InData)+12)^;
for r:= 0 to (numrounds-2) do
begin
PDWord(@tempb[0])^:= PDWord(@a[0])^ xor rk[r,0];
@@ -288,9 +288,9 @@ begin
PDWord(@a[3])^:= PDWord(@a[3])^ xor rk[numrounds,3];
PDword(@OutData)^:= PDword(@a[0,0])^;
PDword(dword(@OutData)+4)^:= PDword(@a[1,0])^;
PDword(dword(@OutData)+8)^:= PDword(@a[2,0])^;
PDword(dword(@OutData)+12)^:= PDword(@a[3,0])^;
PDword(pointer(@OutData)+4)^:= PDword(@a[1,0])^;
PDword(pointer(@OutData)+8)^:= PDword(@a[2,0])^;
PDword(pointer(@OutData)+12)^:= PDword(@a[3,0])^;
end;
procedure TDCP_rijndael.DecryptECB(const InData; var OutData);
@@ -302,9 +302,9 @@ begin
if not fInitialized then
raise EDCP_blockcipher.Create('Cipher not initialized');
PDword(@a[0,0])^:= PDword(@InData)^;
PDword(@a[1,0])^:= PDword(dword(@InData)+4)^;
PDword(@a[2,0])^:= PDword(dword(@InData)+8)^;
PDword(@a[3,0])^:= PDword(dword(@InData)+12)^;
PDword(@a[1,0])^:= PDword(pointer(@InData)+4)^;
PDword(@a[2,0])^:= PDword(pointer(@InData)+8)^;
PDword(@a[3,0])^:= PDword(pointer(@InData)+12)^;
for r:= NumRounds downto 2 do
begin
PDWord(@tempb[0])^:= PDWord(@a[0])^ xor drk[r,0];
@@ -353,9 +353,9 @@ begin
PDWord(@a[2])^:= PDWord(@a[2])^ xor drk[0,2];
PDWord(@a[3])^:= PDWord(@a[3])^ xor drk[0,3];
PDword(@OutData)^:= PDword(@a[0,0])^;
PDword(dword(@OutData)+4)^:= PDword(@a[1,0])^;
PDword(dword(@OutData)+8)^:= PDword(@a[2,0])^;
PDword(dword(@OutData)+12)^:= PDword(@a[3,0])^;
PDword(pointer(@OutData)+4)^:= PDword(@a[1,0])^;
PDword(pointer(@OutData)+8)^:= PDword(@a[2,0])^;
PDword(pointer(@OutData)+12)^:= PDword(@a[3,0])^;
end;