graemeg / onguard

OnGuard software security components for use with Free Pascal
http://wiki.freepascal.org/OnGuard
35 stars 16 forks source link

Fixes\adaptation for 64-bit Windows support #8

Open devEric69 opened 3 years ago

devEric69 commented 3 years ago

Hello,

In order to have an identical behavior of MixBlock procedure (using a Longint variable i.e. a 32 bits), on a 32bits or 64bits CPU, I propose this adaptation in the unit onguard.pas:

The old code...

{$I onguard.inc}
{$I-} { I/O checks disabled}
{$Q-} {Integer overflow check disabled.
Warning : at least one function (MixBlock) causes overflow}

...should become:

{$I onguard.inc}
{$I-} { I/O checks disabled}
{$IFDEF CPU32} // proposal of fix, for an identical behavior of MixBlock and HashElf (at least) using a Longint variable (32 bits), on a 32bits or 64bits CPU
  {$Q-}
{$ENDIF}
{$IFDEF CPU64}
  {$Q-}
  {$R-}
{$ENDIF} {Integer overflow check disabled.
Warning : at least one function (MixBlock) causes overflow} 

Regards.