Skip to content

Added the more modern sha256 option for the --checksum algorithms. - #1007

Open
hugo-hur wants to merge 3 commits into
RsyncProject:masterfrom
hugo-hur:checksum-sha256
Open

Added the more modern sha256 option for the --checksum algorithms.#1007
hugo-hur wants to merge 3 commits into
RsyncProject:masterfrom
hugo-hur:checksum-sha256

Conversation

@hugo-hur

Copy link
Copy Markdown

Added modern algorithm for the checksum. Works out of the box with builds that have OpenSSL libs enabled.

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but docs would need to be updated too; the --checksum-choice section still lists the available checksum names without sha256. Would need to remember a NEWS update once we are ready as well.

@hugo-hur
hugo-hur requested a review from steadytao June 17, 2026 05:26
@hugo-hur

Copy link
Copy Markdown
Author

Added to the list of algorithms and something to the NEWS.md (feel free to edit or leave the NEWS.md unmerged).

@steadytao

Copy link
Copy Markdown
Member

NEWS would be updated pre-release nonetheless, thank you for the PR.

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @tridge

@hugo-hur

Copy link
Copy Markdown
Author

@tridge can this be merged?

@steadytao

Copy link
Copy Markdown
Member

Looking back at this one. Could you rebase and add focused coverage for a SHA-256 transfer, checksum negotiation with an older peer and the compiled algorithm list when OpenSSL SHA-256 support is absent?

Focused coverage for the sha256 entry added to valid_checksums_items[],
in three parts.

checksum-sha256 drives what is specific to sha256 rather than repeating
what compress-options already does for every advertised algorithm.  The
sha256 digest is 32 bytes -- longer than SUM_LENGTH (16), the legacy
MD4/MD5 size the block-checksum paths were written around -- so the test
engages the delta algorithm with --no-whole-file (a local transfer
defaults to --whole-file and would never compute a block checksum at all)
and the --append-verify redo path.  That is the long-digest counterpart of
the short-digest case append-shortsum guards, where an 8-byte xxh64 sum
used to make the sender die on an over-stated s2length.  It also asserts
the stealth-change detection -c exists for: a same-size, same-mtime edit
must be re-sent, which only happens if the digest is really compared.

checksum-sha256-negotiate-old checks that a new entry in the list both
sides advertise leaves older peers undisturbed.  Against the in-tree
old_versions binaries, 3.4.1 and 3.2.7 (negotiation-capable, no sha256)
must still settle on a mutually supported algorithm, 3.1.3 (older than
checksum negotiation) must still fall back to md5, and asking a peer
without sha256 for it must fail closed with "unknown checksum name"
rather than hang or downgrade silently.  Those binaries are static Linux
builds; where they cannot run the portable control still runs and the
old-peer cases report themselves unexercised instead of skipping, since
an unexpected skip fails the platforms that enforce testsuite/skiplist.

checksum-sha256-absent covers the other build shape.  One
#ifdef SHA256_DIGEST_LENGTH governs the sha256 entry in both
valid_checksums_items[] and valid_auth_checksums_items[], and -VV exposes
both lists, so the test asserts they agree and uses daemon_auth_list as
its probe for whether this build's OpenSSL has SHA-256 at all.  It never
skips: where sha256 is advertised it must work, and where it is not --
--disable-openssl, or the FreeBSD and Solaris jobs, which install no
openssl -- asking for it must be refused cleanly while ordinary
negotiation still succeeds.  The rejection path itself is proven on every
build with a name no rsync can have.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants