Skip to content

crypto: lib/mpi - Add error checks

Herbert Xu linux-crypto 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4Revert "lib/mpi: Extend the MPI library"include/linux/mpi.h lib/crypto/mpi/Makefile lib/crypto/mpi/mpi-add.c +9 more+10 -11650 replies
2/4crypto: lib/mpi - Add error checks to extensioninclude/linux/mpi.h lib/crypto/mpi/mpi-add.c lib/crypto/mpi/mpi-bit.c +5 more+128 -580 replies
3/4crypto: dh - Check mpi_rshift errorscrypto/dh.c+2 -20 replies
4/4crypto: rsa - Check MPI allocation errorscrypto/rsa.c+12 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [v2 PATCH 0/4] crypto: lib/mpi - Add error checks

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
Signature · 1 line
2.39.2