1
0
mirror of https://git.code.sf.net/p/lazarus-ccr/dcpcrypt synced 2025-11-23 21:44:41 +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

@@ -22,8 +22,8 @@
{* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *}
{* DEALINGS IN THE SOFTWARE. *}
{******************************************************************************}
unit DCPblockciphers;
unit DCPblockciphers;
{$MODE Delphi}
interface
@@ -205,8 +205,8 @@ begin
XorBlock(p2^,CV,8);
EncryptECB(p2^,p2^);
Move(p2^,CV,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(p1 + 8);
p2:= pointer(p2 + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -233,8 +233,8 @@ begin
DecryptECB(p2^,p2^);
XorBlock(p2^,CV,8);
Move(Temp,CV,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(p1 + 8);
p2:= pointer(p2 + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -303,8 +303,8 @@ begin
Move(p1^,p2^,8);
XorBlock(p2^,CV,8);
Move(p2^,CV,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(pointer(p1) + 8);
p2:= pointer(pointer(p2) + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -331,8 +331,8 @@ begin
Move(p1^,p2^,8);
XorBlock(p2^,CV,8);
Move(Temp,CV,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(pointer(p1) + 8);
p2:= pointer(pointer(p2) + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -356,8 +356,8 @@ begin
EncryptECB(CV,CV);
Move(p1^,p2^,8);
XorBlock(p2^,CV,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(p1 + 8);
p2:= pointer(p2 + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -381,8 +381,8 @@ begin
EncryptECB(CV,CV);
Move(p1^,p2^,8);
XorBlock(p2^,CV,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(p1 + 8);
p2:= pointer(p2 + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -408,8 +408,8 @@ begin
IncCounter;
Move(p1^,p2^,8);
XorBlock(p2^,temp,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(p1 + 8);
p2:= pointer(p2 + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -436,8 +436,8 @@ begin
IncCounter;
Move(p1^,p2^,8);
XorBlock(p2^,temp,8);
p1:= pointer(longword(p1) + 8);
p2:= pointer(longword(p2) + 8);
p1:= pointer(p1 + 8);
p2:= pointer(p2 + 8);
end;
if (Size mod 8)<> 0 then
begin
@@ -530,8 +530,8 @@ begin
XorBlock(p2^,CV,16);
EncryptECB(p2^,p2^);
Move(p2^,CV,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(p1 + 16);
p2:= pointer(p2 + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -558,8 +558,8 @@ begin
DecryptECB(p2^,p2^);
XorBlock(p2^,CV,16);
Move(Temp,CV,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(p1 + 16);
p2:= pointer(p2 + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -628,8 +628,8 @@ begin
Move(p1^,p2^,16);
XorBlock(p2^,CV,16);
Move(p2^,CV,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(pointer(p1) + 16);
p2:= pointer(pointer(p2) + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -656,8 +656,8 @@ begin
Move(p1^,p2^,16);
XorBlock(p2^,CV,16);
Move(Temp,CV,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(pointer(p1) + 16);
p2:= pointer(pointer(p2) + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -681,8 +681,8 @@ begin
EncryptECB(CV,CV);
Move(p1^,p2^,16);
XorBlock(p2^,CV,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(p1 + 16);
p2:= pointer(p2 + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -706,8 +706,8 @@ begin
EncryptECB(CV,CV);
Move(p1^,p2^,16);
XorBlock(p2^,CV,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(p1 + 16);
p2:= pointer(p2 + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -733,8 +733,8 @@ begin
IncCounter;
Move(p1^,p2^,16);
XorBlock(p2^,temp,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(p1 + 16);
p2:= pointer(p2 + 16);
end;
if (Size mod 16)<> 0 then
begin
@@ -761,8 +761,8 @@ begin
IncCounter;
Move(p1^,p2^,16);
XorBlock(p2^,temp,16);
p1:= pointer(longword(p1) + 16);
p2:= pointer(longword(p2) + 16);
p1:= pointer(p1 + 16);
p2:= pointer(p2 + 16);
end;
if (Size mod 16)<> 0 then
begin