summaryrefslogtreecommitdiff
path: root/src/or/consdiff.c
AgeCommit message (Collapse)Author
2017-05-04Request (and try to use) consensus diffs.Nick Mathewson
2017-05-04bug#22143/prop#140: Use <n>,$d commands in diffs to remove signaturesNick Mathewson
In this patch I add support for "delete through end of file" in our ed diff handler, and generate our diffs so that they remove everything after in the consensus after the signatures begin.
2017-05-03bug#22143/prop#140: identify input diffs by their digest-as-signedNick Mathewson
See may 3 changes to prop140 for more background.
2017-04-24Merge branch 'consdiff_numeric_squashed'Nick Mathewson
2017-04-24consdiff: Reject ranges with non-numeric charsSebastian Hahn
Fixes bug #21964
2017-04-18Merge remote-tracking branches 'sebastian/consdiff_add' and ↵Nick Mathewson
'sebastian/consdiff_newline'
2017-04-17Fix diff generation with line added at startSebastian Hahn
The consdiff generation logic would skip over lines added at the start of the second file, and generate a diff that it would the immediately refuse because it couldn't be used to reproduce the second file from the first. Fixes #21996.
2017-04-17Don't accept ranges for add commands in consdiffSebastian Hahn
Fixes ticket #21963
2017-03-16consdiff: Fix 32-bit compilation.Nick Mathewson
Thanks, jenkins!
2017-03-16Switch ed-command parsing to use tor_parse_long.Nick Mathewson
2017-03-16Consdiff: extract router ID hash iteration functionsNick Mathewson
There was a frequent block of code that did "find the next router line, see if we've hit the end of the list, get the ID hash from the line, and enforce well-ordering." Per Ahf's review, I'm extracting it to its own function.
2017-03-16Make CONSENSUS_LINE_MAX_LEN a real defineNick Mathewson
2017-03-16Remove a couple of {\n\n instancesNick Mathewson
2017-03-16Use a better for X outside of base64_compare_table.Nick Mathewson
2017-03-16Reindent a few labels.Nick Mathewson
2017-03-16Avoid all needless memory copies when computing consensus diffs.Nick Mathewson
Previously, we operated on smartlists of NUL-terminated strings, which required us to copy both inputs to produce the NUL-terminated strings. Then we copied parts of _those_ inputs to produce an output smartlist of NUL-terminated strings. And finally, we concatenated everything into a final resulting string. This implementation, instead, uses a pointer-and-extent pattern to represent each line as a pointer into the original inputs and a length. These line objects are then added by reference into the output. No actual bytes are copied from the original strings until we finally concatenate the final result together. Bookkeeping structures and newly allocated strings (like ed commands) are allocated inside a memarea, to avoid needless mallocs or complicated should-I-free-this-or-not bookkeeping. In my measurements, this improves CPU performance by something like 18%. The memory savings should be much, much higher.
2017-03-16Swap memory allocation strategy for lists of lines for diffsNick Mathewson
Now we use a single allocation block for all the lines, rather than calling strdup on them one at a time. This should help performance a tiny bit.
2017-03-16Fill in the missing documentation on the new functionsNick Mathewson
2017-03-16Prop140: Fix a crash bug.Nick Mathewson
Found while fuzzing: this could occur if we tried to copy a nonexistent "line 0" while applying a diff.
2017-03-16Make consensus diff sha3 operations mockable.Nick Mathewson
(We'll want this for fuzzing)
2017-03-16String-based API for consensus diffs.Nick Mathewson
Also, add very strict split/join functions, and totally forbid nonempty files that end with somethig besides a newline. This change is necessary to ensure that diff/apply are actually reliable inverse operations.
2017-03-16Fix an abstraction violation.Nick Mathewson
Don't alias the insides of smartlist_t; that way lies madness.
2017-03-16Use "const" in consdiff.[ch]Nick Mathewson
2017-03-16prop140: Use sha3-256, not sha2-256Nick Mathewson
This is a protocol update from recent prop140 changes. Also, per #21673, we need to check the entire document, including signatures.
2017-03-16Fix an unreachable memory leak.Nick Mathewson
Also add a missing newline.
2017-03-16Remove digest[12]_hexNick Mathewson
2017-03-16Tweak&test log messages on apply_diffNick Mathewson
2017-03-16Fixes when applying diffs: Allow 2-line diffs, fix bogus freeNick Mathewson
The 2-line diff changs is needed to make the unit tests actually test the cases that they thought they were testing. The bogus free was found while testing those cases
2017-03-16Mark some warnings as bugs, and as (hopefully) unreachable.Nick Mathewson
2017-03-16Fix some logging on failed apply_ed_diffNick Mathewson
2017-03-16No need to end a log message with newline.Nick Mathewson
2017-03-16Use "STATIC" to export consdiff fns for testingNick Mathewson
Previously test_consdiff.c just did #include "consdiff.c", which is not great style, and messes up coverage testing.
2017-03-16Consensus diff backend from Daniel Martí GSOC project.Daniel Martí
(This commit was extracted by nickm based on the final outcome of the project, taking only the changes in the files touched by this commit from the consdiff_rebased branch. The directory-system changes are going to get worked on separately.)