alistair23-linux/lib/mpi
Nicolai Stange 7af791e0f0 lib/mpi: mpi_read_from_buffer(): return -EINVAL upon too short buffer
Currently, if the input buffer is shorter than the expected length as
indicated by its first two bytes, an MPI instance of this expected length
will be allocated and filled with as much data as is available. The rest
will remain uninitialized.

Instead of leaving this condition undetected, an error code should be
reported to the caller.

Since this situation indicates that the input buffer's first two bytes,
encoding the number of expected bits, are garbled, -EINVAL is appropriate
here.

If the input buffer is shorter than indicated by its first two bytes,
make mpi_read_from_buffer() return -EINVAL.
Get rid of the 'nread' variable: with the new semantics, the total number
of bytes read from the input buffer is known in advance.

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2016-05-31 16:42:00 +08:00
..
generic_mpih-add1.c
generic_mpih-lshift.c
generic_mpih-mul1.c
generic_mpih-mul2.c
generic_mpih-mul3.c
generic_mpih-rshift.c
generic_mpih-sub1.c
longlong.h lib/mpi: avoid assembler warning 2016-02-28 03:26:34 +08:00
Makefile MPILIB: Reinstate mpi_cmp[_ui]() and export for RSA signature verification 2012-10-08 13:50:15 +10:30
mpi-bit.c MPILIB: Provide count_leading/trailing_zeros() based on arch functions 2012-10-08 13:50:11 +10:30
mpi-cmp.c MPILIB: Fix comparison of negative MPIs 2015-01-14 16:10:12 +00:00
mpi-inline.h lib/mpi: use "static inline" instead of "extern inline" 2016-02-28 03:26:34 +08:00
mpi-internal.h lib/mpi: use "static inline" instead of "extern inline" 2016-02-28 03:26:34 +08:00
mpi-pow.c MPILIB: Provide count_leading/trailing_zeros() based on arch functions 2012-10-08 13:50:11 +10:30
mpicoder.c lib/mpi: mpi_read_from_buffer(): return -EINVAL upon too short buffer 2016-05-31 16:42:00 +08:00
mpih-cmp.c
mpih-div.c Remove unused code from MPI library 2012-05-26 11:51:03 +10:00
mpih-mul.c Remove unused code from MPI library 2012-05-26 11:51:03 +10:00
mpiutil.c MPILIB: add mpi_read_buf() and mpi_get_size() helpers 2015-06-16 14:35:06 +08:00