aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpicoder.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/mpi: Endianness fixMichal Marek2017-12-221-18/+21
| | | | | | | | | | | | The limbs are integers in the host endianness, so we can't simply iterate over the individual bytes. The current code happens to work on little-endian, because the order of the limbs in the MPI array is the same as the order of the bytes in each limb, but it breaks on big-endian. Fixes: 0f74fbf77d45 ("MPI: Fix mpi_read_buffer") Signed-off-by: Michal Marek <mmarek@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* lib/mpi: only require buffers as big as needed for the integerAndrzej Zaborowski2017-12-221-4/+17
| | | | | | | | | | | Since mpi_write_to_sgl and mpi_read_buffer explicitly left-align the integers being written it makes no sense to require a buffer big enough for the number + the leading zero bytes which are not written. The error returned also doesn't convey any information. So instead require only the size needed and return -EOVERFLOW to signal when buffer too short. Signed-off-by: Andrew Zaborowski <andrew.zaborowski@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* lib/mpi: fix off by one in mpi_read_raw_from_sglStephan Mueller2017-04-111-1/+4
| | | | | | | | | | | The patch fixes the analysis of the input data which contains an off by one. The issue is visible when the SGL contains one byte per SG entry. The code for checking for zero bytes does not operate on the data byte. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* move count_zeroes.h out of asm-genericChristoph Hellwig2017-04-111-1/+1
| | | | | | | | This header contains a few helpers currenly only used by the mpi implementation, and not default implementation of architecture code. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* lib/mpi: Add mpi sgl helpersTadeusz Struk2017-04-111-0/+196
| | | | | | | Add mpi_read_raw_from_sgl and mpi_write_to_sgl helpers. Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* MPI: Fix mpi_read_bufferTadeusz Struk2017-04-111-13/+25
| | | | | | | | Change mpi_read_buffer to return a number without leading zeros so that mpi_read_buffer and mpi_get_buffer return the same thing. Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* MPILIB: add mpi_read_buf() and mpi_get_size() helpersTadeusz Struk2017-04-111-19/+68
| | | | | | | | | | 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. Changed mpi_free to use kzfree instead of kfree because it is used to free crypto keys. Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* first commitMeizu OpenSource2016-08-151-0/+260