File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
JCMathLib/src/opencrypto/jcmathlib Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,21 @@ private void from_x(Bignat x) {
468
468
ech .unlock (ech .uncompressed_point_arr1 );
469
469
}
470
470
471
+ /**
472
+ * Returns true if Y coordinate is even; false otherwise.
473
+ *
474
+ * @return true if Y coordinate is even; false otherwise
475
+ */
476
+ public boolean is_y_even () {
477
+ ech .fnc_is_y .lock ();
478
+ ech .lock (ech .uncompressed_point_arr1 );
479
+ thePoint .getW (ech .uncompressed_point_arr1 , (short ) 0 );
480
+ boolean result = ech .uncompressed_point_arr1 [(short )(theCurve .POINT_SIZE - 1 )] % 2 == 0 ;
481
+ ech .unlock (ech .uncompressed_point_arr1 );
482
+ ech .fnc_is_y .unlock ();
483
+ return result ;
484
+ }
485
+
471
486
/**
472
487
* Compares this and provided point for equality. The comparison is made using hash of both values to prevent leak of position of mismatching byte.
473
488
* @param other second point for comparison
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public class ECPoint_Helper extends Base_Helper {
15
15
public static final byte Signature_ALG_ECDSA_SHA_256 = (byte ) 33 ;
16
16
17
17
/**
18
- * I true, fast multiplication of ECPoints via KeyAgreement can be used Is
18
+ * If true, fast multiplication of ECPoints via KeyAgreement can be used. Is
19
19
* set automatically after successful allocation of required engines
20
20
*/
21
21
public boolean FLAG_FAST_EC_MULT_VIA_KA = false ;
@@ -45,6 +45,8 @@ public class ECPoint_Helper extends Base_Helper {
45
45
Bignat fnc_from_x_y_sq ;
46
46
Bignat fnc_from_x_y ;
47
47
48
+ Bignat fnc_is_y ;
49
+
48
50
KeyAgreement fnc_multiplication_x_keyAgreement ;
49
51
Signature fnc_SignVerifyECDSA_signEngine ;
50
52
MessageDigest fnc_isEqual_hashEngine ;
@@ -92,6 +94,8 @@ void initialize() {
92
94
Bignat fnc_from_x_y_sq ;
93
95
Bignat fnc_from_x_y ;
94
96
97
+ fnc_is_y = rm .helperEC_BN_C ;
98
+
95
99
fnc_isEqual_hashArray = rm .helper_hashArray ;
96
100
fnc_isEqual_hashEngine = rm .hashEngine ;
97
101
You can’t perform that action at this time.
0 commit comments