Con Kolivas
a0fe1a8c8e
Merge branch 'master' into liblrzip
...
Conflicts:
runzip.c
stream.h
2011-09-15 08:31:00 +10:00
Con Kolivas
e1f2138060
Make sure to read to the end of all streams when closing down an rzip stream.
...
This would have made lrzip unable to decompress some rare archives if they ended up stream 0.
2011-09-15 08:28:30 +10:00
Con Kolivas
a39b57a1e7
Add lots more debugging in maxverbose mode about where data is being written.
2011-09-15 08:26:07 +10:00
Con Kolivas
44fa63bf11
Merge branch 'master' into liblrzip
...
Conflicts:
stream.c
2011-08-17 21:19:13 +10:00
discomfitor
3316dd5505
remove trailing whitespace
2011-08-17 20:59:41 +10:00
discomfitor
63141a1035
add some gross bucketing to implement a queue for freeing stream_info structs after an operation has completed (in library mode ONLY; no changes will occur during regular execution) to fix some leaks
2011-08-17 20:59:41 +10:00
discomfitor
949c6d7a97
another semi-clusterfuck commit: *new logging macros *allow compression to and from any FILE, not just stdin/stdout *update main.c to work with the above
2011-08-17 20:59:41 +10:00
discomfitor
6dd20d735b
giant clusterfuck commit: *add and use alloca/strdupa in some spots *implement return values on almost every function *free() is now a macro which also nulls the freed pointer *when in 'library mode', fatal_exit() will not be called *fatal()/failure() are now macros which add line number and file for logging *all occurrences of fatal/failure in files other than main.c are now wrapped to use a logging callback (if specified) and then return *functions now clean up resources on returning with an error
2011-08-17 20:59:40 +10:00
discomfitor
cbff8faef7
move liblrzip.h contents to lrzip_private.h global variables-----
2011-08-17 20:59:40 +10:00
discomfitor
1c64dcfb31
more initialization stuff out of main(), remove weird coincidentally successful one_g variable
2011-08-17 20:59:40 +10:00
Con Kolivas
7104809cd1
FreeBSD needs fake memopen too.
2011-08-17 20:54:23 +10:00
Con Kolivas
1ea75154d6
Silence compiler warnings.
2011-05-08 00:05:46 +10:00
Con Kolivas
55dc9b0095
Fix the arbitrary lower limit of 128 bytes by compressing zeroes beyond the size of the chunk.
...
Put special case management of zero sized files.
Modify the percentage calculation to be able to cope with small numbers and zeroes.
2011-05-07 18:37:25 +10:00
Con Kolivas
7ed977b1c1
Detach threads from the compression side since we don't explicitly join them as they may count towards max thread count otherwise.
2011-04-23 08:15:44 +10:00
ckolivas
6ddd2e8e7e
Correct fix to ensure 64 bit lseek is used on apple in stream.c
2011-04-18 23:13:11 +10:00
Con Kolivas
373cfa25e4
limit must still be clamped to chunk_limit at most.
2011-03-23 08:44:52 +11:00
Con Kolivas
915edb78a2
Remove unused variables and functions.
2011-03-23 08:16:07 +11:00
Con Kolivas
b27e1df879
Revert "Modify the file format to not include rzip chunk size except for STDOUT chunked files thus decreasing the file format size further."
...
This reverts commit 131d4c92c2 .
Breaks STDIN/OUT so revert this change and cope with the slightly extra file size on non-chunked files.
2011-03-23 07:59:04 +11:00
Con Kolivas
8fcedbc43e
Fix big endian decompression from lzma.
2011-03-23 07:42:45 +11:00
Con Kolivas
f7a1c14e28
Put warning about possibly wrong password at appropriate place in stream.c
...
Use char to be consistent in open_stream_in.
Fail to failure() instead of fatal() should open_stream_in fail.
2011-03-23 01:13:15 +11:00
Con Kolivas
70e7866271
Include arpa/inet.h for those OSs that have endian details elsewhere.
2011-03-22 21:47:24 +11:00
ckolivas
eebba614bc
Don't adjust endianness in read_val.
2011-03-22 17:00:37 +11:00
ckolivas
36cc464d2b
Yet more 32 bit clamping.
2011-03-22 14:44:56 +11:00
ckolivas
f56e48c4f2
Modify maxram to mean the most we'll allocate in one chunk and add usable_ram for the most we'll allocate to one task.
...
Limit all maxram on 32bits to 1GB since most don't like mallocing more than this.
Update testing to allow larger total amount based on usable ram while sticking to maxram limit per alloc.
2011-03-22 12:10:21 +11:00
Con Kolivas
131d4c92c2
Modify the file format to not include rzip chunk size except for STDOUT chunked files thus decreasing the file format size further.
2011-03-22 09:04:24 +11:00
Con Kolivas
2736118f82
Check for different endian.h includes and variants of le32toh.
2011-03-22 07:57:32 +11:00
Con Kolivas
a30efcaa55
Portable generic byteswap for BE.
2011-03-22 00:13:29 +11:00
Con Kolivas
25a018fd9d
Update Authors to include Serge Belyshev.
2011-03-21 21:02:05 +11:00
Con Kolivas
95f8b9fd90
Forgot return value.
2011-03-21 20:52:11 +11:00
Con Kolivas
135067a0b4
Yet more #6 BE fixes.
2011-03-21 20:33:43 +11:00
Con Kolivas
279b745cd7
Yet #5 more BE fixes.
2011-03-21 20:31:33 +11:00
Con Kolivas
637b0d5f7c
yet yet yet yet more BE fixes.
2011-03-21 20:29:24 +11:00
Con Kolivas
04d3d6a1f5
Read BE fixes.
2011-03-21 20:23:36 +11:00
Con Kolivas
06a76bc4aa
Revert "More big endian fixes."
...
This reverts commit edbcc797e0 .
Broke regression text. Needs more attention.
2011-03-21 19:01:24 +11:00
Con Kolivas
edbcc797e0
More big endian fixes.
2011-03-21 12:41:36 +11:00
Con Kolivas
280254b8cb
Forgot to remove the initial pos offset.
2011-03-21 12:34:57 +11:00
Con Kolivas
fd9bbfe64a
One last check on limit.
2011-03-21 07:33:35 +11:00
Con Kolivas
f87528d14d
Forgot to include salt length for next head.
2011-03-20 17:01:33 +11:00
Con Kolivas
30b70dc884
Fixes for non little endian machines.
2011-03-20 16:16:38 +11:00
Con Kolivas
0dad7dcc5a
Modify the encrypted version to not write down the rzip chunk size, then keep track of where each block header is written, go back and write 8 bytes of salt before it and encrypt the headers in place.
2011-03-20 15:45:44 +11:00
Con Kolivas
e7d33e82d0
Make read_1g able to read from the tmp outbuf if we decide to read from fd_out.
2011-03-19 14:46:06 +11:00
Con Kolivas
ff5a5ed054
Use separate lrz_encrypt and lrz_decrypt wrappers to lrz_crypt.
2011-03-19 14:04:22 +11:00
Con Kolivas
63fb1bafea
Modify the file format further to make all block header information only encode the number of bytes determined in chunk_bytes instead of 8 full bytes all the time.
2011-03-18 23:18:36 +11:00
ckolivas
b8d8ecfe33
Fix warnings.
...
Patch ~ by Serge Belyshev.
2011-03-18 10:37:09 +11:00
ckolivas
e856d481bf
Discard hash_iv entirely, using passphrase hash and centralise key generation.
...
Patch by Serge Belyshev.
2011-03-18 10:22:58 +11:00
Con Kolivas
a3e80871c2
Add 8 bytes of random data to the start of every encrypted compressed block and use it along with 8 bytes from the stored salt to make a unique key and IV for encryption.
2011-03-18 00:06:11 +11:00
ckolivas
e78069c0d7
Consolidate magic writing to be able to seek to read and encrypt block header data later.
2011-03-17 16:59:27 +11:00
ckolivas
4bc23ee001
Centralise where all encryption/decryption is done, and whether to carry over the IV or not.
2011-03-17 14:10:58 +11:00
ckolivas
660243b8dc
Pad out first block if less than CBC_LEN and encrypting or else encryption will fail.
2011-03-17 11:19:34 +11:00
Con Kolivas
76280ffec5
Mlock ivec for it will hold the injection vector.
2011-03-17 00:25:15 +11:00
Con Kolivas
a7468ce6e4
Fail if block to encrypt ends up being less than one full block for now, and tidy up code.
2011-03-16 23:13:09 +11:00
Con Kolivas
c41cfe9e83
Some decompression code needs more room so simply allocate u_len for s_buf.
2011-03-16 21:48:21 +11:00
Con Kolivas
5fd7c82e1f
Implement ciphertext stealing to not have to pad compressed blocks courtesy of Serge Belyshev who saved me hours of debugging thanks!
2011-03-16 21:24:05 +11:00
Con Kolivas
928a0a098a
Consolidate padded length throughout.
2011-03-16 10:29:16 +11:00
Con Kolivas
bedea4dbec
Consolidate cbc padding into a macro.
2011-03-16 10:17:48 +11:00
Con Kolivas
ddcc45ebf0
Revert "aes_crypt_cbc always returns zero so ignore its return value."
...
This reverts commit 4314970b0d .
Oops, it can return invalid length.
2011-03-16 10:00:20 +11:00
Con Kolivas
2d2a9bc1e9
We're freeing the wrong buffer by mistake should decompression fail.
2011-03-16 09:50:30 +11:00
Con Kolivas
4314970b0d
aes_crypt_cbc always returns zero so ignore its return value.
2011-03-16 08:39:05 +11:00
Con Kolivas
519123966a
total_read field is no longer used.
2011-03-16 08:32:16 +11:00
Con Kolivas
5da0633893
aes_crypt_cbc will allow you to work on the same buffer, so don't bother allocating a separate buffer.
...
Allocate slightly more on the buffer that might be used for encryption rather than reallocing.
2011-03-16 00:46:39 +11:00
Con Kolivas
c5938c6a8b
Implement the actual aes cbc encryption and decryption.
2011-03-15 23:52:39 +11:00
ckolivas
65a681a254
Relative offset is not required in tmp inbuf, it can be safely zeroed.
2011-03-15 11:21:26 +11:00
Con Kolivas
3a8c0b6689
Remove seeks that aren't required and don't work on tmp input buffers.
...
Clean up open_stream_in.
2011-03-14 21:51:27 +11:00
Con Kolivas
c832e80085
More infrastructure to read from temporary buffers on stdin decompression.
2011-03-14 21:19:57 +11:00
Con Kolivas
36e09f206e
Begin massive read changes to support using temporary file for STDIN.
2011-03-14 20:22:45 +11:00
Con Kolivas
684959efed
Add fields for temporary input buffer and clamp memory accordingly in preparation.
2011-03-14 14:47:26 +11:00
Con Kolivas
5f7a03932b
Calculate the total expected size progressively and show it when it's not known.
2011-03-14 13:32:36 +11:00
Con Kolivas
9e772d3140
Make ALL decompression use temporary in-ram buffer whenever possible.
2011-03-14 12:48:40 +11:00
Con Kolivas
27d7c2a031
Tidy.
2011-03-14 12:23:12 +11:00
Con Kolivas
0fe3213a47
Write to physical files if we cannot fit the decompression in ram.
2011-03-14 12:15:54 +11:00
Con Kolivas
37009e2ac5
Make sure to read on an fd if that's what we're supposed to be doing.
2011-03-14 11:25:04 +11:00
Con Kolivas
b644240152
write_1g always uses control->fd_out so don't pass fd to it.
2011-03-14 11:15:35 +11:00
Con Kolivas
4a6fa7602f
Begin decompressing to stdout via temporary buffer by creating a read/write wrapper.
2011-03-14 10:07:51 +11:00
Con Kolivas
f2ddd9022c
Ignore the eof flag if the file size is known.
2011-03-13 21:31:03 +11:00
Con Kolivas
8756fe91e2
Enable decompression when file has been chunked stdout and display progress only when expected size is known.
2011-03-13 17:52:23 +11:00
Con Kolivas
6d0ac95170
Remove extra locking that does nothing.
2011-03-13 12:12:37 +11:00
Con Kolivas
6ac74aa9f0
Create a flag to know when the temporary output buffer is in use, in preparation for when we use it on decompression.
2011-03-13 08:34:06 +11:00
Con Kolivas
2f87f62696
Make the tmp out buf slightly larger to account for incompressible data, and check for buffer overflows.
2011-03-13 08:16:46 +11:00
Con Kolivas
11ea12d3ce
Forgot to test for TEST_ONLY.
2011-03-12 23:07:52 +11:00
Con Kolivas
d067a6ea9e
Implement the real workings of writing to a temporary buffer before flushing to stdout.
2011-03-12 22:46:57 +11:00
Con Kolivas
7fbec0a783
Prepare to write compressed output by flushing stdout after each chunk is compressed.
2011-03-12 19:56:08 +11:00
Con Kolivas
c75a50f723
Being modifying write_1g function to be able to write to a temporary buffer instead of straight to fd_out.
...
Split out make_magic to be able to write magic wherever we want later.
2011-03-12 14:13:28 +11:00
Con Kolivas
9444441d51
Modify maximum ram usable when stdout is being used in preparation for temporary in-ram file during stdout and fix summary shown and 32 bit limits.
2011-03-12 12:19:02 +11:00
Con Kolivas
fe68b9a3f7
Institute writing and reading of 0.6 file format for compress/decompress.
2011-03-12 11:17:11 +11:00
Con Kolivas
3a00735c24
Fix locking.
...
Patch by <mike@zentific.com>
2011-03-11 12:29:27 +11:00
Con Kolivas
a8dcecd721
fix-undefined-mutex-behavior-rename-stream-variable.
...
Patch by <mike@zentific.com>
2011-03-11 08:35:15 +11:00
Con Kolivas
643054ae22
Fix threading errors.
...
Patch by <mike@zentific.com>
2011-03-11 08:33:35 +11:00
Con Kolivas
fb2de8cb35
Remove unused offset variable.
2011-03-09 13:33:53 +11:00
Con Kolivas
1b965167ff
Remove unused offset variable.
2011-03-09 13:30:20 +11:00
Con Kolivas
11052f56f3
Ignore the lzo_1 return value entirely.
2011-03-09 13:25:33 +11:00
Con Kolivas
2db75fe408
Get rid of trailing whitespace
2011-03-09 08:50:46 +11:00
Con Kolivas
1a7c409e10
header-mangling-part-X-move-all-headers-defines-into
2011-03-09 08:37:26 +11:00
Con Kolivas
99c3ea2ab9
header-mangling-part-3-remove-ugly-hacks-for-liblrzi
2011-03-09 08:36:07 +11:00
Con Kolivas
1511c27aad
header-mangling-part-2-move-all-function-prototypes
2011-03-09 08:34:44 +11:00
Con Kolivas
f6f0a25ef6
rebase-of-function-split-and-control-additions-to-fu
2011-03-09 08:32:14 +11:00
Con Kolivas
38eca38743
Unify maxram allocation and limit threads when there isn't enough ram.
2011-03-07 13:23:14 +11:00
Con Kolivas
3433438a8e
Structs in stream.c can be static.
2011-02-26 20:11:43 +11:00
ckolivas
f9f880908c
Remove the slightly fragile exponential growth buffer size.
...
It was only speeding up compression a small amount, yet adversely affected compression and would segfault due to the size not being consistent on successive passes.
2011-02-25 10:10:22 +11:00
Con Kolivas
dcf62d11a0
Make sure not to make the bufsize larger than the limit.
...
Drop the page rounding since it is of no demonstrable benefit but adds complexity.
2011-02-24 12:20:06 +11:00
Con Kolivas
22ae326d01
Make it always clear that a failure to allocate a buffer has occurred on compression.
2011-02-24 11:52:30 +11:00