Lines Matching refs:keyLength
41 static void ECC_Double(Point* q, Point* p, uint32_t keyLength) { in ECC_Double() argument
52 if (multiprecision_iszero(p->z, keyLength)) { in ECC_Double()
53 multiprecision_init(q->z, keyLength); in ECC_Double()
64 multiprecision_mersenns_squa_mod(t1, z1, keyLength); // t1=z1^2 in ECC_Double()
65 multiprecision_sub_mod(t2, x1, t1, keyLength); // t2=x1-t1 in ECC_Double()
66 multiprecision_add_mod(t1, x1, t1, keyLength); // t1=x1+t1 in ECC_Double()
67 multiprecision_mersenns_mult_mod(t2, t1, t2, keyLength); // t2=t2*t1 in ECC_Double()
68 multiprecision_lshift_mod(t3, t2, keyLength); in ECC_Double()
69 multiprecision_add_mod(t2, t3, t2, keyLength); // t2=3t2 in ECC_Double()
71 multiprecision_mersenns_mult_mod(z3, y1, z1, keyLength); // z3=y1*z1 in ECC_Double()
72 multiprecision_lshift_mod(z3, z3, keyLength); in ECC_Double()
74 multiprecision_mersenns_squa_mod(y3, y1, keyLength); // y3=y1^2 in ECC_Double()
75 multiprecision_lshift_mod(y3, y3, keyLength); in ECC_Double()
76 multiprecision_mersenns_mult_mod(t3, y3, x1, keyLength); // t3=y3*x1=x1*y1^2 in ECC_Double()
77 multiprecision_lshift_mod(t3, t3, keyLength); in ECC_Double()
78 multiprecision_mersenns_squa_mod(y3, y3, keyLength); // y3=y3^2=y1^4 in ECC_Double()
79 multiprecision_lshift_mod(y3, y3, keyLength); in ECC_Double()
81 multiprecision_mersenns_squa_mod(x3, t2, keyLength); // x3=t2^2 in ECC_Double()
82 multiprecision_lshift_mod(t1, t3, keyLength); // t1=2t3 in ECC_Double()
83 multiprecision_sub_mod(x3, x3, t1, keyLength); // x3=x3-t1 in ECC_Double()
84 multiprecision_sub_mod(t1, t3, x3, keyLength); // t1=t3-x3 in ECC_Double()
85 multiprecision_mersenns_mult_mod(t1, t1, t2, keyLength); // t1=t1*t2 in ECC_Double()
86 multiprecision_sub_mod(y3, t1, y3, keyLength); // y3=t1-y3 in ECC_Double()
90 static void ECC_Add(Point* r, Point* p, Point* q, uint32_t keyLength) { in ECC_Add() argument
114 if (multiprecision_iszero(z2, keyLength)) { in ECC_Add()
120 if (multiprecision_iszero(z1, keyLength)) { in ECC_Add()
125 multiprecision_mersenns_squa_mod(t1, z1, keyLength); // t1=z1^2 in ECC_Add()
126 multiprecision_mersenns_mult_mod(t2, z1, t1, keyLength); // t2=t1*z1 in ECC_Add()
127 multiprecision_mersenns_mult_mod(t1, x2, t1, keyLength); // t1=t1*x2 in ECC_Add()
128 multiprecision_mersenns_mult_mod(t2, y2, t2, keyLength); // t2=t2*y2 in ECC_Add()
130 multiprecision_sub_mod(t1, t1, x1, keyLength); // t1=t1-x1 in ECC_Add()
131 multiprecision_sub_mod(t2, t2, y1, keyLength); // t2=t2-y1 in ECC_Add()
133 if (multiprecision_iszero(t1, keyLength)) { in ECC_Add()
134 if (multiprecision_iszero(t2, keyLength)) { in ECC_Add()
135 ECC_Double(r, q, keyLength); in ECC_Add()
138 multiprecision_init(z3, keyLength); in ECC_Add()
143 multiprecision_mersenns_mult_mod(z3, z1, t1, keyLength); // z3=z1*t1 in ECC_Add()
144 multiprecision_mersenns_squa_mod(y3, t1, keyLength); // t3=t1^2 in ECC_Add()
145 multiprecision_mersenns_mult_mod(z1, y3, t1, keyLength); // t4=t3*t1 in ECC_Add()
146 multiprecision_mersenns_mult_mod(y3, y3, x1, keyLength); // t3=t3*x1 in ECC_Add()
147 multiprecision_lshift_mod(t1, y3, keyLength); // t1=2*t3 in ECC_Add()
148 multiprecision_mersenns_squa_mod(x3, t2, keyLength); // x3=t2^2 in ECC_Add()
149 multiprecision_sub_mod(x3, x3, t1, keyLength); // x3=x3-t1 in ECC_Add()
150 multiprecision_sub_mod(x3, x3, z1, keyLength); // x3=x3-t4 in ECC_Add()
151 multiprecision_sub_mod(y3, y3, x3, keyLength); // t3=t3-x3 in ECC_Add()
152 multiprecision_mersenns_mult_mod(y3, y3, t2, keyLength); // t3=t3*t2 in ECC_Add()
153 multiprecision_mersenns_mult_mod(z1, z1, y1, keyLength); // t4=t4*t1 in ECC_Add()
154 multiprecision_sub_mod(y3, y3, z1, keyLength); in ECC_Add()
159 uint32_t keyLength) { in ECC_NAF() argument
165 while ((var = multiprecision_most_signbits(k, keyLength)) >= 1) { in ECC_NAF()
186 multiprecision_rshift(k, k, keyLength); in ECC_NAF()
196 uint32_t keyLength) { in ECC_PointMult_Bin_NAF() argument
204 if (keyLength == KEY_LENGTH_DWORDS_P256) { in ECC_PointMult_Bin_NAF()
211 multiprecision_init(p->z, keyLength); in ECC_PointMult_Bin_NAF()
218 multiprecision_copy(minus_p.x, p->x, keyLength); in ECC_PointMult_Bin_NAF()
219 multiprecision_sub(minus_p.y, modp, p->y, keyLength); in ECC_PointMult_Bin_NAF()
221 multiprecision_init(minus_p.z, keyLength); in ECC_PointMult_Bin_NAF()
226 ECC_NAF(naf, &NumNaf, n, keyLength); in ECC_PointMult_Bin_NAF()
230 ECC_Double(q, &r, keyLength); in ECC_PointMult_Bin_NAF()
235 ECC_Add(q, &r, p, keyLength); in ECC_PointMult_Bin_NAF()
238 ECC_Add(q, &r, &minus_p, keyLength); in ECC_PointMult_Bin_NAF()
242 multiprecision_inv_mod(minus_p.x, q->z, keyLength); in ECC_PointMult_Bin_NAF()
243 multiprecision_mersenns_squa_mod(q->z, minus_p.x, keyLength); in ECC_PointMult_Bin_NAF()
244 multiprecision_mersenns_mult_mod(q->x, q->x, q->z, keyLength); in ECC_PointMult_Bin_NAF()
245 multiprecision_mersenns_mult_mod(q->z, q->z, minus_p.x, keyLength); in ECC_PointMult_Bin_NAF()
246 multiprecision_mersenns_mult_mod(q->y, q->y, q->z, keyLength); in ECC_PointMult_Bin_NAF()