Browse Source

fix compiler warnings

Ugochukwu Mmaduekwe 6 years ago
parent
commit
0e222a4a68

+ 0 - 1
CryptoLib/src/Crypto/Engines/ClpSalsa20Engine.pas

@@ -28,7 +28,6 @@ uses
   ClpISalsa20Engine,
   ClpIKeyParameter,
   ClpICipherParameters,
-  ClpParametersWithIV,
   ClpIParametersWithIV,
   ClpConverters,
   ClpCryptoLibTypes;

+ 0 - 1
CryptoLib/src/Crypto/Signers/ClpSchnorrDigestSigner.pas

@@ -32,7 +32,6 @@ uses
   ClpBigInteger,
   ClpCryptoLibTypes,
   ClpIParametersWithRandom,
-  ClpSignersEncodings,
   ClpIAsymmetricKeyParameter,
   ClpICipherParameters,
   ClpISigner;

+ 0 - 5
CryptoLib/src/Interfaces/ClpISignersEncodings.pas

@@ -103,11 +103,6 @@ type
     procedure EncodeValue(const n, x: TBigInteger;
       const buf: TCryptoLibByteArray; off, len: Int32);
 
-    function Decode(const n: TBigInteger; const encoding: TCryptoLibByteArray)
-      : TCryptoLibGenericArray<TBigInteger>;
-
-    function Encode(const n, r, s: TBigInteger): TCryptoLibByteArray;
-
   end;
 
 implementation

+ 5 - 1
CryptoLib/src/Math/ClpBigInteger.pas

@@ -305,13 +305,14 @@ type
     class procedure ShiftRightOneInPlace(start: Int32;
       const mag: TCryptoLibInt32Array); static;
 
+{$IFNDEF _FIXINSIGHT_}
     /// <summary>
     /// returns x = x - y - we assume x is &gt;= y
     /// </summary>
     class function Subtract(xStart: Int32; const x: TCryptoLibInt32Array;
       yStart: Int32; const y: TCryptoLibInt32Array): TCryptoLibInt32Array;
       overload; static;
-
+{$ENDIF}
     class function doSubBigLil(const bigMag, lilMag: TCryptoLibInt32Array)
       : TCryptoLibInt32Array; static; inline;
 
@@ -2739,6 +2740,8 @@ begin
   Result := TBigInteger.Create(1, yVal, True);
 end;
 
+{$IFNDEF _FIXINSIGHT_}
+
 class function TBigInteger.Subtract(xStart: Int32;
   const x: TCryptoLibInt32Array; yStart: Int32; const y: TCryptoLibInt32Array)
   : TCryptoLibInt32Array;
@@ -2780,6 +2783,7 @@ begin
 
   Result := x;
 end;
+{$ENDIF}
 
 class procedure TBigInteger.MontgomeryReduce(const x, m: TCryptoLibInt32Array;
   mDash: UInt32);

+ 10 - 7
CryptoLib/src/Math/EC/ClpECC.pas

@@ -243,7 +243,8 @@ type
 
     property Q: TBigInteger read GetQ;
 
-    function Equals(const other: IFpFieldElement): Boolean; reintroduce; overload;
+    function Equals(const other: IFpFieldElement): Boolean;
+      reintroduce; overload;
 
     function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt;
 {$ENDIF DELPHI}override;
@@ -393,7 +394,8 @@ type
 
     function SquarePow(pow: Int32): IECFieldElement; override;
 
-    function Equals(const other: IF2mFieldElement): Boolean; reintroduce; overload;
+    function Equals(const other: IF2mFieldElement): Boolean;
+      reintroduce; overload;
 
     function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt;
 {$ENDIF DELPHI}override;
@@ -1091,7 +1093,8 @@ type
     function GetIsInfinity: Boolean; inline;
     function GetIsCompressed: Boolean; inline;
     function GetpreCompTable: TDictionary<String, IPreCompInfo>; inline;
-    procedure SetpreCompTable(const Value: TDictionary<String, IPreCompInfo>); inline;
+    procedure SetpreCompTable(const Value
+      : TDictionary<String, IPreCompInfo>); inline;
     function GetCurve: IECCurve; virtual;
     function GetCurveCoordinateSystem: Int32; virtual;
     function GetAffineXCoord: IECFieldElement; virtual;
