瀏覽代碼

some units refactorings

Ugochukwu Mmaduekwe 1 周之前
父節點
當前提交
aaea9a7067

+ 0 - 2
CryptoLib.Tests/Delphi.Tests/CryptoLib.Tests.dpr

@@ -533,8 +533,6 @@ uses
   ClpNat576 in '..\..\CryptoLib\src\Math\Raw\ClpNat576.pas',
   ClpNullable in '..\..\CryptoLib\src\Misc\ClpNullable.pas',
   ClpFixedSecureRandom in '..\src\Utils\ClpFixedSecureRandom.pas',
-  ClpIFixedSecureRandom in '..\src\Utils\ClpIFixedSecureRandom.pas',
-  ClpIShortenedDigest in '..\src\Utils\ClpIShortenedDigest.pas',
   ClpShortenedDigest in '..\src\Utils\ClpShortenedDigest.pas',
   BlowfishTestVectors in '..\src\Crypto\BlowfishTestVectors.pas',
   AESTestVectors in '..\src\Crypto\AESTestVectors.pas',

+ 0 - 1
CryptoLib.Tests/src/Crypto/DSATests.pas

@@ -81,7 +81,6 @@ uses
   ClpISecureRandom,
   ClpSecureRandom,
   ClpFixedSecureRandom,
-  ClpIFixedSecureRandom,
   ClpConverters,
   ClpCryptoLibTypes,
   CryptoLibTestBase;

+ 0 - 1
CryptoLib.Tests/src/Crypto/Kdf1GeneratorTests.pas

@@ -33,7 +33,6 @@ uses
 {$ENDIF FPC}
   ClpDigestUtilities,
   ClpShortenedDigest,
-  ClpIShortenedDigest,
   ClpIDerivationFunction,
   ClpIIso18033KdfParameters,
   ClpIso18033KdfParameters,

+ 0 - 1
CryptoLib.Tests/src/Crypto/Kdf2GeneratorTests.pas

@@ -33,7 +33,6 @@ uses
 {$ENDIF FPC}
   ClpDigestUtilities,
   ClpShortenedDigest,
-  ClpIShortenedDigest,
   ClpIDerivationFunction,
   ClpKdfParameters,
   ClpIKdfParameters,

+ 0 - 1
CryptoLib.Tests/src/Others/ShortenedDigestTests.pas

@@ -32,7 +32,6 @@ uses
   TestFramework,
 {$ENDIF FPC}
   ClpIDigest,
-  ClpIShortenedDigest,
   ClpShortenedDigest,
   ClpDigestUtilities,
   ClpCryptoLibTypes,

+ 24 - 1
CryptoLib.Tests/src/Utils/ClpFixedSecureRandom.pas

@@ -30,7 +30,6 @@ uses
   ClpCryptoLibTypes,
   ClpPack,
   ClpBigInteger,
-  ClpIFixedSecureRandom,
   ClpISecureRandom,
   ClpSecureRandom;
 
@@ -40,6 +39,30 @@ resourcestring
   SUnRecognizedImplementation = 'Unrecognized BigIntegerSource Implementation';
 
 type
+  IFixedSecureRandom = interface(ISecureRandom)
+    ['{8D3C436D-1E93-487F-9C03-5E0EEFBCBBB4}']
+    function GetIsExhausted: Boolean;
+    property IsExhausted: Boolean read GetIsExhausted;
+  end;
+
+  IRandomChecker = interface(ISecureRandom)
+    ['{EFC0D597-00E4-4DAE-8529-E14C9FE50B41}']
+  end;
+
+  ISource = interface(IInterface)
+    ['{D4391E69-BA80-4245-BB94-52715BC6D043}']
+    function GetData: TCryptoLibByteArray;
+    property Data: TCryptoLibByteArray read GetData;
+  end;
+
+  IData = interface(ISource)
+    ['{CF4AB8B8-724D-4EEA-93F5-0732C81774F0}']
+  end;
+
+  IBigIntegerSource = interface(ISource)
+    ['{202BF4D8-D872-4757-8C0F-D76228CEDB92}']
+  end;
+
   TFixedSecureRandom = class(TSecureRandom, IFixedSecureRandom)
 
   strict private

