05 Sep, 2019

2 commits

  • lib/crypto/sha256.c and include/crypto/sha256_base.h define
    99% identical functions to init a sha256_state struct for sha224 or
    sha256 use.

    This commit moves the functions from lib/crypto/sha256.c to
    include/crypto/sha.h (making them static inline) and makes the
    sha224/256_base_init static inline functions from
    include/crypto/sha256_base.h wrappers around the now also
    static inline include/crypto/sha.h functions.

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • The generic sha256 implementation from lib/crypto/sha256.c uses data
    structs defined in crypto/sha.h, so lets move the function prototypes
    there too.

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     

30 Aug, 2019

1 commit


22 Aug, 2019

5 commits

  • Add sha224 support to the lib/crypto/sha256 library code. This will allow
    us to replace both the sha256 and sha224 parts of crypto/sha256_generic.c
    when we remove the code duplication in further patches in this series.

    Suggested-by: Eric Biggers
    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • Before this commit lib/crypto/sha256.c has only been used in the s390 and
    x86 purgatory code, make it suitable for generic use:

    * Export interesting symbols
    * Add -D__DISABLE_EXPORTS to CFLAGS_sha256.o for purgatory builds to
    avoid the exports for the purgatory builds
    * Add to lib/crypto/Makefile and crypto/Kconfig

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • Use get/put_unaligned_be32 in lib/crypto/sha256.c to load / store data
    so that it can be used with unaligned buffers too, making it more generic.

    And use memzero_explicit for better clearing of sensitive data.

    Note unlike other patches in this series this commit actually makes
    functional changes to the sha256 code as used by the purgatory code.

    This fully aligns the lib/crypto/sha256.c sha256 implementation with the
    one from crypto/sha256_generic.c allowing us to remove the latter in
    further patches in this series.

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • Generic crypto implementations belong under lib/crypto not directly in
    lib, likewise the header should be in include/crypto, not include/linux.

    Note that the code in lib/crypto/sha256.c is not yet available for
    generic use after this commit, it is still only used by the s390 and x86
    purgatory code. Making it suitable for generic use is done in further
    patches in this series.

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • Another one for the cipher museum: split off DES core processing into
    a separate module so other drivers (mostly for crypto accelerators)
    can reuse the code without pulling in the generic DES cipher itself.
    This will also permit the cipher interface to be made private to the
    crypto API itself once we move the only user in the kernel (CIFS) to
    this library interface.

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Ard Biesheuvel
     

09 Aug, 2019

1 commit


26 Jul, 2019

2 commits


20 Jun, 2019

1 commit