This unit follows the pattern of StreamSec.DSI.CurveXArith (RFC 7748) but is deliberately self-contained: the field arithmetic over GF(2^255-19) and GF(2^448-2^224-1) is replicated here rather than imported. Scalar multiplication uses a Montgomery-ladder schedule over the COMPLETE twisted-Edwards (Ed25519, extended coordinates) / Edwards (Ed448, projective coordinates) addition formulas: a fixed trip count with one point addition, one point doubling and two branchless conditional swaps per scalar bit - no secret-dependent branches or memory indices. This unit contains the CURVE ARITHMETIC only. The RFC 8032 signature and verification schemes (hashing, key derivation, dom4) are implemented by tDSIEdDSA in StreamSec.DSI.EdDSA (obtain that pool via GetDSIED). The curve classes plug into the same group framework as the fixed-time ECDSA scheme (dlssaDSAFixedTime): the points implement iGroupElement with FixedGroupOpIteration, which here delegates to the (already constant-time) ladder.
GF(2^255-19) field element, 8 x 32 bit little endian limbs
class procedure InvModTo(const aA: tFe25519; var aResult: tFe25519); static;
class procedure PowP58To(const aA: tFe25519; var aResult: tFe25519); static;
class procedure Swap(var aA, aB: tFe25519; aBit: NativeUInt); static;
class function Same(const aA, aB: tFe25519): Boolean; static;
procedure Normalize;
function IsZero: Boolean;
function IsOdd: NativeUInt;
Ed25519 scalar, 8 x 32 bit little endian limbs (256 bits)
procedure Clear;
procedure Clamp;
function GetBit(aIndex: Integer): NativeUInt;
Ed25519 group element in extended homogeneous coordinates (X:Y:Z:T), x = X/Z, y = Y/Z, x*y = T/Z on -x^2+y^2 = 1+d*x^2*y^2
procedure SetNeutral;
procedure FromAffine(const aX, aY: tFe25519);
procedure ToAffineTo(var aX, aY: tFe25519);
class procedure AddTo(const aA, aB: tGe25519; var aResult: tGe25519); static;
class procedure DoubleTo(const aA: tGe25519; var aResult: tGe25519); static;
class procedure Swap(var aA, aB: tGe25519; aBit: NativeUInt); static;
class procedure ScalarMultTo(const aK: tEdScalar25519; const aP: tGe25519; var aResult: tGe25519); static;
function Encode: tBytes;
function Decode(const aEnc: tBytes): Boolean;
GF(2^448-2^224-1) field element, 14 x 32 bit little endian limbs
(no public members)
class procedure InvModTo(const aA: tFe448; var aResult: tFe448); static;
class procedure PowP34To(const aA: tFe448; var aResult: tFe448); static;
class procedure Swap(var aA, aB: tFe448; aBit: NativeUInt); static;
class function Same(const aA, aB: tFe448): Boolean; static;
procedure Normalize;
function IsZero: Boolean;
function IsOdd: NativeUInt;
Ed448 scalar, 14 x 32 bit little endian limbs (448 bits; byte 56 of the 57-byte RFC 8032 secret scalar is always zero after clamping)
procedure Clear;
procedure Clamp;
function GetBit(aIndex: Integer): NativeUInt;
Ed448 group element in projective coordinates (X:Y:Z), x = X/Z, y = Y/Z on x^2+y^2 = 1+d*x^2*y^2 (a = 1, d = -39081; the addition law is complete)
procedure SetNeutral;
procedure FromAffine(const aX, aY: tFe448);
procedure ToAffineTo(var aX, aY: tFe448);
class procedure AddTo(const aA, aB: tGe448; var aResult: tGe448); static;
class procedure DoubleTo(const aA: tGe448; var aResult: tGe448); static;
class procedure Swap(var aA, aB: tGe448; aBit: NativeUInt); static;
class procedure ScalarMultTo(const aK: tEdScalar448; const aP: tGe448; var aResult: tGe448); static;
function Encode: tBytes;
function Decode(const aEnc: tBytes): Boolean;
function GroupOpIteration(const aGenerator : iGroupElement; const aIterationCount: iDSInteger; var aResult) : Boolean;
procedure GroupOperation(const aFactor1: iGroupElement; const aFactor2: iGroupElement; var aDest);
function GroupElementToInteger(const aElement: iGroupElement; var aResult : iDSInteger) : Boolean;
function PointOnCurve(const aElement: iGroupElement): Boolean;
inherits from tCustomECurve
implements iEdDsaCurveInternal, iGroup
(no public members)
inherits from tECPointImpl
implements iGroupElement
(no public members)
inherits from tCustomEdDsaPointImpl
implements IUnknown, iGroupElement, iECPoint, iECPointInternal
constructor Create(const aCurve: iECurve);
inherits from tCustomEdDsaPointImpl
implements IUnknown, iGroupElement, iECPoint, iECPointInternal
constructor Create(const aCurve: iECurve);
procedure AfterConstruction; override;
class function NewInstance: TObject{$IFDEF AUTOREFCOUNT} unsafe {$ENDIF}; override;
inherits from tCustomEdDsaCurve
implements IECurve
class function IsCurve(ACurve: iECurve): Boolean; override;
inherits from tCustomEdDsaCurve
implements IECurve
class function IsCurve(ACurve: iECurve): Boolean; override;