fix: reject xxh3 alias, pin handshake digest length to algorithm, simplify xxh64 copy, note FIPS md5
CI / lint (pull_request) Successful in 35s
CI / sanitizers (undefined) (pull_request) Successful in 52s
CI / sanitizers (address) (pull_request) Successful in 52s
CI / fuzz-build (pull_request) Successful in 18s
CI / coverage (pull_request) Successful in 42s
CI / valgrind (pull_request) Successful in 37s
CI / build-and-test (pull_request) Successful in 12m58s

This commit is contained in:
2026-09-07 19:50:52 +02:00
parent 56981a0d9d
commit c6758531f6
4 changed files with 6 additions and 7 deletions
+2 -5
View File
@@ -16,9 +16,7 @@ bool checksum_digest(ChecksumAlgo algo, uint64_t seed, const void* data, size_t
if (algo == CHECKSUM_ALGO_XXH64) {
uint64_t digest = XXH64(data, size, seed);
uint8_t buf[CHECKSUM_MAX_DIGEST_LEN];
memcpy(buf, &digest, sizeof(digest));
memcpy(out, buf, sizeof(digest));
memcpy(out, &digest, sizeof(digest));
*out_len = sizeof(digest);
return true;
}
@@ -45,8 +43,7 @@ bool checksum_digest(ChecksumAlgo algo, uint64_t seed, const void* data, size_t
int checksum_algo_from_name(const char* name) {
if (!name)
return -1;
if (strcasecmp(name, "xxh64") == 0 || strcasecmp(name, "xxhash") == 0 ||
strcasecmp(name, "xxh3") == 0)
if (strcasecmp(name, "xxh64") == 0 || strcasecmp(name, "xxhash") == 0)
return (int)CHECKSUM_ALGO_XXH64;
if (strcasecmp(name, "md5") == 0)
return (int)CHECKSUM_ALGO_MD5;
+2 -1
View File
@@ -1017,7 +1017,8 @@ File* receive_incremental_check(int fd, const Config* config, bool* skipped) {
if ((config->checksum || config_has_basis(config))) {
uint8_t wire_len;
if (!receive_n_data(fd, &wire_len, sizeof(wire_len)) || wire_len == 0 ||
wire_len > CHECKSUM_MAX_DIGEST_LEN) {
wire_len > CHECKSUM_MAX_DIGEST_LEN ||
wire_len != checksum_digest_len((ChecksumAlgo)config->checksum_algo)) {
free(check_path);
send_status(fd, STATUS_ERROR);
return NULL;