Browse Source

fix bug in test.

Ugochukwu Mmaduekwe 6 years ago
parent
commit
ffb0187c1c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      CryptoLib.Tests/src/Others/Ed25519HigherLevelTests.pas

+ 4 - 2
CryptoLib.Tests/src/Others/Ed25519HigherLevelTests.pas

@@ -233,6 +233,7 @@ var
   Signer, verifier: ISigner;
   Signer, verifier: ISigner;
   shouldVerify, shouldNotVerify: Boolean;
   shouldVerify, shouldNotVerify: Boolean;
   algorithmName: String;
   algorithmName: String;
+  tempRand: Int32;
 begin
 begin
   kpg := TEd25519KeyPairGenerator.Create();
   kpg := TEd25519KeyPairGenerator.Create();
   kpg.Init(TEd25519KeyGenerationParameters.Create(FRandom)
   kpg.Init(TEd25519KeyGenerationParameters.Create(FRandom)
@@ -263,8 +264,9 @@ begin
     Fail(Format('Ed25519 (%s) signature failed to verify', [algorithmName]));
     Fail(Format('Ed25519 (%s) signature failed to verify', [algorithmName]));
   end;
   end;
 
 
-  signature[FRandom.Next() mod System.length(signature)] :=
-    signature[FRandom.Next() mod System.length(signature)
+  tempRand := FRandom.Next();
+  signature[tempRand mod System.length(signature)] :=
+    signature[tempRand mod System.length(signature)
     ] xor Byte(1 shl (FRandom.NextInt32 and 7));
     ] xor Byte(1 shl (FRandom.NextInt32 and 7));
 
 
   verifier.Init(False, publicKey);
   verifier.Init(False, publicKey);