Re: [PATCH RFC v4 1/4] MPILIB: add mpi_read_buf(), mpi_copy() and mpi_get_size() helpers

2015-06-12 Thread Tadeusz Struk
On 06/12/2015 09:21 AM, Stephan Mueller wrote: >> +void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign) >> >+{ >> >+ uint8_t *buf, *p; >> >+ int n, ret; >> >+ >> >+ if (!nbytes) >> >+ return NULL; >> >+ >> >+ n = mpi_get_size(a); > Shouldn't n be unsigned i

Re: [PATCH RFC v4 1/4] MPILIB: add mpi_read_buf(), mpi_copy() and mpi_get_size() helpers

2015-06-12 Thread Stephan Mueller
Am Donnerstag, 11. Juni 2015, 12:05:38 schrieb Tadeusz Struk: Hi Tadeusz, >+ */ >+void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign) >+{ >+ uint8_t *buf, *p; >+ int n, ret; >+ >+ if (!nbytes) >+ return NULL; >+ >+ n = mpi_get_size(a); Shouldn't n be un

Re: [PATCH RFC v4 1/4] MPILIB: add mpi_read_buf(), mpi_copy() and mpi_get_size() helpers

2015-06-11 Thread Herbert Xu
On Thu, Jun 11, 2015 at 12:05:38PM -0700, Tadeusz Struk wrote: > > +/** > + * 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 > + */ > +unsigned

[PATCH RFC v4 1/4] MPILIB: add mpi_read_buf(), mpi_copy() and mpi_get_size() helpers

2015-06-11 Thread Tadeusz Struk
Added a mpi_read_buf() helper function to export MPI to a buf provided by the user, and a mpi_get_size() helper, that tells the user how big the buf is. Implemented mpi_copy(), which was declared in mpi.h, but never implemented. Signed-off-by: Tadeusz Struk --- include/linux/mpi.h |3 ++ lib