[PATCH v2 0/7] MD5 library functions

Eric Biggers posted 7 patches 2 months ago
arch/mips/cavium-octeon/Makefile              |   2 +-
arch/mips/cavium-octeon/crypto/Makefile       |   8 -
arch/mips/cavium-octeon/crypto/octeon-md5.c   | 214 -----------
.../{crypto => }/octeon-crypto.c              |   0
arch/mips/configs/cavium_octeon_defconfig     |   1 -
arch/mips/crypto/Kconfig                      |  10 -
arch/powerpc/configs/powernv_defconfig        |   1 -
arch/powerpc/configs/ppc64_defconfig          |   1 -
arch/powerpc/crypto/Kconfig                   |   8 -
arch/powerpc/crypto/Makefile                  |   2 -
arch/powerpc/crypto/md5-glue.c                |  99 -----
arch/sparc/crypto/Kconfig                     |  10 -
arch/sparc/crypto/Makefile                    |   4 -
arch/sparc/crypto/md5_glue.c                  | 174 ---------
crypto/Kconfig                                |   2 +-
crypto/md5.c                                  | 359 ++++++++----------
crypto/testmgr.c                              |   3 +
drivers/crypto/img-hash.c                     |   2 +-
include/crypto/md5.h                          | 181 ++++++++-
lib/crypto/Kconfig                            |  13 +
lib/crypto/Makefile                           |  12 +
lib/crypto/md5.c                              | 322 ++++++++++++++++
lib/crypto/mips/md5.h                         |  65 ++++
.../crypto => lib/crypto/powerpc}/md5-asm.S   |   0
lib/crypto/powerpc/md5.h                      |  12 +
lib/crypto/sparc/md5.h                        |  48 +++
.../crypto => lib/crypto/sparc}/md5_asm.S     |   0
lib/crypto/tests/Kconfig                      |  10 +
lib/crypto/tests/Makefile                     |   1 +
lib/crypto/tests/md5-testvecs.h               | 186 +++++++++
lib/crypto/tests/md5_kunit.c                  |  39 ++
31 files changed, 1060 insertions(+), 729 deletions(-)
delete mode 100644 arch/mips/cavium-octeon/crypto/Makefile
delete mode 100644 arch/mips/cavium-octeon/crypto/octeon-md5.c
rename arch/mips/cavium-octeon/{crypto => }/octeon-crypto.c (100%)
delete mode 100644 arch/powerpc/crypto/md5-glue.c
delete mode 100644 arch/sparc/crypto/md5_glue.c
create mode 100644 lib/crypto/md5.c
create mode 100644 lib/crypto/mips/md5.h
rename {arch/powerpc/crypto => lib/crypto/powerpc}/md5-asm.S (100%)
create mode 100644 lib/crypto/powerpc/md5.h
create mode 100644 lib/crypto/sparc/md5.h
rename {arch/sparc/crypto => lib/crypto/sparc}/md5_asm.S (100%)
create mode 100644 lib/crypto/tests/md5-testvecs.h
create mode 100644 lib/crypto/tests/md5_kunit.c
[PATCH v2 0/7] MD5 library functions
Posted by Eric Biggers 2 months ago
This series is targeting libcrypto-next and can also be retrieved from:

    git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git md5-lib-v2

This series introduces a library API for MD5 and HMAC-MD5 and
reimplements the crypto_shash "md5" and "hmac(md5)" on top of it.

The library API will also be usable directly by various in-kernel users
that are stuck with MD5 due to having to implement legacy protocols.

This should again look quite boring and familiar, as it mirrors the
SHA-1 and SHA-2 changes closely.

Changed in v2:
  - Kept the architecture-optimized MD5 code, since unfortunately there
    were objections to removing it.

