Function report |
Source Code:lib\mpi\mpi-pow.c |
Create Date:2022-07-28 07:19:27 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:RES = BASE ^ EXP mod MOD
Proto:int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
MPI | res | |
MPI | base | |
MPI | exp | |
MPI | mod |
27 | struct karatsuba_ctx karactx = {} |
36 | assign_rp = 0 |
37 | tsize = 0 |
46 | rp = array with the limbs |
47 | ep = array with the limbs |
52 | If Not esize Then |
55 | number of valid limbs = If msize == 1 && array with the limbs [0] == 1 Then 0 Else 1 |
56 | If number of valid limbs Then |
57 | If Resize the array of A to NLIMBS. the additional space is cleared* (set to 0) [done by m_realloc()] < 0 Then Go to enomem |
59 | rp = array with the limbs |
60 | rp[0] = 1 |
62 | indicates a negative number = 0 |
63 | Go to leave |
70 | mp = mp_marker = -- mpiutil.c -- |
76 | Else Copy N limbs from S to D. (mp, array with the limbs , msize) |
84 | bp = bp_marker = -- mpiutil.c -- |
94 | MPN_NORMALIZE(bp, bsize) |
95 | Else bp = array with the limbs |
98 | If Not bsize Then |
104 | If array size (# of allocated limbs) < size Then |
113 | Else |
118 | Else |
122 | bp = bp_marker = -- mpiutil.c -- |
125 | Copy N limbs from S to D. (bp, rp, bsize) |
129 | ep = ep_marker = -- mpiutil.c -- |
132 | Copy N limbs from S to D. (ep, rp, esize) |
144 | Copy N limbs from S to D. (rp, bp, bsize) |
155 | xp = xp_marker = -- mpiutil.c -- |
159 | negative_result = ep[0] & 1 && indicates a negative number |
165 | c = BITS_PER_MPI_LIMB - 1 - c |
177 | cycle |
183 | If rsize < sted 4, 16, 32 and 64, where 16 gave the best performance when* checking a 768 and a 1024 bit ElGamal signature.* (wk 22.12.97) Then mpih_sqr_n_basecase(xp, rp, rsize) |
185 | Else |
215 | If e < 0 Then |
223 | Else |
243 | e <<= 1 |
244 | c-- |
245 | cond_resched() |
248 | i-- |
249 | If i < 0 Then Break |
252 | c = BITS_PER_MPI_LIMB |
261 | If mod_shift_cnt Then |
264 | rp = array with the limbs |
265 | If carry_limb Then |
266 | rp[rsize] = carry_limb |
267 | rsize++ |
269 | Else |
270 | Copy N limbs from S to D. ( array with the limbs , rp, rsize) |
271 | rp = array with the limbs |
282 | MPN_NORMALIZE(rp, rsize) |
285 | If negative_result && rsize Then |
291 | MPN_NORMALIZE(rp, rsize) |
293 | number of valid limbs = rsize |
296 | leave : |
297 | rc = 0 |
298 | enomem : |
299 | mpihelp_release_karatsuba_ctx( & karactx) |
300 | If assign_rp Then mpi_assign_limb_space(res, rp, size) |
302 | If mp_marker Then mpi_free_limb_space(mp_marker) |
304 | If bp_marker Then mpi_free_limb_space(bp_marker) |
306 | If ep_marker Then mpi_free_limb_space(ep_marker) |
308 | If xp_marker Then mpi_free_limb_space(xp_marker) |
310 | If tspace Then mpi_free_limb_space(tspace) |
312 | Return rc |
Name | Describe |
---|---|
digsig_verify_rsa | RSA Signature verification with public key |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |