Skip to content

Commit d90506b

Browse files
committed
Only initialise static data once
1 parent 21f2eac commit d90506b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

crypto/test/src/crypto/test/NaccacheSternTest.cs

+16-16
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ public class NaccacheSternTest
3737
static readonly NaccacheSternEngine cryptEng = new NaccacheSternEngine();
3838
static readonly NaccacheSternEngine decryptEng = new NaccacheSternEngine();
3939

40-
static NaccacheSternTest()
41-
{
42-
cryptEng.Debug = debug;
43-
decryptEng.Debug = debug;
44-
}
45-
4640
// Values from NaccacheStern paper
4741
static readonly BigInteger a = BigInteger.ValueOf(101);
4842
static readonly BigInteger u1 = BigInteger.ValueOf(3);
@@ -82,6 +76,22 @@ static readonly BigInteger phi_n
8276
//
8377
static readonly string edgeInput = "ff6f77206973207468652074696d6520666f7220616c6c20676f6f64206d656e";
8478

79+
static NaccacheSternTest()
80+
{
81+
cryptEng.Debug = debug;
82+
decryptEng.Debug = debug;
83+
84+
// First the Parameters from the NaccacheStern Paper
85+
// (see http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf )
86+
87+
smallPrimes.Add(u1);
88+
smallPrimes.Add(u2);
89+
smallPrimes.Add(u3);
90+
smallPrimes.Add(v1);
91+
smallPrimes.Add(v2);
92+
smallPrimes.Add(v3);
93+
}
94+
8595
public override string Name
8696
{
8797
get { return "NaccacheStern"; }
@@ -91,16 +101,6 @@ public override void PerformTest()
91101
{
92102
// Test with given key from NaccacheSternPaper (totally insecure)
93103

94-
// First the Parameters from the NaccacheStern Paper
95-
// (see http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf )
96-
97-
smallPrimes.Add(u1);
98-
smallPrimes.Add(u2);
99-
smallPrimes.Add(u3);
100-
smallPrimes.Add(v1);
101-
smallPrimes.Add(v2);
102-
smallPrimes.Add(v3);
103-
104104
NaccacheSternKeyParameters pubParameters = new NaccacheSternKeyParameters(false, g, n, sigma.BitLength);
105105

106106
NaccacheSternPrivateKeyParameters privParameters = new NaccacheSternPrivateKeyParameters(g, n, sigma

0 commit comments

Comments
 (0)