Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\mpi\mpicoder.c Create Date:2022-07-28 07:18:43
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:mpi_read_buffer() - read MPI to a bufer provided by user (msb first)*@a: a multi precision integer*@buf: bufer to which the output will be written to

Proto:int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes, int *sign)

Type:int

Parameter:

TypeParameterName
MPIa
uint8_t *buf
unsignedbuf_len
unsigned *nbytes
int *sign
154  n = mpi_get_size() - returns max size required to store the number*@a: A multi precision integer for which we want to allocate a bufer* Return: size required to store the number
157  If Not buf || Not nbytes Then Return -EINVAL
160  If sign Then sign = indicates a negative number
163  lzeros = count_lzeros(a)
165  If buf_len < n - lzeros Then
166  nbytes = n - lzeros
167  Return -EOVERFLOW
170  p = buf
171  nbytes = n - lzeros
173  When i >= 0 cycle
177  alimb = cpu_to_be32( array with the limbs [i])
183  No 3D Now!(p, (u8 * ) & alimb + lzeros, BYTES_PER_MPI_LIMB - lzeros)
184  p += BYTES_PER_MPI_LIMB - lzeros
185  lzeros = 0
187  Return 0
Caller
NameDescribe
mpi_get_buffermpi_get_buffer() - Returns an allocated buffer with the MPI (msb first).* Caller must free the return string.* This function does return a 0 byte buffer with nbytes set to zero if the* value of A is zero.*@a: a multi precision integer.