Skip to content
Snippets Groups Projects
  1. Oct 11, 2013
    • Karl Fogel's avatar
      More on issue #4: Work toward Python 2 & 3 compatibility. · d2373b1f
      Karl Fogel authored
      This doesn't get all the way to full bidirectional compatibility, but
      it's progress toward that goal.  Run 'make check' to see what's next.
      
      * onetime: Add 2 vs 3 conditional block at top.
        (btos): New utility function, defined in above block.
        (Pad.convert, Pad._make_fuzz): Handle string vs int manually.
        (main): Use binary_stdout.  Encode headers and footer before writing
          them.  Use new btos() helper where necessary.
      d2373b1f
  2. Sep 28, 2013
  3. Sep 27, 2013
    • Karl Fogel's avatar
      Update regression tests, as promised in commit e3a8e716. · 8673aa1d
      Karl Fogel authored
      Along the way, fix some conditionals that would behave correctly when
      succeeding but report a syntax error when unexpectedly failing.  What
      happened was that 'grep -n' would produce no output in the failure
      case, and that absence of output in the left half of a shell test
      would cause the '-ne' operator to be a syntax error when reached.
    • Karl Fogel's avatar
      Update pad consumption when doing the new fuzz skipping. · e3a8e716
      Karl Fogel authored
      This fixes a bug introduced in commit 52e24e55 that would result in
      re-use of pad data.  This also makes some regression tests start
      failing, because the used lengths they're expecting are now different;
      I will fix the tests in a subsequent commit.
      
      * onetime (Pad._make_fuzz): Adjust pad used length.  I mean, duh.
      e3a8e716
    • Karl Fogel's avatar
      * onetime · 3249bea2
      Karl Fogel authored
        (Pad._make_fuzz): Explain why we read 4 bytes.
        (PadEncoder.encode): Remove old comment.
      3249bea2
    • Karl Fogel's avatar
      Open files in binary mode, where appropriate. · 1f05efae
      Karl Fogel authored
      Should have been doing this all along, as Python's default I/O mode is
      text mode.  It won't make any difference in most cases, perhaps all,
      but binary mode is certainly correct if we're being careful.
      
      * onetime
        (Pad.__init__): Read the pad in binary mode.
        (Configuration.save): Add comment explaining why not binary mode.
        (main): Open input and output in binary mode.
      1f05efae
    • Karl Fogel's avatar
      Fix Issue #2: Include pad-based fuzz, for message authentication. · 52e24e55
      Karl Fogel authored
      * onetime
        (Pad.__init__): New self._begun flag variable.
        (Pad.convert): Take new format_version argument.
          Set the self._begun flag.
        (Pad.read): Remove; self._make_fuzz will handle this now.
        (Pad._make_fuzz): New function.
        (PadEncoder.__init__, PadDecoder.__init__): Remove self._used flag.
        (PadEncoder.encode): Remove fuzz code, as Pad handles this now.
        (PadDecoder.decode): Same, but pass format_version where needed.
      52e24e55
  4. Sep 22, 2013
    • Karl Fogel's avatar
      Group errors together with their final failure message. · 76ec5a94
      Karl Fogel authored
      This isn't strictly about issue #2, but it happens to make testing
      the fixes for that issue much easier, since the in-progress fixes make
      so many tests fail and one wants to see the groupings more clearly.
      
      * check.sh
        (check_result): If fail, print an extra blank line afterwards.
        (everywhere): Add an extra blank line before error messages, so
          they're easier to parse visually and so they're more grouped
          with their associated final failure line.
      76ec5a94
  5. Sep 21, 2013
    • Karl Fogel's avatar
      Continue work on issue #2: use random padding. · 5889590b
      Karl Fogel authored
      It's expected that this change would cause tests to fail that depend
      on exact offsets or lengths being recorded in the pad-records file.
      
      * onetime
        (PadEncoder.__init__): Rename self.used to self._used.
        (PadEncoder.encode, PadDecoder.decode): Grab noise bytes,
          but don't use them yet.
      
      * check.sh
        ("encode msg, where v1 pad entry has some range already used"):
        Make an error message more accurate.
      5889590b
    • Karl Fogel's avatar
    • Karl Fogel's avatar
      Fix issue #3: validation error when encrypting large files. · a9775d3b
      Karl Fogel authored
      * onetime
        (PadEncoder.encode): Don't record consumption in-loop, just record
          it once at the very end, so the reconsumption check is valid.
      
      * check.sh: Print explanation of output at start of run.
        ("encryption, decryption of large plaintext"): Remove XFAIL label.
          Also, run faster, by iterating only 5 times instead of 10.  This
          makes the files half the size they used to be, but they're still
          easily large enough to stimulate the now-fixed bug.
      a9775d3b
    • Karl Fogel's avatar
      Start on issue #2: randomly pad the message. · 1635e0f9
      Karl Fogel authored
      Along the way, discover that there's a validation bug when encrypting
      very large files.  This bug that was masked by the fact that Python's
      bzip2 compressor often doesn't produce any output until it flushes; as
      a result, Configuration._consolidate_used_ranges() never had a chance
      to wrongly claim incoherent range reconsumption when consolidating,
      which it would otherwise do, because PadEncoder.pad.convert() and
      especially PadEncoder.config.record_consumed() are only called once,
      in PadEncoder.finish(), not in PadEncoder.encode(), because the
      compressor never offers any output in the latter.
      
      So this commit is really about tidying up the code and writing a
      regression test, in preparation for fixing *that* bug, after which
      we'll return to fixing issue #2.
      
      * onetime
        (Pad.__doc__): Document that Pads are per-session.
        (Pad.offset): Fix tense in doc string.
        (Pad.PadUninitialized): New error class.
        (Pad.convert): Raise an error if offset hasn't been set yet.
        (Pad.read): New method.
        (PadEncoder.__init__): New self.used variable, initialized to False.
        (PadEncoder.encode): Only consume pad if there is compressed
          plaintext available.  This doesn't fix the validation bug referred
          to above, but it highlights the circumstance that produces the bug
          and makes debugging easier.
      
      * check.sh
        ("encryption, decryption of large plaintext"): New xfail test.
      1635e0f9
    • Karl Fogel's avatar
      Handle large plaintext input properly. · f5e437c6
      Karl Fogel authored
      * onetime
        (main): When encrypting, read in 8k chunks, instead of reading the
          whole file into memory.  If someone has enough pad to encrypt
          their DVD collection, we should still perform acceptably.
  6. Sep 19, 2013
  7. Sep 10, 2013
  8. Sep 06, 2013
  9. Jul 30, 2013
  10. Jul 29, 2013
  11. Jul 28, 2013
Loading