瀏覽代碼

Merge branch 'master' into travis

Ugochukwu Mmaduekwe 7 年之前
父節點
當前提交
e5e44d1193
共有 1 個文件被更改,包括 6 次插入11 次删除
  1. 6 11
      CryptoLib/src/Crypto/Signers/ClpECSchnorrSigner.pas

+ 6 - 11
CryptoLib/src/Crypto/Signers/ClpECSchnorrSigner.pas

@@ -54,12 +54,9 @@ type
 
   strict private
 
-    class var
-
-      FRandom: ISecureRandom;
-
   var
     FDigest: IDigest;
+    FRandom: ISecureRandom;
     FSigner: ISchnorr;
     FforSigning: Boolean;
     Fkey: IECKeyParameters;
@@ -85,8 +82,6 @@ type
     function Sign_K(const pv_key: IECPrivateKeyParameters; const k: TBigInteger)
       : TCryptoLibByteArray;
 
-    class constructor ECSchnorrSigner();
-
   public
 
     function Do_Sign(const pv_key: IECPrivateKeyParameters;
@@ -222,11 +217,6 @@ implementation
 
 { TECSchnorrSigner }
 
-class constructor TECSchnorrSigner.ECSchnorrSigner;
-begin
-  FRandom := TSecureRandom.Create();
-end;
-
 class function TECSchnorrSigner.Encode_Sig(const r, s: TBigInteger)
   : TCryptoLibByteArray;
 begin
@@ -336,7 +326,12 @@ begin
 
     if (Supports(Lparameters, IParametersWithRandom, rParam)) then
     begin
+      FRandom := rParam.Random;
       Lparameters := rParam.parameters;
+    end
+    else
+    begin
+      FRandom := TSecureRandom.Create();
     end;
 
     if (not(Supports(Lparameters, IECPrivateKeyParameters))) then