@@ -36,9 +36,6 @@ class Player {
36
36
//private byte[] privbytes = {(byte)0xB3, (byte)0x46, (byte)0x67, (byte)0x55, (byte)0x18, (byte)0x08, (byte)0x46, (byte)0x23, (byte)0xBC, (byte)0x11, (byte)0x1C, (byte)0xC5, (byte)0x3F, (byte)0xF6, (byte)0x15, (byte)0xB1, (byte)0x52, (byte)0xA3, (byte)0xF6, (byte)0xD1, (byte)0x58, (byte)0x52, (byte)0x78, (byte)0x37, (byte)0x0F, (byte)0xA1, (byte)0xBA, (byte)0x0E, (byte)0xA1, (byte)0x60, (byte)0x23, (byte)0x7E};
37
37
public final byte [] privbytes_backdoored = {(byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 , (byte ) 0x55 };
38
38
39
- byte [] tmp_arr = null ; // TODO: used as array for temporary result -> move to resource manager
40
-
41
-
42
39
ECCurve theCurve = null ;
43
40
private KeyPair pair = null ;
44
41
private byte [] x_i_Bn = null ; // share xi , which is a randomly sampled element from Zn
@@ -67,7 +64,6 @@ public QuorumContext(ECConfig eccfg, ECCurve curve, MPCCryptoOperations cryptoOp
67
64
68
65
this .pair = theCurve .newKeyPair (this .pair );
69
66
x_i_Bn = JCSystem .makeTransientByteArray (Consts .SHARE_BASIC_SIZE , JCSystem .MEMORY_TYPE_TRANSIENT_RESET );
70
- tmp_arr = JCSystem .makeTransientByteArray (Consts .SHARE_DOUBLE_SIZE_CARRY , JCSystem .MEMORY_TYPE_TRANSIENT_RESET );
71
67
72
68
///////////
73
69
//Arrays//
@@ -130,8 +126,8 @@ public final void Reset(short numPlayers, short cardID, boolean bPrepareDecrypti
130
126
((ECPrivateKey ) pair .getPrivate ()).getS (x_i_Bn , (short ) 0 );
131
127
// Compute and set corresponding public key (to backdoored private one)
132
128
//CryptoOperations.placeholder.ScalarMultiplication(SecP256r1.G, (short) 0, (short) SecP256r1.G.length, privbytes_backdoored, tmp_arr);
133
- cryptoOps .placeholder .ScalarMultiplication (cryptoOps .GenPoint , privbytes_backdoored , tmp_arr );
134
- pub .setW (tmp_arr , (short ) 0 , (short ) 65 );
129
+ cryptoOps .placeholder .ScalarMultiplication (cryptoOps .GenPoint , privbytes_backdoored , cryptoOps . tmp_arr );
130
+ pub .setW (cryptoOps . tmp_arr , (short ) 0 , (short ) 65 );
135
131
} else {
136
132
// Legitimate generation of key as per protocol by non-compromised participants
137
133
((ECPrivateKey ) pair .getPrivate ()).getS (x_i_Bn , (short ) 0 );
@@ -185,7 +181,7 @@ public void SetYs(short id, byte[] Y, short YOffset, short YLength) {
185
181
if (!players [id ].bHashValid ) {
186
182
ISOException .throwIt (Consts .SW_INVALIDHASH );
187
183
}
188
- if (!VerifyPair (Y , YOffset , YLength , players [id ].hash )) {
184
+ if (!cryptoOps . VerifyPair (Y , YOffset , YLength , players [id ].hash )) {
189
185
ISOException .throwIt (Consts .SW_INVALIDHASH );
190
186
}
191
187
@@ -265,7 +261,7 @@ public ECPointBase GetY() {
265
261
// State -1
266
262
public void Invalidate (boolean bEraseAllArrays ) {
267
263
if (bEraseAllArrays ) {
268
- Util .arrayFillNonAtomic (tmp_arr , (short ) 0 , (short ) tmp_arr .length , (byte ) 0 );
264
+ Util .arrayFillNonAtomic (cryptoOps . tmp_arr , (short ) 0 , (short ) cryptoOps . tmp_arr .length , (byte ) 0 );
269
265
Util .arrayFillNonAtomic (x_i_Bn , (short ) 0 , (short ) x_i_Bn .length , (byte ) 0 );
270
266
}
271
267
// Invalidate all items
@@ -281,20 +277,4 @@ public void Invalidate(boolean bEraseAllArrays) {
281
277
Y_EC_onTheFly_shares_count = 0 ;
282
278
}
283
279
284
- // State -1
285
- // /////////////////////////
286
- // Helper Functions
287
- // ////////////////////////
288
-
289
- private boolean VerifyPair (byte [] Ys , short YsOffset , short YsLength , byte [] hash ) {
290
- cryptoOps .md .reset ();
291
- cryptoOps .md .doFinal (Ys , YsOffset , YsLength , tmp_arr , (short ) 0 );
292
- if (Util .arrayCompare (tmp_arr , (short ) 0 , hash ,
293
- (short ) 0 , Consts .SHARE_BASIC_SIZE ) != 0 ) {
294
- return false ;
295
- } else {
296
- return true ;
297
- }
298
- }
299
-
300
280
}
0 commit comments