Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TBlake2BTreeConfig = class sealed(TInterfacedObject, IBlake2BTreeConfig)
procedure ValidateInnerHashSize(AInnerHashSize: Byte); inline;
procedure ValidateMaxDepth(AMaxDepth: Byte); inline;
procedure ValidateNodeDepth(ANodeDepth: Byte); inline;
procedure ValidateNodeOffset(ANodeOffset: UInt64); inline;
procedure ValidateNodeOffset(ANodeOffset: UInt64);

function GetFanOut: Byte; inline;
procedure SetFanOut(AValue: Byte); inline;
Expand Down Expand Up @@ -342,9 +342,10 @@ procedure TBlake2BTreeConfig.ValidateNodeDepth(ANodeDepth: Byte);
end;

procedure TBlake2BTreeConfig.ValidateNodeOffset(ANodeOffset: UInt64);
const
MaxNodeOffset: UInt64 = $FFFFFFFFFFFFFFFF; // (2^64) - 1
begin
// ANodeOffset > ((2^64) - 1)
if ANodeOffset > System.High(UInt64) then
if ANodeOffset > MaxNodeOffset then
begin
raise EArgumentInvalidHashLibException.CreateRes
(@SInvalidNodeOffsetParameter);
Expand Down
7 changes: 7 additions & 0 deletions HashLib/src/Include/HashLib.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
{$MESSAGE ERROR 'This Library requires Delphi 2010 or higher.'}
{$IFEND}

// Silence H2586 (legacy $IFEND) on XE4+ where $ENDIF can also close $IF.
// The $LEGACYIFEND directive itself was introduced in XE4 (25.0), so the
// guard is necessary to keep Delphi 2010 / XE / XE2 / XE3 compiling.
{$IF CompilerVersion >= 25.0}
{$LEGACYIFEND ON}
{$IFEND}

{$DEFINE DELPHI}

{$DEFINITIONINFO ON} // Enable code browsing (Ctrl+Click)
Expand Down
18 changes: 14 additions & 4 deletions HashLib/src/Utils/HlpArmHwCapProvider.pas
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,17 @@ implementation

class procedure TArmHwCapProvider.ResolveDynamicImports();
var
LHandle: Pointer;
LHandle: NativeUInt;
begin
FGetAuxVal := nil;

{$IFDEF FPC}
LHandle := NativeUInt(dlopen(nil, RTLD_NOW));
{$ELSE}
LHandle := dlopen(nil, RTLD_NOW);
if LHandle = nil then
{$ENDIF}

if LHandle = 0 then
Exit;

try
Expand Down Expand Up @@ -179,12 +184,17 @@ class function TArmHwCapProvider.GetHwCap2(): UInt64;

class procedure TArmHwCapProvider.ResolveDynamicImports();
var
LHandle: Pointer;
LHandle: NativeUInt;
begin
FElfAuxInfo := nil;

{$IFDEF FPC}
LHandle := NativeUInt(dlopen(nil, RTLD_NOW));
{$ELSE}
LHandle := dlopen(nil, RTLD_NOW);
if LHandle = nil then
{$ENDIF}

if LHandle = 0 then
Exit;

try
Expand Down
Loading