Eric Biggers (7):
  lib/crypto: md5: Add MD5 and HMAC-MD5 library functions
  lib/crypto: mips/md5: Migrate optimized code into library
  mips: cavium-octeon: Move octeon-crypto.c into parent dir
  lib/crypto: powerpc/md5: Migrate optimized code into library
  lib/crypto: sparc/md5: Migrate optimized code into library
  crypto: md5 - Wrap library and add HMAC support
  lib/crypto: tests: Add KUnit tests for MD5 and HMAC-MD5

 arch/mips/cavium-octeon/Makefile              |   2 +-
 arch/mips/cavium-octeon/crypto/Makefile       |   8 -
 arch/mips/cavium-octeon/crypto/octeon-md5.c   | 214 -----------
 .../{crypto => }/octeon-crypto.c              |   0
 arch/mips/configs/cavium_octeon_defconfig     |   1 -
 arch/mips/crypto/Kconfig                      |  10 -
 arch/powerpc/configs/powernv_defconfig        |   1 -
 arch/powerpc/configs/ppc64_defconfig          |   1 -
 arch/powerpc/crypto/Kconfig                   |   8 -
 arch/powerpc/crypto/Makefile                  |   2 -
 arch/powerpc/crypto/md5-glue.c                |  99 -----
 arch/sparc/crypto/Kconfig                     |  10 -
 arch/sparc/crypto/Makefile                    |   4 -
 arch/sparc/crypto/md5_glue.c                  | 174 ---------
 crypto/Kconfig                                |   2 +-
 crypto/md5.c                                  | 359 ++++++++----------
 crypto/testmgr.c                              |   3 +
 drivers/crypto/img-hash.c                     |   2 +-
 include/crypto/md5.h                          | 181 ++++++++-
 lib/crypto/Kconfig                            |  13 +
 lib/crypto/Makefile                           |  12 +
 lib/crypto/md5.c                              | 322 ++++++++++++++++
 lib/crypto/mips/md5.h                         |  65 ++++
 .../crypto => lib/crypto/powerpc}/md5-asm.S   |   0
 lib/crypto/powerpc/md5.h                      |  12 +
 lib/crypto/sparc/md5.h                        |  48 +++
 .../crypto => lib/crypto/sparc}/md5_asm.S     |   0
 lib/crypto/tests/Kconfig                      |  10 +
 lib/crypto/tests/Makefile                     |   1 +
 lib/crypto/tests/md5-testvecs.h               | 186 +++++++++
 lib/crypto/tests/md5_kunit.c                  |  39 ++
 31 files changed, 1060 insertions(+), 729 deletions(-)
 delete mode 100644 arch/mips/cavium-octeon/crypto/Makefile
 delete mode 100644 arch/mips/cavium-octeon/crypto/octeon-md5.c
 rename arch/mips/cavium-octeon/{crypto => }/octeon-crypto.c (100%)
 delete mode 100644 arch/powerpc/crypto/md5-glue.c
 delete mode 100644 arch/sparc/crypto/md5_glue.c
 create mode 100644 lib/crypto/md5.c
 create mode 100644 lib/crypto/mips/md5.h
 rename {arch/powerpc/crypto => lib/crypto/powerpc}/md5-asm.S (100%)
 create mode 100644 lib/crypto/powerpc/md5.h
 create mode 100644 lib/crypto/sparc/md5.h
 rename {arch/sparc/crypto => lib/crypto/sparc}/md5_asm.S (100%)
 create mode 100644 lib/crypto/tests/md5-testvecs.h
 create mode 100644 lib/crypto/tests/md5_kunit.c


base-commit: 186f3edfdd41f2ae87fc40a9ccba52a3bf930994
-- 
2.50.1
Re: [PATCH v2 0/7] MD5 library functions
Posted by Eric Biggers 1 month, 3 weeks ago
On Tue, Aug 05, 2025 at 03:28:48PM -0700, Eric Biggers wrote:
> This series is targeting libcrypto-next and can also be retrieved from:
> 
>     git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git md5-lib-v2
> 
> This series introduces a library API for MD5 and HMAC-MD5 and
> reimplements the crypto_shash "md5" and "hmac(md5)" on top of it.
> 
> The library API will also be usable directly by various in-kernel users
> that are stuck with MD5 due to having to implement legacy protocols.
> 
> This should again look quite boring and familiar, as it mirrors the
> SHA-1 and SHA-2 changes closely.
> 
> Changed in v2:
>   - Kept the architecture-optimized MD5 code, since unfortunately there
>     were objections to removing it.
> 
> Eric Biggers (7):
>   lib/crypto: md5: Add MD5 and HMAC-MD5 library functions
>   lib/crypto: mips/md5: Migrate optimized code into library
>   mips: cavium-octeon: Move octeon-crypto.c into parent dir
>   lib/crypto: powerpc/md5: Migrate optimized code into library
>   lib/crypto: sparc/md5: Migrate optimized code into library
>   crypto: md5 - Wrap library and add HMAC support
>   lib/crypto: tests: Add KUnit tests for MD5 and HMAC-MD5

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next

Reviews and acks still greatly appreciated, of course!

- Eric