66
77/**
88 *
9- * @author Petr Svenda
9+ * @author Petr Svenda
1010 */
1111public class ECPoint_Helper extends Base_Helper {
1212 // Selected constants missing from older JC API specs
@@ -19,11 +19,11 @@ public class ECPoint_Helper extends Base_Helper {
1919 * set automatically after successful allocation of required engines
2020 */
2121 public boolean FLAG_FAST_EC_MULT_VIA_KA = false ;
22-
22+
2323 byte [] uncompressed_point_arr1 ;
2424 byte [] fnc_isEqual_hashArray ;
2525 byte [] fnc_multiplication_resultArray ;
26-
26+
2727 // These Bignats are just pointing to some helperEC_BN_? so reasonable naming is preserved yet no need to actually allocated whole Bignat object
2828 Bignat fnc_add_x_r ; // frequent write
2929 Bignat fnc_add_y_r ; // frequent write
@@ -33,21 +33,25 @@ public class ECPoint_Helper extends Base_Helper {
3333 Bignat fnc_add_lambda ; // write mod_mul (but only final result)
3434 Bignat fnc_add_nominator ; // frequent write
3535 Bignat fnc_add_denominator ; // frequent write
36-
36+
3737 Bignat fnc_multiplication_x ; // result write
3838 Bignat fnc_multiplication_y_sq ; // frequent write
3939 Bignat fnc_multiplication_scalar ; // write once, read
4040 Bignat fnc_multiplication_y1 ; // mostly just read, write inside sqrt_FP
4141 Bignat fnc_multiplication_y2 ; // mostly just read, result write
4242 Bignat fnc_negate_yBN ; // mostly just read, result write
43-
43+
44+ Bignat fnc_from_x_x ;
45+ Bignat fnc_from_x_y_sq ;
46+ Bignat fnc_from_x_y ;
47+
4448 KeyAgreement fnc_multiplication_x_keyAgreement ;
4549 Signature fnc_SignVerifyECDSA_signEngine ;
4650 MessageDigest fnc_isEqual_hashEngine ;
47-
51+
4852 public ECPoint_Helper (ResourceManager rm ) {
4953 super (rm );
50-
54+
5155 FLAG_FAST_EC_MULT_VIA_KA = false ; // set true only if succesfully allocated and tested below
5256 try {
5357 //fnc_multiplication_x_keyAgreement = KeyAgreement.getInstance(KeyAgreement.ALG_EC_SVDP_DHC, false);
@@ -57,9 +61,9 @@ public ECPoint_Helper(ResourceManager rm) {
5761 fnc_SignVerifyECDSA_signEngine = Signature .getInstance (Signature_ALG_ECDSA_SHA_256 , false );
5862 FLAG_FAST_EC_MULT_VIA_KA = true ;
5963 } catch (Exception ignored ) {
60- } // Discard any exception
64+ } // Discard any exception
6165 }
62-
66+
6367 void initialize () {
6468 // Important: assignment of helper BNs is made according to two criteria:
6569 // 1. Correctness: same BN must not be assigned to overlapping operations (guarded by lock/unlock)
@@ -74,21 +78,23 @@ void initialize() {
7478 fnc_add_nominator = rm .helperEC_BN_B ;
7579 fnc_add_denominator = rm .helperEC_BN_C ;
7680 fnc_add_lambda = rm .helperEC_BN_A ;
77-
81+
7882 fnc_multiplication_scalar = rm .helperEC_BN_F ;
7983 fnc_multiplication_x = rm .helperEC_BN_B ;
8084 fnc_multiplication_y_sq = rm .helperEC_BN_C ;
8185 fnc_multiplication_y1 = rm .helperEC_BN_D ;
8286 fnc_multiplication_y2 = rm .helperEC_BN_B ;
8387 fnc_multiplication_resultArray = rm .helper_BN_array1 ;
84-
88+
8589 fnc_negate_yBN = rm .helperEC_BN_C ;
86-
90+
91+ Bignat fnc_from_x_x ;
92+ Bignat fnc_from_x_y_sq ;
93+ Bignat fnc_from_x_y ;
94+
8795 fnc_isEqual_hashArray = rm .helper_hashArray ;
8896 fnc_isEqual_hashEngine = rm .hashEngine ;
8997
9098 uncompressed_point_arr1 = rm .helper_uncompressed_point_arr1 ;
91-
9299 }
93-
94100}
0 commit comments