diff options
author | Wayne Davison <wayne@opencoder.net> | 2022-09-10 09:43:47 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2022-09-10 11:39:37 -0700 |
commit | 7e2711bb2b4b30bc842dd8670c34a87e2ca0c2df (patch) | |
tree | a9d8193db72dcfac35891176dcd8ede9ebdf42d5 /match.c | |
parent | b8c2fde3a54abc1ebef6d375b687395b798412f5 (diff) | |
download | rsync-7e2711bb2b4b30bc842dd8670c34a87e2ca0c2df.tar.gz |
Improve various things in the checksum code
- Size flist checksum data to hold the active size, not the max.
- Add a negotiated hash method to the daemon auth code.
- Use EVP for all openssl digests. This makes it easy to add more
openssl digest methods and avoids deprecation warnings.
- Support a way to re-enable deprecated digests via openssl conf
file and allow a default file to be configured.
- Supply a simple openssl-rsync.cnf file to enable legacy digests.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -24,7 +24,9 @@ extern int checksum_seed; extern int append_mode; -extern int xfersum_type; + +extern struct name_num_item *xfer_sum_nni; +extern int xfer_sum_len; int updating_basis_file; char sender_file_sum[MAX_DIGEST_LEN]; @@ -356,15 +358,13 @@ static void hash_search(int f,struct sum_struct *s, **/ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len) { - int sum_len; - last_match = 0; false_alarms = 0; hash_hits = 0; matches = 0; data_transfer = 0; - sum_init(xfersum_type, checksum_seed); + sum_init(xfer_sum_nni, checksum_seed); if (append_mode > 0) { if (append_mode == 2) { @@ -405,22 +405,22 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len) matched(f, s, buf, len, -1); } - sum_len = sum_end(sender_file_sum); + sum_end(sender_file_sum); /* If we had a read error, send a bad checksum. We use all bits * off as long as the checksum doesn't happen to be that, in * which case we turn the last 0 bit into a 1. */ if (buf && buf->status != 0) { int i; - for (i = 0; i < sum_len && sender_file_sum[i] == 0; i++) {} - memset(sender_file_sum, 0, sum_len); - if (i == sum_len) + for (i = 0; i < xfer_sum_len && sender_file_sum[i] == 0; i++) {} + memset(sender_file_sum, 0, xfer_sum_len); + if (i == xfer_sum_len) sender_file_sum[i-1]++; } if (DEBUG_GTE(DELTASUM, 2)) rprintf(FINFO,"sending file_sum\n"); - write_buf(f, sender_file_sum, sum_len); + write_buf(f, sender_file_sum, xfer_sum_len); if (DEBUG_GTE(DELTASUM, 2)) { rprintf(FINFO, "false_alarms=%d hash_hits=%d matches=%d\n", |