Lines Matching refs:keyLength
30 void multiprecision_init(DWORD *c, uint32_t keyLength) in multiprecision_init() argument
32 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_init()
36 void multiprecision_copy(DWORD *c, DWORD *a, uint32_t keyLength) in multiprecision_copy() argument
38 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_copy()
42 int multiprecision_compare(DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_compare() argument
44 for (int i = keyLength - 1; i >= 0; i--) in multiprecision_compare()
54 int multiprecision_iszero(DWORD *a, uint32_t keyLength) in multiprecision_iszero() argument
56 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_iszero()
73 UINT32 multiprecision_most_signdwords(DWORD *a, uint32_t keyLength) in multiprecision_most_signdwords() argument
76 for (i = keyLength - 1; i >= 0; i--) in multiprecision_most_signdwords()
82 UINT32 multiprecision_most_signbits(DWORD *a, uint32_t keyLength) in multiprecision_most_signbits() argument
86 aMostSignDWORDs = multiprecision_most_signdwords(a, keyLength); in multiprecision_most_signbits()
94 DWORD multiprecision_add(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_add() argument
100 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_add()
113 DWORD multiprecision_sub(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_sub() argument
119 for (uint32_t i=0; i < keyLength; i++) in multiprecision_sub()
131 void multiprecision_lshift_mod(DWORD * c, DWORD * a, uint32_t keyLength) in multiprecision_lshift_mod() argument
136 if (keyLength == KEY_LENGTH_DWORDS_P192) in multiprecision_lshift_mod()
140 else if (keyLength == KEY_LENGTH_DWORDS_P256) in multiprecision_lshift_mod()
147 carrier = multiprecision_lshift(c, a, keyLength); in multiprecision_lshift_mod()
150 multiprecision_sub(c, c, modp, keyLength); in multiprecision_lshift_mod()
152 else if (multiprecision_compare(c, modp, keyLength)>=0) in multiprecision_lshift_mod()
154 multiprecision_sub(c, c, modp, keyLength); in multiprecision_lshift_mod()
159 void multiprecision_rshift(DWORD * c, DWORD * a, uint32_t keyLength) in multiprecision_rshift() argument
168 for (int i = keyLength-1; i >= 0; i--) in multiprecision_rshift()
177 void multiprecision_mersenns_mult_mod(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_mersenns_mult_mod() argument
181 multiprecision_mult(cc, a, b, keyLength); in multiprecision_mersenns_mult_mod()
182 if (keyLength == 6) in multiprecision_mersenns_mult_mod()
186 else if (keyLength == 8) in multiprecision_mersenns_mult_mod()
193 void multiprecision_mersenns_squa_mod(DWORD *c, DWORD *a, uint32_t keyLength) in multiprecision_mersenns_squa_mod() argument
195 multiprecision_mersenns_mult_mod(c, a, a, keyLength); in multiprecision_mersenns_squa_mod()
199 void multiprecision_add_mod(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_add_mod() argument
204 if (keyLength == KEY_LENGTH_DWORDS_P192) in multiprecision_add_mod()
208 else if (keyLength == KEY_LENGTH_DWORDS_P256) in multiprecision_add_mod()
215 carrier = multiprecision_add(c, a, b, keyLength); in multiprecision_add_mod()
218 multiprecision_sub(c, c, modp, keyLength); in multiprecision_add_mod()
220 else if (multiprecision_compare(c, modp, keyLength) >= 0) in multiprecision_add_mod()
222 multiprecision_sub(c, c, modp, keyLength); in multiprecision_add_mod()
227 void multiprecision_sub_mod(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_sub_mod() argument
232 if (keyLength == KEY_LENGTH_DWORDS_P192) in multiprecision_sub_mod()
236 else if(keyLength == KEY_LENGTH_DWORDS_P256) in multiprecision_sub_mod()
243 borrow = multiprecision_sub(c, a, b, keyLength); in multiprecision_sub_mod()
245 multiprecision_add(c, c, modp, keyLength); in multiprecision_sub_mod()
249 DWORD multiprecision_lshift(DWORD * c, DWORD * a, uint32_t keyLength) in multiprecision_lshift() argument
258 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_lshift()
269 void multiprecision_mult(DWORD *c, DWORD *a, DWORD *b, uint32_t keyLength) in multiprecision_mult() argument
276 multiprecision_init(c, keyLength); in multiprecision_mult()
279 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_mult()
282 for (uint32_t j = 0; j < keyLength; j++) in multiprecision_mult()
295 c[i+keyLength] = U; in multiprecision_mult()
636 void multiprecision_inv_mod(DWORD *aminus, DWORD *u, uint32_t keyLength) in multiprecision_inv_mod() argument
643 if(keyLength == KEY_LENGTH_DWORDS_P256) in multiprecision_inv_mod()
652 multiprecision_copy(v, modp, keyLength); in multiprecision_inv_mod()
653 multiprecision_init(A, keyLength); in multiprecision_inv_mod()
654 multiprecision_init(C, keyLength); in multiprecision_inv_mod()
657 while (!multiprecision_iszero(u, keyLength)) in multiprecision_inv_mod()
661 multiprecision_rshift(u, u, keyLength); in multiprecision_inv_mod()
663 multiprecision_rshift(A, A, keyLength); in multiprecision_inv_mod()
666 A[keyLength]=multiprecision_add(A, A, modp, keyLength); // A =A+p in multiprecision_inv_mod()
667 multiprecision_rshift(A, A, keyLength); in multiprecision_inv_mod()
668 A[keyLength-1] |= (A[keyLength]<<31); in multiprecision_inv_mod()
674 multiprecision_rshift(v, v, keyLength); in multiprecision_inv_mod()
677 multiprecision_rshift(C, C, keyLength); in multiprecision_inv_mod()
681 C[keyLength] = multiprecision_add(C, C, modp, keyLength); // C =C+p in multiprecision_inv_mod()
682 multiprecision_rshift(C, C, keyLength); in multiprecision_inv_mod()
683 C[keyLength-1] |= (C[keyLength] << 31); in multiprecision_inv_mod()
687 if (multiprecision_compare(u, v, keyLength) >= 0) in multiprecision_inv_mod()
689 multiprecision_sub(u, u, v, keyLength); in multiprecision_inv_mod()
690 multiprecision_sub_mod(A, A, C, keyLength); in multiprecision_inv_mod()
694 multiprecision_sub(v, v, u, keyLength); in multiprecision_inv_mod()
695 multiprecision_sub_mod(C, C, A, keyLength); in multiprecision_inv_mod()
699 if (multiprecision_compare(C, modp, keyLength) >= 0) in multiprecision_inv_mod()
700 multiprecision_sub(aminus, C, modp, keyLength); in multiprecision_inv_mod()
702 multiprecision_copy(aminus, C, keyLength); in multiprecision_inv_mod()