Browse Source

more minor refactoring.

Ugochukwu Mmaduekwe 7 years ago
parent
commit
91618dadda

+ 4 - 3
CryptoLib/src/Crypto/Generators/ClpBaseKdfBytesGenerator.pas

@@ -56,6 +56,7 @@ type
     Fdigest: IDigest;
     FcounterStart: Int32;
     Fshared, Fiv: TCryptoLibByteArray;
+
     function GetDigest(): IDigest; virtual;
 
   public
@@ -88,8 +89,8 @@ type
     /// <exception cref="EDataLengthCryptoLibException">
     /// if the out buffer is too small.
     /// </exception>
-    function GenerateBytes(output: TCryptoLibByteArray; outOff, length: Int32)
-      : Int32; virtual;
+    function GenerateBytes(const output: TCryptoLibByteArray;
+      outOff, length: Int32): Int32; virtual;
 
   end;
 
@@ -105,7 +106,7 @@ begin
   Fdigest := digest;
 end;
 
-function TBaseKdfBytesGenerator.GenerateBytes(output: TCryptoLibByteArray;
+function TBaseKdfBytesGenerator.GenerateBytes(const output: TCryptoLibByteArray;
   outOff, length: Int32): Int32;
 var
   outLen, cThreshold, i: Int32;

+ 2 - 0
CryptoLib/src/Crypto/Generators/ClpCipherKeyGenerator.pas

@@ -43,12 +43,14 @@ type
   TCipherKeyGenerator = class(TInterfacedObject, ICipherKeyGenerator)
 
   strict private
+  var
     Funinitialised: Boolean;
     FdefaultStrength: Int32;
 
     function GetdefaultStrength: Int32; inline;
 
   strict protected
+  var
     Frandom: ISecureRandom;
     Fstrength: Int32;
 

+ 3 - 3
CryptoLib/src/Crypto/Generators/ClpHkdfBytesGenerator.pas

@@ -101,8 +101,8 @@ type
 
     procedure Init(const parameters: IDerivationParameters); virtual;
 
-    function GenerateBytes(output: TCryptoLibByteArray; outOff, len: Int32)
-      : Int32; virtual;
+    function GenerateBytes(const output: TCryptoLibByteArray;
+      outOff, len: Int32): Int32; virtual;
 
     property Digest: IDigest read GetDigest;
 
@@ -161,7 +161,7 @@ begin
   result := TKeyParameter.Create(prk);
 end;
 
-function THkdfBytesGenerator.GenerateBytes(output: TCryptoLibByteArray;
+function THkdfBytesGenerator.GenerateBytes(const output: TCryptoLibByteArray;
   outOff, len: Int32): Int32;
 var
   toGenerate, posInT, leftInT, toCopy: Int32;

+ 3 - 3
CryptoLib/src/Crypto/Generators/ClpPascalCoinECIESKdfBytesGenerator.pas

@@ -76,8 +76,8 @@ type
     /// <exception cref="EDataLengthCryptoLibException">
     /// if the out buffer is too small.
     /// </exception>
-    function GenerateBytes(output: TCryptoLibByteArray; outOff, length: Int32)
-      : Int32; override;
+    function GenerateBytes(const output: TCryptoLibByteArray;
+      outOff, length: Int32): Int32; override;
 
   end;
 
@@ -91,7 +91,7 @@ begin
 end;
 
 function TPascalCoinECIESKdfBytesGenerator.GenerateBytes
-  (output: TCryptoLibByteArray; outOff, length: Int32): Int32;
+  (const output: TCryptoLibByteArray; outOff, length: Int32): Int32;
 var
   outLen: Int32;
   oBytes: Int64;

+ 1 - 1
CryptoLib/src/Interfaces/ClpIDerivationFunction.pas

@@ -45,7 +45,7 @@ type
 
     /// <exception cref="EDataLengthCryptoLibException" />
     /// <exception cref="EArgumentCryptoLibException" />
-    function GenerateBytes(output: TCryptoLibByteArray;
+    function GenerateBytes(const output: TCryptoLibByteArray;
       outOff, length: Int32): Int32;
 
   end;