• Home
  • Raw
  • Download

Lines Matching refs:keyLength

30 void multiprecision_init(uint32_t* c, uint32_t keyLength) {  in multiprecision_init()  argument
31 for (uint32_t i = 0; i < keyLength; i++) c[i] = 0; in multiprecision_init()
34 void multiprecision_copy(uint32_t* c, uint32_t* a, uint32_t keyLength) { in multiprecision_copy() argument
35 for (uint32_t i = 0; i < keyLength; i++) c[i] = a[i]; in multiprecision_copy()
38 int multiprecision_compare(uint32_t* a, uint32_t* b, uint32_t keyLength) { in multiprecision_compare() argument
39 for (int i = keyLength - 1; i >= 0; i--) { in multiprecision_compare()
46 int multiprecision_iszero(uint32_t* a, uint32_t keyLength) { in multiprecision_iszero() argument
47 for (uint32_t i = 0; i < keyLength; i++) in multiprecision_iszero()
61 uint32_t multiprecision_most_signdwords(uint32_t* a, uint32_t keyLength) { in multiprecision_most_signdwords() argument
63 for (i = keyLength - 1; i >= 0; i--) in multiprecision_most_signdwords()
68 uint32_t multiprecision_most_signbits(uint32_t* a, uint32_t keyLength) { in multiprecision_most_signbits() argument
71 aMostSignDWORDs = multiprecision_most_signdwords(a, keyLength); in multiprecision_most_signbits()
79 uint32_t keyLength) { in multiprecision_add() argument
84 for (uint32_t i = 0; i < keyLength; i++) { in multiprecision_add()
97 uint32_t keyLength) { in multiprecision_sub() argument
102 for (uint32_t i = 0; i < keyLength; i++) { in multiprecision_sub()
113 void multiprecision_lshift_mod(uint32_t* c, uint32_t* a, uint32_t keyLength) { in multiprecision_lshift_mod() argument
117 if (keyLength == KEY_LENGTH_DWORDS_P192) { in multiprecision_lshift_mod()
119 } else if (keyLength == KEY_LENGTH_DWORDS_P256) { in multiprecision_lshift_mod()
124 carrier = multiprecision_lshift(c, a, keyLength); in multiprecision_lshift_mod()
126 multiprecision_sub(c, c, modp, keyLength); in multiprecision_lshift_mod()
127 } else if (multiprecision_compare(c, modp, keyLength) >= 0) { in multiprecision_lshift_mod()
128 multiprecision_sub(c, c, modp, keyLength); in multiprecision_lshift_mod()
133 void multiprecision_rshift(uint32_t* c, uint32_t* a, uint32_t keyLength) { in multiprecision_rshift() argument
141 for (int i = keyLength - 1; i >= 0; i--) { in multiprecision_rshift()
151 uint32_t keyLength) { in multiprecision_mersenns_mult_mod() argument
154 multiprecision_mult(cc, a, b, keyLength); in multiprecision_mersenns_mult_mod()
155 if (keyLength == 6) { in multiprecision_mersenns_mult_mod()
157 } else if (keyLength == 8) { in multiprecision_mersenns_mult_mod()
164 uint32_t keyLength) { in multiprecision_mersenns_squa_mod() argument
165 multiprecision_mersenns_mult_mod(c, a, a, keyLength); in multiprecision_mersenns_squa_mod()
170 uint32_t keyLength) { in multiprecision_add_mod() argument
174 if (keyLength == KEY_LENGTH_DWORDS_P192) { in multiprecision_add_mod()
176 } else if (keyLength == KEY_LENGTH_DWORDS_P256) { in multiprecision_add_mod()
181 carrier = multiprecision_add(c, a, b, keyLength); in multiprecision_add_mod()
183 multiprecision_sub(c, c, modp, keyLength); in multiprecision_add_mod()
184 } else if (multiprecision_compare(c, modp, keyLength) >= 0) { in multiprecision_add_mod()
185 multiprecision_sub(c, c, modp, keyLength); in multiprecision_add_mod()
191 uint32_t keyLength) { in multiprecision_sub_mod() argument
195 if (keyLength == KEY_LENGTH_DWORDS_P192) { in multiprecision_sub_mod()
197 } else if (keyLength == KEY_LENGTH_DWORDS_P256) { in multiprecision_sub_mod()
202 borrow = multiprecision_sub(c, a, b, keyLength); in multiprecision_sub_mod()
203 if (borrow) multiprecision_add(c, c, modp, keyLength); in multiprecision_sub_mod()
207 uint32_t multiprecision_lshift(uint32_t* c, uint32_t* a, uint32_t keyLength) { in multiprecision_lshift() argument
215 for (uint32_t i = 0; i < keyLength; i++) { in multiprecision_lshift()
226 uint32_t keyLength) { in multiprecision_mult() argument
232 multiprecision_init(c, keyLength); in multiprecision_mult()
235 for (uint32_t i = 0; i < keyLength; i++) { in multiprecision_mult()
237 for (uint32_t j = 0; j < keyLength; j++) { in multiprecision_mult()
249 c[i + keyLength] = U; in multiprecision_mult()
558 void multiprecision_inv_mod(uint32_t* aminus, uint32_t* u, uint32_t keyLength) { in multiprecision_inv_mod() argument
564 if (keyLength == KEY_LENGTH_DWORDS_P256) { in multiprecision_inv_mod()
570 multiprecision_copy(v, modp, keyLength); in multiprecision_inv_mod()
571 multiprecision_init(A, keyLength); in multiprecision_inv_mod()
572 multiprecision_init(C, keyLength); in multiprecision_inv_mod()
575 while (!multiprecision_iszero(u, keyLength)) { in multiprecision_inv_mod()
578 multiprecision_rshift(u, u, keyLength); in multiprecision_inv_mod()
580 multiprecision_rshift(A, A, keyLength); in multiprecision_inv_mod()
582 A[keyLength] = multiprecision_add(A, A, modp, keyLength); // A =A+p in multiprecision_inv_mod()
583 multiprecision_rshift(A, A, keyLength); in multiprecision_inv_mod()
584 A[keyLength - 1] |= (A[keyLength] << 31); in multiprecision_inv_mod()
590 multiprecision_rshift(v, v, keyLength); in multiprecision_inv_mod()
593 multiprecision_rshift(C, C, keyLength); in multiprecision_inv_mod()
595 C[keyLength] = multiprecision_add(C, C, modp, keyLength); // C =C+p in multiprecision_inv_mod()
596 multiprecision_rshift(C, C, keyLength); in multiprecision_inv_mod()
597 C[keyLength - 1] |= (C[keyLength] << 31); in multiprecision_inv_mod()
601 if (multiprecision_compare(u, v, keyLength) >= 0) { in multiprecision_inv_mod()
602 multiprecision_sub(u, u, v, keyLength); in multiprecision_inv_mod()
603 multiprecision_sub_mod(A, A, C, keyLength); in multiprecision_inv_mod()
605 multiprecision_sub(v, v, u, keyLength); in multiprecision_inv_mod()
606 multiprecision_sub_mod(C, C, A, keyLength); in multiprecision_inv_mod()
610 if (multiprecision_compare(C, modp, keyLength) >= 0) in multiprecision_inv_mod()
611 multiprecision_sub(aminus, C, modp, keyLength); in multiprecision_inv_mod()
613 multiprecision_copy(aminus, C, keyLength); in multiprecision_inv_mod()