[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crypto digests modules restructuring

From: Bruno Haible
Subject: crypto digests modules restructuring
Date: Sun, 19 Sep 2021 02:02:06 +0200

Paul Eggert wrote:
> > This will cause some divergence of md5.c w.r.t. glibc. To me, that
> > sounds OK, since md5.c rarely changes in gnulib and has not changed
> > in glibc since 2012. Is that OK with you too?
> It's fine, so long as we keep the files shareable between glibc and 
> Gnulib. That is, I would prefer the divergence to be easily become a 
> non-divergence, by copying the relevant files back to glibc eventually.

OK, I've pushed this restructuring of the crypto digest modules
(md2, md4, md5, sha1, sha256, sha512, sm3), along these lines:
  - separate source files for separate modules,
  - in the tests, make it clear whether a test tests the buffer API
    or the stream API.

For sha256, sha512, the source code became closer to the glibc one,
since glibc does not have the stream API for these.

For md5, porting back to glibc will imply copying the file lib/md5-stream.c
into glibc.

2021-09-18  Bruno Haible  <bruno@clisp.org>

        sm3-buffer tests: New module.
        * tests/test-sm3-buffer.c: Renamed from tests/test-sm3.c.
        * modules/crypto/sm3-buffer-tests: Renamed from
        modules/crypto/sm3-tests. Test tests/test-sm3-buffer.c instead of

        sm3-buffer: New module.
        * lib/sm3-stream.c: New file, extracted from lib/sm3.c.
        * lib/sm3.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, sm3_stream): Moved to sm3-stream.c.
        * lib/sm3.h: Tweak.
        * modules/crypto/sm3-buffer: New file, based on modules/crypto/sm3.
        * modules/crypto/sm3: Rewritten.

2021-09-18  Bruno Haible  <bruno@clisp.org>

        sha512-buffer tests: New module.
        * tests/test-sha512-stream.c: Renamed from tests/test-sha512.c.
        * modules/crypto/sha512-buffer-tests: New file, based on
        * modules/crypto/sha512-tests: Remove tests that are now in
        modules/crypto/sha512-buffer-tests. Test tests/test-sha512-stream.c
        instead of tests/test-sha512.c.

        sha512: Clarify module to source relation.
        * lib/sha512-stream.c: New file, extracted from lib/sha512.c.
        * lib/sha512.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, shaxxx_stream, sha512_stream, sha384_stream): Moved to
        * lib/sha512.h: Tweak.
        * modules/crypto/sha512 (Files): Add lib/sha512-stream.c.
        (configure.ac): Don't define GL_COMPILE_CRYPTO_STREAM.
        (Makefile.am): Arrange to compile sha512-stream.c.
        (Link): Mention $(LIB_CRYPTO).

2021-09-18  Bruno Haible  <bruno@clisp.org>

        sha256-buffer tests: New module.
        * tests/test-sha256-stream.c: Renamed from tests/test-sha256.c.
        * modules/crypto/sha256-buffer-tests: New file, based on
        * modules/crypto/sha256-tests: Remove tests that are now in
        modules/crypto/sha256-buffer-tests. Test tests/test-sha256-stream.c
        instead of tests/test-sha256.c.

        sha256: Clarify module to source relation.
        * lib/sha256-stream.c: New file, extracted from lib/sha256.c.
        * lib/sha256.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, shaxxx_stream, sha256_stream, sha224_stream): Moved to
        * lib/sha256.h: Tweak.
        * modules/crypto/sha256 (Files): Add lib/sha256-stream.c.
        (configure.ac): Don't define GL_COMPILE_CRYPTO_STREAM.
        (Makefile.am): Arrange to compile sha256-stream.c.
        (Link): Mention $(LIB_CRYPTO).

