函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\mpi\mpi-pow.c Create Date:2022-07-27 08:18:05
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:异或取模

函数原型:int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)

返回类型:int

参数:

类型参数名称
MPIres
MPIbase
MPIexp
MPImod
26  mpi_ptr_t mp_marker = NULL, bp_marker = NULL, ep_marker = NULL
27  struct karatsuba_ctx karactx = {}
28  mpi_ptr_t xp_marker = NULL
29  mpi_ptr_t tspace = NULL
36  assign_rp等于0
37  tsize等于0
39  rc等于负ENOMEM
41  esize等于 number of valid limbs
42  msize等于 number of valid limbs
43  size等于2乘msize
44  msign等于 indicates a negative number
46  rp等于 array with the limbs
47  ep等于 array with the limbs
49  如果非msize则返回:负EINVAL
52  如果非esize
55  number of valid limbs 等于如果msize恒等于1且 array with the limbs [0]恒等于1则0否则1
56  如果 number of valid limbs
57  如果调整mpi数组空间小于0则转到:enomem
60  rp[0]等于1
62  indicates a negative number 等于0
63  转到:leave
70  mp等于mp_marker等于-- mpiutil.c --
71  如果非mp则转到:enomem
73  mod_shift_cnt等于_leading_zeros - Count the number of zeros from the MSB back*@x: The value* Count the number of leading zeros from the MSB going towards the LSB in @x.* If the MSB of @x is set, the result is 0.
74  如果mod_shift_cntShift U (pointed to by UP and USIZE digits long) CNT bits to the left* and store the USIZE least significant digits of the result at WP.* Return the bits shifted out from the most significant digit.* Argument constraints:* 1. 0 < CNT < BITS_PER_MP_LIMB* 2
76  否则Copy N limbs from S to D. (mp, array with the limbs , msize)
79  bsize等于 number of valid limbs
80  bsign等于 indicates a negative number
81  如果bsize大于msize
84  bp等于bp_marker等于-- mpiutil.c --
85  如果非bp则转到:enomem
87  Copy N limbs from S to D. (bp, array with the limbs , bsize)
90  Divide num (NP/NSIZE) by den (DP/DSIZE) and write* the NSIZE-DSIZE least significant quotient limbs at QP* and the DSIZE long remainder at NP. If QEXTRA_LIMBS is* non-zero, generate that many fraction bits and append them after the* other quotient limbs.
91  bsize等于msize
94  MPN_NORMALIZE(bp, bsize)
95  否则bp等于 array with the limbs
98  如果非bsize
99  number of valid limbs 等于0
100  indicates a negative number 等于0
101  转到:leave
104  如果 array size (# of allocated limbs) 小于size
108  如果rp恒等于eprp恒等于mprp恒等于bp
109  rp等于-- mpiutil.c --
110  如果非rp则转到:enomem
112  assign_rp等于1
113  否则
114  如果调整mpi数组空间小于0则转到:enomem
118  否则
119  如果rp恒等于bp
121  BUG_ON(bp_marker)
122  bp等于bp_marker等于-- mpiutil.c --
123  如果非bp则转到:enomem
127  如果rp恒等于ep
129  ep等于ep_marker等于-- mpiutil.c --
130  如果非ep则转到:enomem
134  如果rp恒等于mp
136  BUG_ON(mp_marker)
137  mp等于mp_marker等于-- mpiutil.c --
138  如果非mp则转到:enomem
144  Copy N limbs from S to D. (rp, bp, bsize)
145  rsize等于bsize
146  rsign等于bsign
155  xp等于xp_marker等于-- mpiutil.c --
156  如果非xp则转到:enomem
159  negative_result等于ep[0]按位与1且 indicates a negative number
161  i等于esize减1
162  e等于ep[i]
163  c等于_leading_zeros - Count the number of zeros from the MSB back*@x: The value* Count the number of leading zeros from the MSB going towards the LSB in @x.* If the MSB of @x is set, the result is 0.
164  e等于e左移c位左移1位
165  c等于BITS_PER_MPI_LIMB减1减c
177  循环
178 c循环
185  否则
186  如果非tspace
187  tsize等于2乘rsize
188  tspace等于-- mpiutil.c --
190  如果非tspace则转到:enomem
192  否则如果tsize小于2乘rsize
194  tsize等于2乘rsize
195  tspace等于-- mpiutil.c --
197  如果非tspace则转到:enomem
203  xsize等于2乘rsize
204  如果xsize大于msize
210  tp等于rp
211  rp等于xp
212  xp等于tp
213  rsize等于xsize
215  如果e小于0则
243  e左移等于1位
244  c自减
245  cond_resched()
248  i自减
249  如果i小于0则退出
251  e等于ep[i]
252  c等于BITS_PER_MPI_LIMB
261  如果mod_shift_cnt
265  如果carry_limb
266  rp[rsize]等于carry_limb
267  rsize自加
269  否则
274  如果rsize大于等于msize
276  rsize等于msize
280  如果mod_shift_cntShift U (pointed to by UP and USIZE limbs long) CNT bits to the right* and store the USIZE least significant limbs of the result at WP.* The bits shifted out to the right are returned.* Argument constraints:* 1. 0 < CNT < BITS_PER_MP_LIMB* 2
282  MPN_NORMALIZE(rp, rsize)
285  如果negative_resultrsize
286  如果mod_shift_cntShift U (pointed to by UP and USIZE limbs long) CNT bits to the right* and store the USIZE least significant limbs of the result at WP.* The bits shifted out to the right are returned.* Argument constraints:* 1. 0 < CNT < BITS_PER_MP_LIMB* 2
288  mpihelp_sub(rp, mp, msize, rp, rsize)
289  rsize等于msize
290  rsign等于msign
291  MPN_NORMALIZE(rp, rsize)
293  number of valid limbs 等于rsize
294  indicates a negative number 等于rsign
296  leave :
297  rc等于0
298  enomem :
299  mpihelp_release_karatsuba_ctx( & karactx)
300  如果assign_rpmpi_assign_limb_space(res, rp, size)
302  如果mp_markermpi_free_limb_space(mp_marker)
304  如果bp_markermpi_free_limb_space(bp_marker)
306  如果ep_markermpi_free_limb_space(ep_marker)
308  如果xp_markermpi_free_limb_space(xp_marker)
310  如果tspacempi_free_limb_space(tspace)
312  返回:rc
调用者
名称描述
digsig_verify_rsaRSA公钥签名验证