@@ -1718,8 +1721,8 @@ begin
   xx := (x as IF2mFieldElement).x;
   yx := (y as IF2mFieldElement).x;
 
-  ab := ax.Multiply(bx, Fm, FKs);
-  xy := xx.Multiply(yx, Fm, FKs);
+  ab := ax.Multiply(bx);
+  xy := xx.Multiply(yx);
 
   if ((ab.Equals(ax)) or (ab.Equals(bx))) then
   begin
@@ -1770,8 +1773,8 @@ begin
   xx := (x as IF2mFieldElement).x;
   yx := (y as IF2mFieldElement).x;
 
-  aa := ax.Square(Fm, FKs);
-  xy := xx.Multiply(yx, Fm, FKs);
+  aa := ax.Square();
+  xy := xx.Multiply(yx);
 
   if (aa.Equals(ax)) then
   begin

+ 8 - 12
CryptoLib/src/Math/EC/ClpLongArray.pas

@@ -515,8 +515,8 @@ type
     class procedure FlipVector(const x: TCryptoLibInt64Array; xOff: Int32;
       const y: TCryptoLibInt64Array; yOff, yLen, bits: Int32); static;
 
-    class procedure SquareInPlace(const x: TCryptoLibInt64Array; xLen, m: Int32;
-      const ks: TCryptoLibInt32Array); static; inline;
+    class procedure SquareInPlace(const x: TCryptoLibInt64Array; xLen: Int32);
+      static; inline;
 
     class procedure Interleave(const x: TCryptoLibInt64Array; xOff: Int32;
       const z: TCryptoLibInt64Array; zOff, count, width: Int32); static; inline;
@@ -603,8 +603,7 @@ type
     function ModReduce(m: Int32; const ks: TCryptoLibInt32Array)
       : TLongArray; inline;
 
-    function Multiply(const other: TLongArray; m: Int32;
-      const ks: TCryptoLibInt32Array): TLongArray;
+    function Multiply(const other: TLongArray): TLongArray;
 
     procedure Reduce(m: Int32; const ks: TCryptoLibInt32Array); inline;
 
@@ -614,8 +613,7 @@ type
     function ModSquareN(n, m: Int32; const ks: TCryptoLibInt32Array)
       : TLongArray; inline;
 
-    function Square(m: Int32; const ks: TCryptoLibInt32Array)
-      : TLongArray; inline;
+    function Square(): TLongArray; inline;
 
     function ModInverse(m: Int32; const ks: TCryptoLibInt32Array): TLongArray;
 
@@ -787,7 +785,7 @@ begin
 end;
 
 class procedure TLongArray.SquareInPlace(const x: TCryptoLibInt64Array;
-  xLen, m: Int32; const ks: TCryptoLibInt32Array);
+  xLen: Int32);
 var
   pos: Int32;
   xVal: Int64;
@@ -2241,7 +2239,7 @@ begin
   System.Dec(n);
   while (n >= 0) do
   begin
-    SquareInPlace(r, len, m, ks);
+    SquareInPlace(r, len);
     len := ReduceInPlace(r, 0, System.Length(r), m, ks);
     System.Dec(n);
   end;
@@ -2249,8 +2247,7 @@ begin
   Result := TLongArray.Create(r, 0, len);
 end;
 
-function TLongArray.Multiply(const other: TLongArray; m: Int32;
-  const ks: TCryptoLibInt32Array): TLongArray;
+function TLongArray.Multiply(const other: TLongArray): TLongArray;
 var
   aDeg, bDeg, tmp, aLen, bLen, cLen, bMax, tOff, I, MASK, aPos, cOff,
     u, v: Int32;
@@ -2501,8 +2498,7 @@ begin
   Result := prev;
 end;
 
-function TLongArray.Square(m: Int32; const ks: TCryptoLibInt32Array)
-  : TLongArray;
+function TLongArray.Square(): TLongArray;
 var
   len, _2len, pos: Int32;
   r: TCryptoLibInt64Array;