2021-09-18  Bruno Haible  <bruno@clisp.org>

        sha1-buffer tests: New module.
        * tests/test-sha1-buffer.c: New file, based on tests/test-sha1.c.
        * tests/test-sha1-stream.c: Renamed from tests/test-sha1.c.
        (main): Remove sha1-buffer tests.
        * modules/crypto/sha1-buffer-tests: New file, based on
        * modules/crypto/sha1-tests: Remove tests that are now in
        modules/crypto/sha1-buffer-tests. Test tests/test-sha1-stream.c instead
        of tests/test-sha1.c.

        sha1: Clarify module to source relation.
        * lib/sha1-stream.c: New file, extracted from lib/sha1.c.
        * lib/sha1.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, sha1_stream): Moved to sha1-stream.c.
        * lib/sha1.h: Correct indentation.
        * modules/crypto/sha1 (Files): Add lib/sha1-stream.c.
        (configure.ac): Don't define GL_COMPILE_CRYPTO_STREAM.
        (Makefile.am): Arrange to compile sha1-stream.c.
        (Link): Mention $(LIB_CRYPTO).

2021-09-18  Bruno Haible  <bruno@clisp.org>

        md5-buffer tests: New module.
        * tests/test-md5-buffer.c: New file, based on tests/test-md5.c.
        * tests/test-md5-stream.c: Renamed from tests/test-md5.c.
        (main): Remove md5-buffer tests.
        * modules/crypto/md5-buffer-tests: New file, based on
        * modules/crypto/md5-tests: Remove tests that are now in
        modules/crypto/md5-buffer-tests. Test tests/test-md5-stream.c instead
        of tests/test-md5.c.

        md5: Clarify module to source relation.
        * lib/md5-stream.c: New file, extracted from lib/md5.c.
        * lib/md5.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, md5_stream): Moved to md5-stream.c.
        * lib/md5.h: Tweak.
        * modules/crypto/md5 (Files): Add lib/md5-stream.c.
        (configure.ac): Don't define GL_COMPILE_CRYPTO_STREAM.
        (Makefile.am): Arrange to compile md5-stream.c.
        (Link): Mention $(LIB_CRYPTO).

2021-09-18  Bruno Haible  <bruno@clisp.org>

        md4-buffer tests: New module.
        * tests/test-md4-buffer.c: Renamed from tests/test-md4.c.
        * modules/crypto/md4-buffer-tests: Renamed from
        modules/crypto/md4-tests. Test tests/test-md4-buffer.c instead of

        md4-buffer: New module.
        * lib/md4-stream.c: New file, extracted from lib/md4.c.
        * lib/md4.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, md4_stream): Moved to md4-stream.c.
        * lib/md4.h: Reorder declarations.
        * modules/crypto/md4-buffer: New file, based on modules/crypto/md4.
        * modules/crypto/md4: Rewritten.

2021-09-18  Bruno Haible  <bruno@clisp.org>

        md2-buffer tests: New module.
        * tests/test-md2-buffer.c: Renamed from tests/test-md2.c.
        * modules/crypto/md2-buffer-tests: Renamed from
        modules/crypto/md2-tests. Test tests/test-md2-buffer.c instead of

        md2-buffer: New module.
        * lib/md2-stream.c: New file, extracted from lib/md2.c.
        * lib/md2.c: Don't include stdlib.h, unlocked-io.h.
        (BLOCKSIZE, md2_stream): Moved to md2-stream.c.
        * lib/md2.h: Reorder declarations.
        * modules/crypto/md2-buffer: New file, based on modules/crypto/md2.
        * modules/crypto/md2: Rewritten.

Attachment: 0001-md2-buffer-New-module.patch
Description: Text Data

Attachment: 0002-md2-buffer-tests-New-module.patch
Description: Text Data

Attachment: 0003-md4-buffer-New-module.patch
Description: Text Data

Attachment: 0004-md4-buffer-tests-New-module.patch
Description: Text Data

Attachment: 0005-md5-Clarify-module-to-source-relation.patch
Description: Text Data

Attachment: 0006-md5-buffer-tests-New-module.patch
Description: Text Data

Attachment: 0007-sha1-Clarify-module-to-source-relation.patch
Description: Text Data

Attachment: 0008-sha1-buffer-tests-New-module.patch
Description: Text Data

Attachment: 0009-sha256-Clarify-module-to-source-relation.patch
Description: Text Data

Attachment: 0010-sha256-buffer-tests-New-module.patch
Description: Text Data

Attachment: 0011-sha512-Clarify-module-to-source-relation.patch
Description: Text Data

Attachment: 0012-sha512-buffer-tests-New-module.patch
Description: Text Data

Attachment: 0013-sm3-buffer-New-module.patch
Description: Text Data

Attachment: 0014-sm3-buffer-tests-New-module.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]