1. 22 Dec, 2017 1 commit
    • James Hogan's avatar
      lib/mpi: Fix umul_ppmm() for MIPS64r6 · bbc25bee
      James Hogan authored
      Current MIPS64r6 toolchains aren't able to generate efficient
      DMULU/DMUHU based code for the C implementation of umul_ppmm(), which
      performs an unsigned 64 x 64 bit multiply and returns the upper and
      lower 64-bit halves of the 128-bit result. Instead it widens the 64-bit
      inputs to 128-bits and emits a __multi3 intrinsic call to perform a 128
      x 128 multiply. This is both inefficient, and it results in a link error
      since we don't include __multi3 in MIPS linux.
      For example commit 90a53e44 ("cfg80211: implement regdb signature
      checking") merged in v4.15-rc1 recently broke the 64r6_defconfig and
      64r6el_defconfig builds by indirectly selecting MPILIB. The same build
      errors can be reproduced on older kernels by enabling e.g. CRYPTO_RSA:
      lib/mpi/generic_mpih-mul1.o: In function `mpihelp_mul_1':
      lib/mpi/generic_mpih-mul1.c:50: undefined reference to `__multi3'
      lib/mpi/generic_mpih-mul2.o: In function `mpihelp_addmul_1':
      lib/mpi/generic_mpih-mul2.c:49: undefined reference to `__multi3'
      lib/mpi/generic_mpih-mul3.o: In function `mpihelp_submul_1':
      lib/mpi/generic_mpih-mul3.c:49: undefined reference to `__multi3'
      lib/mpi/mpih-div.o In function `mpihelp_divrem':
      lib/mpi/mpih-div.c:205: undefined reference to `__multi3'
      lib/mpi/mpih-div.c:142: undefined reference to `__multi3'
      Therefore add an efficient MIPS64r6 implementation of umul_ppmm() using
      inline assembly and the DMULU/DMUHU instructions, to prevent __multi3
      calls being emitted.
      Fixes: 7fd08ca5 ("MIPS: Add build support for the MIPS R6 ISA")
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: linux-mips@linux-mips.org
      Cc: linux-crypto@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  2. 17 Aug, 2017 1 commit
    • Stefan Agner's avatar
      lib/mpi: fix build with clang · dea632ca
      Stefan Agner authored
      Use just @ to denote comments which works with gcc and clang.
      Otherwise clang reports an escape sequence error:
        error: invalid % escape in inline assembly string
      Use %0-%3 as operand references, this avoids:
        error: invalid operand in inline asm: 'umull ${1:r}, ${0:r}, ${2:r}, ${3:r}'
      Also remove superfluous casts on output operands to avoid warnings
      such as:
        warning: invalid use of a cast in an inline asm context requiring an l-value
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  3. 27 Feb, 2016 1 commit
    • Arnd Bergmann's avatar
      lib/mpi: avoid assembler warning · c5d55248
      Arnd Bergmann authored
      A wrapper around the umull assembly instruction might reuse
      the input register as an output, which is undefined on
      some ARM machines, as pointed out by this assembler warning:
        CC      lib/mpi/generic_mpih-mul1.o
      /tmp/ccxJuxIy.s: Assembler messages:
      /tmp/ccxJuxIy.s:53: rdhi, rdlo and rm must all be different
        CC      lib/mpi/generic_mpih-mul2.o
      /tmp/ccI0scAD.s: Assembler messages:
      /tmp/ccI0scAD.s:53: rdhi, rdlo and rm must all be different
        CC      lib/mpi/generic_mpih-mul3.o
      /tmp/ccMvVQcp.s: Assembler messages:
      /tmp/ccMvVQcp.s:53: rdhi, rdlo and rm must all be different
      This changes the constraints to force different registers to
      be used as output.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  4. 14 Oct, 2015 1 commit
  5. 13 Jun, 2015 1 commit
  6. 19 Jul, 2013 1 commit
  7. 24 May, 2013 1 commit
    • Helge Deller's avatar
      MPILIB: disable usage of floating point registers on parisc · 70ef5578
      Helge Deller authored
      The umul_ppmm() macro for parisc uses the xmpyu assembler statement
      which does calculation via a floating point register.
      But usage of floating point registers inside the Linux kernel are not
      allowed and gcc will stop compilation due to the -mdisable-fpregs
      compiler option.
      Fix this by disabling the umul_ppmm() and udiv_qrnnd() macros. The
      mpilib will then use the generic built-in implementations instead.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
  8. 23 Nov, 2012 1 commit
  9. 08 Oct, 2012 1 commit
  10. 01 Feb, 2012 1 commit
  11. 09 Nov, 2011 1 commit
    • Dmitry Kasatkin's avatar
      crypto: GnuPG based MPI lib - header files (part 2) · 5ce3e312
      Dmitry Kasatkin authored
      Adds the multi-precision-integer maths library which was originally taken
      from GnuPG and ported to the kernel by (among others) David Howells.
      This version is taken from Fedora kernel 2.6.32-71.14.1.el6.
      The difference is that checkpatch reported errors and warnings have been fixed.
      This library is used to implemenet RSA digital signature verification
      used in IMA/EVM integrity protection subsystem.
      Due to patch size limitation, the patch is divided into 4 parts.
      Signed-off-by: default avatarDmitry Kasatkin <dmitry.kasatkin@intel.com>