You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
helper_BN_F = newBignat((short) (ecc.MAX_BIGNAT_SIZE + 2), ecc.memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_F), ecc); // +2 is to correct for infrequent RSA result with two or more leading zeroes
127
-
128
120
// BN below are just reassigned allocated helper_BN_? so that same helper_BN_? is not used in parallel (checked by lock() unlock())
129
-
fnc_mod_add_tmp = helper_BN_A;
121
+
fnc_mod_add_tmp = rm.helper_BN_A;
130
122
131
-
fnc_mod_sub_tmpThis = helper_BN_A;
132
-
fnc_mod_sub_tmp = helper_BN_B;
133
-
fnc_mod_sub_tmpOther = helper_BN_C;
123
+
fnc_mod_sub_tmpThis = rm.helper_BN_A;
124
+
fnc_mod_sub_tmp = rm.helper_BN_B;
125
+
fnc_mod_sub_tmpOther = rm.helper_BN_C;
134
126
135
-
fnc_mult_mod_tmpThis = helper_BN_A;
136
-
fnc_mult_mod_tmp_mod = helper_BN_B;
137
-
fnc_mult_mod_tmp_x = helper_BN_C;
127
+
fnc_mult_mod_tmpThis = rm.helper_BN_A;
128
+
fnc_mult_mod_tmp_mod = rm.helper_BN_B;
129
+
fnc_mult_mod_tmp_x = rm.helper_BN_C;
138
130
139
-
fnc_exponentiation_tmp = helper_BN_A;
140
-
fnc_exponentiation_i = helper_BN_B;
131
+
fnc_exponentiation_tmp = rm.helper_BN_A;
132
+
fnc_exponentiation_i = rm.helper_BN_B;
141
133
142
-
fnc_mod_minus_2 = helper_BN_B;
134
+
fnc_mod_minus_2 = rm.helper_BN_B;
143
135
144
-
fnc_negate_tmp = helper_BN_B;
136
+
fnc_negate_tmp = rm.helper_BN_B;
145
137
146
-
fnc_sqrt_S = helper_BN_A;
147
-
fnc_sqrt_exp = helper_BN_A;
148
-
fnc_sqrt_p_1 = helper_BN_B;
149
-
fnc_sqrt_Q = helper_BN_C;
150
-
fnc_sqrt_tmp = helper_BN_D;
151
-
fnc_sqrt_z = helper_BN_E;
138
+
fnc_sqrt_S = rm.helper_BN_A;
139
+
fnc_sqrt_exp = rm.helper_BN_A;
140
+
fnc_sqrt_p_1 = rm.helper_BN_B;
141
+
fnc_sqrt_Q = rm.helper_BN_C;
142
+
fnc_sqrt_tmp = rm.helper_BN_D;
143
+
fnc_sqrt_z = rm.helper_BN_E;
152
144
153
-
fnc_mod_mult_tmpThis = helper_BN_E; // mod_mult is called from fnc_sqrt => requires helper_BN_E not being locked in fnc_sqrt when mod_mult is called
145
+
fnc_mod_mult_tmpThis = rm.helper_BN_E; // mod_mult is called from fnc_sqrt => requires helper_BN_E not being locked in fnc_sqrt when mod_mult is called
154
146
155
-
fnc_divide_tmpThis = helper_BN_E; // divide is called from fnc_sqrt => requires helper_BN_E not being locked in fnc_sqrt when divide is called
147
+
fnc_divide_tmpThis = rm.helper_BN_E; // divide is called from fnc_sqrt => requires helper_BN_E not being locked in fnc_sqrt when divide is called
156
148
157
-
fnc_mod_exp_modBN = helper_BN_F; // mod_exp is called from fnc_sqrt => requires helper_BN_F not being locked in fnc_sqrt when mod_exp is called
149
+
fnc_mod_exp_modBN = rm.helper_BN_F; // mod_exp is called from fnc_sqrt => requires helper_BN_F not being locked in fnc_sqrt when mod_exp is called
158
150
159
-
fnc_int_add_tmpMag = helper_BN_A;
160
-
fnc_int_multiply_mod = helper_BN_A;
161
-
fnc_int_multiply_tmpThis = helper_BN_B;
162
-
fnc_int_divide_tmpThis = helper_BN_A;
151
+
fnc_int_add_tmpMag = rm.helper_BN_A;
152
+
fnc_int_multiply_mod = rm.helper_BN_A;
153
+
fnc_int_multiply_tmpThis = rm.helper_BN_B;
154
+
fnc_int_divide_tmpThis = rm.helper_BN_A;
155
+
163
156
164
157
// Allocate BN constants always in EEPROM (only reading)
165
-
ONE = newBignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, ecc);
158
+
ONE = newBignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this);
166
159
ONE.one();
167
-
TWO = newBignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, ecc);
160
+
TWO = newBignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this);
168
161
TWO.two();
169
-
THREE = newBignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, ecc);
162
+
THREE = newBignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this);
170
163
THREE.three();
171
164
165
+
tmp_array_short = rm.memAlloc.allocateByteArray((short) 2, JCSystem.MEMORY_TYPE_TRANSIENT_RESET); // only 2b RAM for faster add(short)
0 commit comments