Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.DSI.ECArith

Classes, interfaces and records

classtCustomECurve

inherits from tOptionallyRefCountedObject

implements iECurve, iDiscreteLogField

constructor Create; destructor Destroy; override; class function IsCurve(ACurve: iECurve): Boolean; virtual;
Always returns False.

classtECurve

inherits from tCustomECurve

(no public members)

recordtECFieldWs

Field workspace for the allocation-free EC scalar multiplication (tECPoint.InternalMulWs / InternalMulFixedWs). All members are preallocated local integers; see StreamSec.DSI.Arith.DSIWsMulMod.

fQ : iDSInteger;
field prime (normalized copy, field-sized)
fA : iDSInteger;
curve A normalized to [0,Q) (field-sized)
fInv2 : iDSInteger;
(Q+1)/2: multiplying by it halves mod Q
fMulTmp : iDSInteger;
internal register so MulMod dst may alias a source
fProd : iDSInteger;
double-width product scratch (generic path)
fQuot : iDSInteger;
quotient scratch (generic path)
fFieldWords: UInt32;
field element size in 32-bit words

classtECPointImpl

(no public members)

recordtECPoint

fX: iDSInteger; fY: iDSInteger; fZ: iDSInteger; fCurve: iECurve; fFixedType: Boolean;
when True, Multiply dispatches to InternalMulFixed (constant-time)
function ProjectiveToAffine: iECPoint; class function InternalMul(const aTerm0: tECPoint; const aTerm1: iDSInteger): tECPoint; static;
Variable-time sliding-window NAF scalar multiply (legacy allocating path; kept as the fallback for curves the workspace arithmetic does not support).
class function InternalMulFixed(const aTerm0: tECPoint; const aTerm1: iDSInteger): tECPoint; static;
Constant-time scalar multiply (legacy allocating path): base-point blinded Montgomery ladder over a FIXED width (group-order bits + scalar-blind margin), Fermat (fixed-time) affine.
class function InternalMulWs(const aTerm0: tECPoint; const aTerm1: iDSInteger): tECPoint; static;
Workspace-based variable-time multiply (no per-field-op pool traffic); falls back to InternalMul for unsupported curves.
class function InternalMulFixedWs(const aTerm0: tECPoint; const aTerm1: iDSInteger): tECPoint; static;
Workspace-based fixed-time multiply (same branchless ladder as InternalMulFixed, no per-field-op pool traffic).
procedure MakeInf(const aCurve: iECurve); function IsInf: Boolean;
Returns the IsZero value, obtained via fZ.

interfaceiECPointInternal

inherits from iECPoint

function Decompress(aCompressedBit: Boolean): Boolean; function CompressedBit: Boolean; function IsOnCurve: Boolean; function IsInf: Boolean;

classtECPointImpl

(no public members)

classtECPointContained

inherits from tECPointImpl

implements IUnknown, iGroupElement, iECPoint, iECPointInternal

constructor Create(const aCurve: iECurve);

classtECPointRefCounted

inherits from tECPointImpl

implements IUnknown, iGroupElement, iECPoint, iECPointInternal

constructor Create(const aCurve: iECurve); class function CreateInf(const aCurve: iECurve): tECPointRefCounted; procedure AfterConstruction; override; class function NewInstance: TObject{$IFDEF AUTOREFCOUNT} unsafe {$ENDIF}; override;

Types (enumerations, sets, aliases)

proctECWsMulModProc

aDst := (aX * aY) mod aWs.fQ, allocation-free; aDst may alias aX/aY.

  tECWsMulModProc = procedure(const aDst, aX, aY: iDSInteger; var aWs: tECFieldWs);

proctECWsMulModHook

Returns True and a MulMod implementation when aCurve has a dedicated fixed-modulus multiplier (e.g. tECurveP256's fused Solinas multiply).

  tECWsMulModHook = function(const aCurve: iECurve; out aProc: tECWsMulModProc): Boolean;

Routines