1. 28 May, 2020 3 commits
  2. 22 May, 2020 12 commits
  3. 15 May, 2020 18 commits
  4. 08 May, 2020 7 commits
    • Eric Biggers's avatar
      crypto: lib/sha1 - fold linux/cryptohash.h into crypto/sha.h · 228c4f26
      Eric Biggers authored
      <linux/cryptohash.h> sounds very generic and important, like it's the
      header to include if you're doing cryptographic hashing in the kernel.
      But actually it only includes the library implementation of the SHA-1
      compression function (not even the full SHA-1).  This should basically
      never be used anymore; SHA-1 is no longer considered secure, and there
      are much better ways to do cryptographic hashing in the kernel.
      
      Remove this header and fold it into <crypto/sha.h> which already
      contains constants and functions for SHA-1 (along with SHA-2).
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      228c4f26
    • Eric Biggers's avatar
      crypto: lib/sha1 - remove unnecessary includes of linux/cryptohash.h · 2aaba014
      Eric Biggers authored
      <linux/cryptohash.h> sounds very generic and important, like it's the
      header to include if you're doing cryptographic hashing in the kernel.
      But actually it only includes the library implementation of the SHA-1
      compression function (not even the full SHA-1).  This should basically
      never be used anymore; SHA-1 is no longer considered secure, and there
      are much better ways to do cryptographic hashing in the kernel.
      
      Most files that include this header don't actually need it.  So in
      preparation for removing it, remove all these unneeded includes of it.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2aaba014
    • Eric Biggers's avatar
      crypto: lib/sha1 - rename "sha" to "sha1" · 6b0b0fa2
      Eric Biggers authored
      The library implementation of the SHA-1 compression function is
      confusingly called just "sha_transform()".  Alongside it are some "SHA_"
      constants and "sha_init()".  Presumably these are left over from a time
      when SHA just meant SHA-1.  But now there are also SHA-2 and SHA-3, and
      moreover SHA-1 is now considered insecure and thus shouldn't be used.
      
      Therefore, rename these functions and constants to make it very clear
      that they are for SHA-1.  Also add a comment to make it clear that these
      shouldn't be used.
      
      For the extra-misleadingly named "SHA_MESSAGE_BYTES", rename it to
      SHA1_BLOCK_SIZE and define it to just '64' rather than '(512/8)' so that
      it matches the same definition in <crypto/sha.h>.  This prepares for
      merging <linux/cryptohash.h> into <crypto/sha.h>.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6b0b0fa2
    • Eric Biggers's avatar
      crypto: s390/sha1 - prefix the "sha1_" functions · 4d21e594
      Eric Biggers authored
      Prefix the s390 SHA-1 functions with "s390_sha1_" rather than "sha1_".
      This allows us to rename the library function sha_init() to sha1_init()
      without causing a naming collision.
      
      Cc: linux-s390@vger.kernel.org
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4d21e594
    • Eric Biggers's avatar
      crypto: powerpc/sha1 - prefix the "sha1_" functions · 23dc2a0d
      Eric Biggers authored
      Prefix the PowerPC SHA-1 functions with "powerpc_sha1_" rather than
      "sha1_".  This allows us to rename the library function sha_init() to
      sha1_init() without causing a naming collision.
      
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      23dc2a0d
    • Eric Biggers's avatar
      crypto: powerpc/sha1 - remove unused temporary workspace · 1c4b3c40
      Eric Biggers authored
      The PowerPC implementation of SHA-1 doesn't actually use the 16-word
      temporary array that's passed to the assembly code.  This was probably
      meant to correspond to the 'W' array that lib/sha1.c uses.  However, in
      sha1-powerpc-asm.S these values are actually stored in GPRs 16-31.
      
      Referencing SHA_WORKSPACE_WORDS from this code also isn't appropriate,
      since it's an implementation detail of lib/sha1.c.
      
      Therefore, just remove this unneeded array.
      
      Tested with:
      
      	export ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-
      	make mpc85xx_defconfig
      	cat >> .config << EOF
      	# CONFIG_MODULES is not set
      	# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
      	CONFIG_DEBUG_KERNEL=y
      	CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
      	CONFIG_CRYPTO_SHA1_PPC=y
      	EOF
      	make olddefconfig
      	make -j32
      	qemu-system-ppc -M mpc8544ds -cpu e500 -nographic \
      		-kernel arch/powerpc/boot/zImage \
      		-append "cryptomgr.fuzz_iterations=1000 cryptomgr.panic_on_fail=1"
      
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1c4b3c40
    • Eric Biggers's avatar
      mptcp: use SHA256_BLOCK_SIZE, not SHA_MESSAGE_BYTES · ac0ad93d
      Eric Biggers authored
      In preparation for naming the SHA-1 stuff in <linux/cryptohash.h>
      properly and moving it to a more appropriate header, fix the HMAC-SHA256
      code in mptcp_crypto_hmac_sha() to use SHA256_BLOCK_SIZE instead of
      "SHA_MESSAGE_BYTES" which is actually the SHA-1 block size.
      (Fortunately these are both 64 bytes, so this wasn't a "real" bug...)
      
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: mptcp@lists.01.org
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Reviewed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ac0ad93d