mbox series

[v2,0/4] crypto: lib/mpi - Add error checks

Message ID cover.1723270405.git.herbert@gondor.apana.org.au (mailing list archive)
Headers show
Series crypto: lib/mpi - Add error checks | expand

Message

Herbert Xu Aug. 10, 2024, 6:20 a.m. UTC
This patch series reverts MPI library extensions which are buggy
as they carried assumptions from user-space that memory allocations
always succeed.  They were used by SM2 which itself has now been
removed.

Ironically most of these library functions were previously in the
kernel in a non-buggy form but were removed because they were unused.

About half of the extensions remain because they have found uses
beyond SM2.  For those error checks have been added.

Herbert Xu (4):
  Revert "lib/mpi: Extend the MPI library"
  crypto: lib/mpi - Add error checks to extension
  crypto: dh - Check mpi_rshift errors
  crypto: rsa - Check MPI allocation errors

 crypto/dh.c                   |   4 +-
 crypto/rsa.c                  |  19 +-
 include/linux/mpi.h           |  87 ++-------
 lib/crypto/mpi/Makefile       |   1 -
 lib/crypto/mpi/mpi-add.c      |  89 +++------
 lib/crypto/mpi/mpi-bit.c      | 168 ++---------------
 lib/crypto/mpi/mpi-cmp.c      |  46 +----
 lib/crypto/mpi/mpi-div.c      |  82 ++++-----
 lib/crypto/mpi/mpi-internal.h |  21 +--
 lib/crypto/mpi/mpi-inv.c      | 143 ---------------
 lib/crypto/mpi/mpi-mod.c      | 148 +--------------
 lib/crypto/mpi/mpi-mul.c      |  29 ++-
 lib/crypto/mpi/mpicoder.c     | 336 ----------------------------------
 lib/crypto/mpi/mpih-mul.c     |  25 ---
 lib/crypto/mpi/mpiutil.c      | 184 +------------------
 15 files changed, 151 insertions(+), 1231 deletions(-)
 delete mode 100644 lib/crypto/mpi/mpi-inv.c