+ 0 - 61
CryptoLib.Tests/src/Utils/ClpIFixedSecureRandom.pas

@@ -1,61 +0,0 @@
-{ *********************************************************************************** }
-{ *                              CryptoLib Library                                  * }
-{ *                Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe                    * }
-{ *                 Github Repository <https://github.com/Xor-el>                   * }
-
-{ *  Distributed under the MIT software license, see the accompanying file LICENSE  * }
-{ *          or visit http://www.opensource.org/licenses/mit-license.php.           * }
-
-{ *                              Acknowledgements:                                  * }
-{ *                                                                                 * }
-{ *      Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring     * }
-{ *                           development of this library                           * }
-
-{ * ******************************************************************************* * }
-
-(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
-
-unit ClpIFixedSecureRandom;
-
-interface
-
-{$IFDEF FPC}
-{$MODE DELPHI}
-{$ENDIF FPC}
-
-uses
-  ClpISecureRandom,
-  ClpCryptoLibTypes;
-
-type
-  IFixedSecureRandom = interface(ISecureRandom)
-    ['{8D3C436D-1E93-487F-9C03-5E0EEFBCBBB4}']
-
-    function GetIsExhausted: Boolean;
-
-    property IsExhausted: Boolean read GetIsExhausted;
-
-  end;
-
-  IRandomChecker = interface(ISecureRandom)
-    ['{EFC0D597-00E4-4DAE-8529-E14C9FE50B41}']
-  end;
-
-  ISource = interface(IInterface)
-    ['{D4391E69-BA80-4245-BB94-52715BC6D043}']
-    function GetData: TCryptoLibByteArray;
-
-    property Data: TCryptoLibByteArray read GetData;
-  end;
-
-  IData = interface(ISource)
-    ['{CF4AB8B8-724D-4EEA-93F5-0732C81774F0}']
-  end;
-
-  IBigIntegerSource = interface(ISource)
-    ['{202BF4D8-D872-4757-8C0F-D76228CEDB92}']
-  end;
-
-implementation
-
-end.

+ 0 - 38
CryptoLib.Tests/src/Utils/ClpIShortenedDigest.pas

@@ -1,38 +0,0 @@
-{ *********************************************************************************** }
-{ *                              CryptoLib Library                                  * }
-{ *                Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe                    * }
-{ *                 Github Repository <https://github.com/Xor-el>                   * }
-
-{ *  Distributed under the MIT software license, see the accompanying file LICENSE  * }
-{ *          or visit http://www.opensource.org/licenses/mit-license.php.           * }
-
-{ *                              Acknowledgements:                                  * }
-{ *                                                                                 * }
-{ *      Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring     * }
-{ *                           development of this library                           * }
-
-{ * ******************************************************************************* * }
-
-(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
-
-unit ClpIShortenedDigest;
-
-interface
-
-{$IFDEF FPC}
-{$MODE DELPHI}
-{$ENDIF FPC}
-
-uses
-  ClpIDigest;
-
-type
-
-  IShortenedDigest = interface(IDigest)
-    ['{E19D250B-CAE0-4959-9211-80853FCF4ADD}']
-
-  end;
-
-implementation
-
-end.

+ 3 - 1
CryptoLib.Tests/src/Utils/ClpShortenedDigest.pas

@@ -26,7 +26,6 @@ uses
   SysUtils,
   HlpIHash,
   ClpIDigest,
-  ClpIShortenedDigest,
   ClpCryptoLibTypes;
 
 resourcestring
@@ -35,6 +34,9 @@ resourcestring
     'BaseDigest output not large enough to support length';
 
 type
+  IShortenedDigest = interface(IDigest)
+    ['{E19D250B-CAE0-4959-9211-80853FCF4ADD}']
+  end;
 
   /// <summary>
   /// Wrapper class that reduces the output length of a particular digest to