Fix Delta2 handling for small buffers.
Fix LZP handling during preprocessing. Fix type flag handling during preprocessing. Update test cases to use configurable list of test corpus files. Update some more int64_t datatypes to uint64_t Add a gitignore.
This commit is contained in:
parent
43f5acfa2d
commit
6b756eb165
20 changed files with 158 additions and 92 deletions
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
files.lst
|
||||||
|
*.pc*
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
pcompress
|
||||||
|
Makefile
|
||||||
|
test.log
|
||||||
|
test/datafiles
|
||||||
|
*~
|
||||||
|
core.*
|
||||||
|
*.kate-swp
|
|
@ -161,7 +161,7 @@ aes_init(aes_ctx_t *ctx, uchar_t *salt, int saltlen, uchar_t *pwd, int pwd_len,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
aes_encrypt(aes_ctx_t *ctx, uchar_t *plaintext, uchar_t *ciphertext, ssize_t len, uint64_t id) {
|
aes_encrypt(aes_ctx_t *ctx, uchar_t *plaintext, uchar_t *ciphertext, uint64_t len, uint64_t id) {
|
||||||
AES_KEY key;
|
AES_KEY key;
|
||||||
uchar_t *k1, *k2;
|
uchar_t *k1, *k2;
|
||||||
struct crypto_aesctr *strm;
|
struct crypto_aesctr *strm;
|
||||||
|
@ -185,7 +185,7 @@ aes_encrypt(aes_ctx_t *ctx, uchar_t *plaintext, uchar_t *ciphertext, ssize_t len
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
aes_decrypt(aes_ctx_t *ctx, uchar_t *ciphertext, uchar_t *plaintext, ssize_t len, uint64_t id) {
|
aes_decrypt(aes_ctx_t *ctx, uchar_t *ciphertext, uchar_t *plaintext, uint64_t len, uint64_t id) {
|
||||||
AES_KEY key;
|
AES_KEY key;
|
||||||
uchar_t *k1, *k2;
|
uchar_t *k1, *k2;
|
||||||
struct crypto_aesctr *strm;
|
struct crypto_aesctr *strm;
|
||||||
|
|
|
@ -48,8 +48,8 @@ typedef struct {
|
||||||
|
|
||||||
int aes_init(aes_ctx_t *ctx, uchar_t *salt, int saltlen, uchar_t *pwd, int pwd_len,
|
int aes_init(aes_ctx_t *ctx, uchar_t *salt, int saltlen, uchar_t *pwd, int pwd_len,
|
||||||
uint64_t nonce, int enc);
|
uint64_t nonce, int enc);
|
||||||
int aes_encrypt(aes_ctx_t *ctx, uchar_t *plaintext, uchar_t *ciphertext, ssize_t len, uint64_t id);
|
int aes_encrypt(aes_ctx_t *ctx, uchar_t *plaintext, uchar_t *ciphertext, uint64_t len, uint64_t id);
|
||||||
int aes_decrypt(aes_ctx_t *ctx, uchar_t *ciphertext, uchar_t *plaintext, ssize_t len, uint64_t id);
|
int aes_decrypt(aes_ctx_t *ctx, uchar_t *ciphertext, uchar_t *plaintext, uint64_t len, uint64_t id);
|
||||||
uint64_t aes_nonce(aes_ctx_t *ctx);
|
uint64_t aes_nonce(aes_ctx_t *ctx);
|
||||||
void aes_clean_pkey(aes_ctx_t *ctx);
|
void aes_clean_pkey(aes_ctx_t *ctx);
|
||||||
void aes_cleanup(aes_ctx_t *ctx);
|
void aes_cleanup(aes_ctx_t *ctx);
|
||||||
|
|
|
@ -74,7 +74,7 @@ extern uint64_t lzma_crc64_8bchk(const uint8_t *buf, uint64_t size,
|
||||||
uint64_t crc, uint64_t *cnt);
|
uint64_t crc, uint64_t *cnt);
|
||||||
|
|
||||||
int
|
int
|
||||||
compute_checksum(uchar_t *cksum_buf, int cksum, uchar_t *buf, int64_t bytes)
|
compute_checksum(uchar_t *cksum_buf, int cksum, uchar_t *buf, uint64_t bytes)
|
||||||
{
|
{
|
||||||
DEBUG_STAT_EN(double strt, en);
|
DEBUG_STAT_EN(double strt, en);
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ init_crypto(crypto_ctx_t *cctx, uchar_t *pwd, int pwd_len, int crypto_alg,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
crypto_buf(crypto_ctx_t *cctx, uchar_t *from, uchar_t *to, int64_t bytes, uint64_t id)
|
crypto_buf(crypto_ctx_t *cctx, uchar_t *from, uchar_t *to, uint64_t bytes, uint64_t id)
|
||||||
{
|
{
|
||||||
if (cctx->crypto_alg == CRYPTO_ALG_AES) {
|
if (cctx->crypto_alg == CRYPTO_ALG_AES) {
|
||||||
if (cctx->enc_dec == ENCRYPT_FLAG) {
|
if (cctx->enc_dec == ENCRYPT_FLAG) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ typedef struct {
|
||||||
/*
|
/*
|
||||||
* Generic message digest functions.
|
* Generic message digest functions.
|
||||||
*/
|
*/
|
||||||
int compute_checksum(uchar_t *cksum_buf, int cksum, uchar_t *buf, int64_t bytes);
|
int compute_checksum(uchar_t *cksum_buf, int cksum, uchar_t *buf, uint64_t bytes);
|
||||||
int get_checksum_props(const char *name, int *cksum, int *cksum_bytes, int *mac_bytes);
|
int get_checksum_props(const char *name, int *cksum, int *cksum_bytes, int *mac_bytes);
|
||||||
void serialize_checksum(uchar_t *checksum, uchar_t *buf, int cksum_bytes);
|
void serialize_checksum(uchar_t *checksum, uchar_t *buf, int cksum_bytes);
|
||||||
void deserialize_checksum(uchar_t *checksum, uchar_t *buf, int cksum_bytes);
|
void deserialize_checksum(uchar_t *checksum, uchar_t *buf, int cksum_bytes);
|
||||||
|
@ -84,7 +84,7 @@ void deserialize_checksum(uchar_t *checksum, uchar_t *buf, int cksum_bytes);
|
||||||
*/
|
*/
|
||||||
int init_crypto(crypto_ctx_t *cctx, uchar_t *pwd, int pwd_len, int crypto_alg,
|
int init_crypto(crypto_ctx_t *cctx, uchar_t *pwd, int pwd_len, int crypto_alg,
|
||||||
uchar_t *salt, int saltlen, uint64_t nonce, int enc_dec);
|
uchar_t *salt, int saltlen, uint64_t nonce, int enc_dec);
|
||||||
int crypto_buf(crypto_ctx_t *cctx, uchar_t *from, uchar_t *to, int64_t bytes, uint64_t id);
|
int crypto_buf(crypto_ctx_t *cctx, uchar_t *from, uchar_t *to, uint64_t bytes, uint64_t id);
|
||||||
uint64_t crypto_nonce(crypto_ctx_t *cctx);
|
uint64_t crypto_nonce(crypto_ctx_t *cctx);
|
||||||
void crypto_clean_pkey(crypto_ctx_t *cctx);
|
void crypto_clean_pkey(crypto_ctx_t *cctx);
|
||||||
void cleanup_crypto(crypto_ctx_t *cctx);
|
void cleanup_crypto(crypto_ctx_t *cctx);
|
||||||
|
|
|
@ -113,6 +113,9 @@ delta2_encode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen, int
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (srclen <= (MAIN_HDR + LIT_HDR + DELTA_HDR))
|
||||||
|
return (-1);
|
||||||
|
|
||||||
if (rle_thresh < MIN_THRESH)
|
if (rle_thresh < MIN_THRESH)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
@ -121,7 +124,10 @@ delta2_encode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen, int
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
hdr_ovr = 0;
|
hdr_ovr = 0;
|
||||||
|
*((uint64_t *)dst) = LE64(srclen);
|
||||||
|
dst += MAIN_HDR;
|
||||||
rv = delta2_encode_real(src, srclen, dst, dstlen, rle_thresh, 1, &hdr_ovr);
|
rv = delta2_encode_real(src, srclen, dst, dstlen, rle_thresh, 1, &hdr_ovr);
|
||||||
|
*dstlen += MAIN_HDR;
|
||||||
DEBUG_STAT_EN(fprintf(stderr, "DELTA2: srclen: %" PRIu64 ", dstlen: %" PRIu64 "\n", srclen, *dstlen));
|
DEBUG_STAT_EN(fprintf(stderr, "DELTA2: srclen: %" PRIu64 ", dstlen: %" PRIu64 "\n", srclen, *dstlen));
|
||||||
DEBUG_STAT_EN(fprintf(stderr, "DELTA2: header overhead: %d\n", hdr_ovr));
|
DEBUG_STAT_EN(fprintf(stderr, "DELTA2: header overhead: %d\n", hdr_ovr));
|
||||||
} else {
|
} else {
|
||||||
|
@ -456,7 +462,7 @@ delta2_decode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen)
|
||||||
rcnt = val & MSB_SETZERO_MASK;
|
rcnt = val & MSB_SETZERO_MASK;
|
||||||
pos += sizeof (rcnt);
|
pos += sizeof (rcnt);
|
||||||
if (out + rcnt > *dstlen) {
|
if (out + rcnt > *dstlen) {
|
||||||
fprintf(stderr, "DELTA2 Decode: Destination buffer overflow. Corrupt data.\n");
|
fprintf(stderr, "DELTA2 Decode(lit): Destination buffer overflow. Corrupt data.\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
memcpy(pos1, pos, rcnt);
|
memcpy(pos1, pos, rcnt);
|
||||||
|
@ -473,7 +479,7 @@ delta2_decode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen)
|
||||||
delta = LE64(*((uint64_t *)pos));
|
delta = LE64(*((uint64_t *)pos));
|
||||||
pos += sizeof (delta);
|
pos += sizeof (delta);
|
||||||
if (out + rcnt > *dstlen) {
|
if (out + rcnt > *dstlen) {
|
||||||
fprintf(stderr, "DELTA2 Decode: Destination buffer overflow. Corrupt data.\n");
|
fprintf(stderr, "DELTA2 Decode(delta): Destination buffer overflow. Corrupt data.\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -648,7 +648,6 @@ _last_literals:
|
||||||
return (int) (((char*)op)-dest);
|
return (int) (((char*)op)-dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LZ4_compress_limitedOutput(const char* source,
|
int LZ4_compress_limitedOutput(const char* source,
|
||||||
char* dest,
|
char* dest,
|
||||||
int isize,
|
int isize,
|
||||||
|
|
|
@ -59,9 +59,9 @@ inline int bsc_lzp_num_blocks(int64_t n)
|
||||||
{
|
{
|
||||||
int nb;
|
int nb;
|
||||||
|
|
||||||
if (n < 256 * 1024) return 1;
|
if (n < 256LL * 1024LL) return 1;
|
||||||
if (n < 4 * 1024 * 1024) return 2;
|
if (n < 4LL * 1024LL * 1024LL) return 2;
|
||||||
if (n < 16 * 1024 * 1024) return 4;
|
if (n < 16LL * 1024LL * 1024LL) return 4;
|
||||||
if (n < LZP_MAX_BLOCK) return 8;
|
if (n < LZP_MAX_BLOCK) return 8;
|
||||||
|
|
||||||
nb = n / LZP_MAX_BLOCK;
|
nb = n / LZP_MAX_BLOCK;
|
||||||
|
|
|
@ -46,7 +46,7 @@ See also the bsc and libbsc web site:
|
||||||
|
|
||||||
#define LZP_DEFAULT_LZPHASHSIZE 16
|
#define LZP_DEFAULT_LZPHASHSIZE 16
|
||||||
#define LZP_DEFAULT_LZPMINLEN 128
|
#define LZP_DEFAULT_LZPMINLEN 128
|
||||||
#define LZP_MAX_BLOCK (2000000000L)
|
#define LZP_MAX_BLOCK (2000000000LL)
|
||||||
#define ALPHABET_SIZE (256)
|
#define ALPHABET_SIZE (256)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
22
main.c
22
main.c
|
@ -208,7 +208,6 @@ preproc_compress(compress_func_ptr cmp_func, void *src, uint64_t srclen, void *d
|
||||||
if (lzp_preprocess) {
|
if (lzp_preprocess) {
|
||||||
int hashsize;
|
int hashsize;
|
||||||
|
|
||||||
type = PREPROC_TYPE_LZP;
|
|
||||||
hashsize = lzp_hash_size(level);
|
hashsize = lzp_hash_size(level);
|
||||||
result = lzp_compress((const uchar_t *)src, (uchar_t *)dst, srclen,
|
result = lzp_compress((const uchar_t *)src, (uchar_t *)dst, srclen,
|
||||||
hashsize, LZP_DEFAULT_LZPMINLEN, 0);
|
hashsize, LZP_DEFAULT_LZPMINLEN, 0);
|
||||||
|
@ -216,6 +215,7 @@ preproc_compress(compress_func_ptr cmp_func, void *src, uint64_t srclen, void *d
|
||||||
if (!enable_delta2_encode)
|
if (!enable_delta2_encode)
|
||||||
return (-1);
|
return (-1);
|
||||||
} else {
|
} else {
|
||||||
|
type |= PREPROC_TYPE_LZP;
|
||||||
srclen = result;
|
srclen = result;
|
||||||
memcpy(src, dst, srclen);
|
memcpy(src, dst, srclen);
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,6 @@ preproc_compress(compress_func_ptr cmp_func, void *src, uint64_t srclen, void *d
|
||||||
} else if (!enable_delta2_encode) {
|
} else if (!enable_delta2_encode) {
|
||||||
/*
|
/*
|
||||||
* Execution won't come here but just in case ...
|
* Execution won't come here but just in case ...
|
||||||
* Even Delta2 encoding below enables LZP.
|
|
||||||
*/
|
*/
|
||||||
fprintf(stderr, "Invalid preprocessing mode\n");
|
fprintf(stderr, "Invalid preprocessing mode\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -241,7 +240,7 @@ preproc_compress(compress_func_ptr cmp_func, void *src, uint64_t srclen, void *d
|
||||||
}
|
}
|
||||||
|
|
||||||
*dest = type;
|
*dest = type;
|
||||||
*((int64_t *)(dest + 1)) = htonll(srclen);
|
*((uint64_t *)(dest + 1)) = htonll(srclen);
|
||||||
_dstlen = srclen;
|
_dstlen = srclen;
|
||||||
DEBUG_STAT_EN(strt = get_wtime_millis());
|
DEBUG_STAT_EN(strt = get_wtime_millis());
|
||||||
result = cmp_func(src, srclen, dest+9, &_dstlen, level, chdr, data);
|
result = cmp_func(src, srclen, dest+9, &_dstlen, level, chdr, data);
|
||||||
|
@ -255,7 +254,15 @@ preproc_compress(compress_func_ptr cmp_func, void *src, uint64_t srclen, void *d
|
||||||
DEBUG_STAT_EN(fprintf(stderr, "Chunk did not compress.\n"));
|
DEBUG_STAT_EN(fprintf(stderr, "Chunk did not compress.\n"));
|
||||||
memcpy(dest+1, src, srclen);
|
memcpy(dest+1, src, srclen);
|
||||||
*dstlen = srclen + 1;
|
*dstlen = srclen + 1;
|
||||||
result = 0;
|
/*
|
||||||
|
* If compression failed but one of the pre-processing succeeded then
|
||||||
|
* type flags will be non-zero. In that case we still indicate a success
|
||||||
|
* result so that decompression will reverse the pre-processing. The
|
||||||
|
* type flags will indicate that compression was not done and the
|
||||||
|
* decompress routine will not be called.
|
||||||
|
*/
|
||||||
|
if (type > 0)
|
||||||
|
result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -274,7 +281,7 @@ preproc_decompress(compress_func_ptr dec_func, void *src, uint64_t srclen, void
|
||||||
sorc++;
|
sorc++;
|
||||||
srclen--;
|
srclen--;
|
||||||
if (type & PREPROC_COMPRESSED) {
|
if (type & PREPROC_COMPRESSED) {
|
||||||
*dstlen = ntohll(*((int64_t *)(sorc)));
|
*dstlen = ntohll(*((uint64_t *)(sorc)));
|
||||||
sorc += 8;
|
sorc += 8;
|
||||||
srclen -= 8;
|
srclen -= 8;
|
||||||
DEBUG_STAT_EN(strt = get_wtime_millis());
|
DEBUG_STAT_EN(strt = get_wtime_millis());
|
||||||
|
@ -295,7 +302,7 @@ preproc_decompress(compress_func_ptr dec_func, void *src, uint64_t srclen, void
|
||||||
memcpy(src, dst, _dstlen);
|
memcpy(src, dst, _dstlen);
|
||||||
srclen = _dstlen;
|
srclen = _dstlen;
|
||||||
*dstlen = _dstlen;
|
*dstlen = _dstlen;
|
||||||
} else {
|
} else {
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +319,7 @@ preproc_decompress(compress_func_ptr dec_func, void *src, uint64_t srclen, void
|
||||||
*dstlen = result;
|
*dstlen = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(type & (PREPROC_COMPRESSED | PREPROC_TYPE_DELTA2 | PREPROC_TYPE_LZP))) {
|
if (!(type & (PREPROC_COMPRESSED | PREPROC_TYPE_DELTA2 | PREPROC_TYPE_LZP)) && type > 0) {
|
||||||
fprintf(stderr, "Invalid preprocessing flags: %d\n", type);
|
fprintf(stderr, "Invalid preprocessing flags: %d\n", type);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
@ -1156,6 +1163,7 @@ redo:
|
||||||
compressed_chunk = tdat->compressed_chunk + CHUNK_FLAG_SZ;
|
compressed_chunk = tdat->compressed_chunk + CHUNK_FLAG_SZ;
|
||||||
rbytes = tdat->rbytes;
|
rbytes = tdat->rbytes;
|
||||||
dedupe_index_sz = 0;
|
dedupe_index_sz = 0;
|
||||||
|
tdat->rctx->valid = 0;
|
||||||
|
|
||||||
/* Perform Dedup if enabled. */
|
/* Perform Dedup if enabled. */
|
||||||
if ((enable_rabin_scan || enable_fixed_scan)) {
|
if ((enable_rabin_scan || enable_fixed_scan)) {
|
||||||
|
|
|
@ -12,11 +12,35 @@ else
|
||||||
fi
|
fi
|
||||||
PDIR=`pwd`
|
PDIR=`pwd`
|
||||||
|
|
||||||
[ ! -f datafiles/bin.dat ] && (tar cpf - /usr/bin | dd of=datafiles/bin.dat bs=1024 count=5120; cat res/jpg/*.jpg >> datafiles/bin.dat)
|
if [ ! -f datafiles/files.lst ]
|
||||||
[ ! -f datafiles/share.dat ] && tar cpf - /usr/share | dd of=datafiles/share.dat bs=1024 count=5120
|
then
|
||||||
[ ! -f datafiles/inc.dat ] && (tar cpf - /usr/include | dd of=datafiles/inc.dat bs=1024 count=5120; cat res/xml/*.xml >> datafiles/inc.dat)
|
[ ! -f datafiles/bin.dat ] && (tar cpf - /usr/bin | dd of=datafiles/bin.dat bs=1024 count=5120; cat res/jpg/*.jpg >> datafiles/bin.dat)
|
||||||
[ ! -f datafiles/combined.dat ] && cat datafiles/bin.dat datafiles/share.dat datafiles/inc.dat >> datafiles/combined.dat
|
[ ! -f datafiles/share.dat ] && tar cpf - /usr/share | dd of=datafiles/share.dat bs=1024 count=5120
|
||||||
[ ! -f datafiles/comb_d.dat ] && sh -c "cat datafiles/combined.dat > datafiles/comb_d.dat; cat datafiles/combined.dat >> datafiles/comb_d.dat"
|
[ ! -f datafiles/inc.dat ] && (tar cpf - /usr/include | dd of=datafiles/inc.dat bs=1024 count=5120; cat res/xml/*.xml >> datafiles/inc.dat)
|
||||||
|
[ ! -f datafiles/combined.dat ] && cat datafiles/bin.dat datafiles/share.dat datafiles/inc.dat >> datafiles/combined.dat
|
||||||
|
[ ! -f datafiles/comb_d.dat ] && sh -c "cat datafiles/combined.dat > datafiles/comb_d.dat; cat datafiles/combined.dat >> datafiles/comb_d.dat"
|
||||||
|
|
||||||
|
pdir=`pwd`
|
||||||
|
echo ${pdir}/datafiles/bin.dat > datafiles/files.lst
|
||||||
|
echo ${pdir}/datafiles/share.dat >> datafiles/files.lst
|
||||||
|
echo ${pdir}/datafiles/inc.dat >> datafiles/files.lst
|
||||||
|
echo ${pdir}/datafiles/combined.dat >> datafiles/files.lst
|
||||||
|
echo ${pdir}/datafiles/comb_d.dat >> datafiles/files.lst
|
||||||
|
else
|
||||||
|
for f in `cat datafiles/files.lst`
|
||||||
|
do
|
||||||
|
if [ ! -f ${f} ]
|
||||||
|
then
|
||||||
|
echo "Cannot find test data file: ${f}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dir=`dirname ${f}`
|
||||||
|
rm -f ${dir}/.pco*
|
||||||
|
rm -f ${dir}/*.pz
|
||||||
|
rm -f ${dir}/*.1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
failures=0
|
failures=0
|
||||||
|
|
|
@ -12,7 +12,7 @@ do
|
||||||
|
|
||||||
for level in 1 3 9 14
|
for level in 1 3 9 14
|
||||||
do
|
do
|
||||||
for tf in bin.dat share.dat inc.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
for seg in 1m 100m
|
for seg in 1m 100m
|
||||||
do
|
do
|
||||||
|
|
|
@ -7,7 +7,7 @@ echo "#################################################"
|
||||||
|
|
||||||
for algo in zlib ppmd
|
for algo in zlib ppmd
|
||||||
do
|
do
|
||||||
for tf in bin.dat share.dat inc.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
for cksum in CRC64 SHA256 SHA512 SKEIN256 SKEIN512 KECCAK256 KECCAK512
|
for cksum in CRC64 SHA256 SHA512 SKEIN256 SKEIN512 KECCAK256 KECCAK512
|
||||||
do
|
do
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
clean() {
|
clean() {
|
||||||
for algo in lzfx lz4 zlib bzip2 lzma lzmaMt libbsc ppmd adapt adapt2
|
for algo in lzfx lz4 zlib bzip2 lzma lzmaMt libbsc ppmd adapt adapt2
|
||||||
do
|
do
|
||||||
for tf in bin.dat share.dat inc.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
rm -f ${tf}.${algo}
|
rm -f ${tf}.${algo}
|
||||||
done
|
done
|
||||||
|
@ -22,7 +22,7 @@ do
|
||||||
../../pcompress 2>&1 | grep $algo > /dev/null
|
../../pcompress 2>&1 | grep $algo > /dev/null
|
||||||
[ $? -ne 0 ] && continue
|
[ $? -ne 0 ] && continue
|
||||||
|
|
||||||
for tf in bin.dat share.dat inc.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
echo "Preparing ${algo} compressed ${tf} datafile ..."
|
echo "Preparing ${algo} compressed ${tf} datafile ..."
|
||||||
cmd="../../pcompress -c ${algo} -l5 -s500k ${tf}"
|
cmd="../../pcompress -c ${algo} -l5 -s500k ${tf}"
|
||||||
|
@ -43,7 +43,7 @@ do
|
||||||
|
|
||||||
for level in 1 3 9 14
|
for level in 1 3 9 14
|
||||||
do
|
do
|
||||||
for tf in bin.dat share.dat inc.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
for seg in 1m 100m
|
for seg in 1m 100m
|
||||||
do
|
do
|
||||||
|
|
|
@ -5,13 +5,11 @@ echo "#################################################"
|
||||||
echo "# Test Deduplication, Delta Encoding and LZP"
|
echo "# Test Deduplication, Delta Encoding and LZP"
|
||||||
echo "#################################################"
|
echo "#################################################"
|
||||||
|
|
||||||
rm -f *.pz
|
|
||||||
rm -f *.1
|
|
||||||
|
|
||||||
for algo in lzfx lz4 adapt
|
for algo in lzfx lz4 adapt
|
||||||
do
|
do
|
||||||
for tf in combined.dat comb_d.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
|
rm -f ${tf}.*
|
||||||
for feat in "-D" "-D -B3 -L" "-D -B4 -E" "-D -B2 -EE" "-D -B5 -EE -L" "-D -B2 -r" "-P" "-D -P" "-D -L -P"
|
for feat in "-D" "-D -B3 -L" "-D -B4 -E" "-D -B2 -EE" "-D -B5 -EE -L" "-D -B2 -r" "-P" "-D -P" "-D -L -P"
|
||||||
do
|
do
|
||||||
for seg in 2m 100m
|
for seg in 2m 100m
|
||||||
|
|
|
@ -5,13 +5,11 @@ echo "#################################################"
|
||||||
echo "# Crypto tests"
|
echo "# Crypto tests"
|
||||||
echo "#################################################"
|
echo "#################################################"
|
||||||
|
|
||||||
rm -f *.pz
|
|
||||||
rm -f *.1
|
|
||||||
|
|
||||||
for algo in lzfx adapt2
|
for algo in lzfx adapt2
|
||||||
do
|
do
|
||||||
for tf in comb_d.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
|
rm -f ${tf}.*
|
||||||
for feat in "-e" "-e -L -S SHA256" "-D -e -S SHA512" "-D -EE -L -e -S SKEIN512" "-e -S CRC64" "-e -P" "-e -L -P -S KECCAK256" "-D -e -L -S KECCAK512"
|
for feat in "-e" "-e -L -S SHA256" "-D -e -S SHA512" "-D -EE -L -e -S SKEIN512" "-e -S CRC64" "-e -P" "-e -L -P -S KECCAK256" "-D -e -L -S KECCAK512"
|
||||||
do
|
do
|
||||||
for seg in 2m 100m
|
for seg in 2m 100m
|
||||||
|
|
|
@ -12,8 +12,9 @@ do
|
||||||
|
|
||||||
for level in 1 3
|
for level in 1 3
|
||||||
do
|
do
|
||||||
for tf in combined.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
|
rm -f ${tf}.*
|
||||||
for seg in 1m 2m 3m
|
for seg in 1m 2m 3m
|
||||||
do
|
do
|
||||||
cmd="cat ${tf} | ../../pcompress -p -c ${algo} -l ${level} -s ${seg} > ${tf}.pz"
|
cmd="cat ${tf} | ../../pcompress -p -c ${algo} -l ${level} -s ${seg} > ${tf}.pz"
|
||||||
|
|
|
@ -10,7 +10,7 @@ rm -f *.1
|
||||||
|
|
||||||
for algo in lzfx adapt2
|
for algo in lzfx adapt2
|
||||||
do
|
do
|
||||||
for tf in comb_d.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
for feat in "-e" "-e -L" "-D -e" "-D -EE -L -e" "-e -S CRC64"
|
for feat in "-e" "-e -L" "-D -e" "-D -EE -L -e" "-e -S CRC64"
|
||||||
do
|
do
|
||||||
|
|
|
@ -10,7 +10,7 @@ rm -f *.1
|
||||||
|
|
||||||
for algo in lzfx lz4 adapt adapt2
|
for algo in lzfx lz4 adapt adapt2
|
||||||
do
|
do
|
||||||
for tf in combined.dat comb_d.dat
|
for tf in `cat files.lst`
|
||||||
do
|
do
|
||||||
for feat in "-F" "-F -B3 -L" "-F -B4" "-F -B5 -L" "-F -P" "-F -L -P"
|
for feat in "-F" "-F -B3 -L" "-F -B4" "-F -B5 -L" "-F -P" "-F -L -P"
|
||||||
do
|
do
|
||||||
|
|
119
test/t9.tst
119
test/t9.tst
|
@ -5,158 +5,179 @@ echo "####################################################"
|
||||||
echo "# Test out of range parameters and error conditions."
|
echo "# Test out of range parameters and error conditions."
|
||||||
echo "####################################################"
|
echo "####################################################"
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Select a large file from the list
|
||||||
|
#
|
||||||
|
tstf=
|
||||||
|
tsz=0
|
||||||
|
for tf in `cat files.lst`
|
||||||
|
do
|
||||||
|
sz=`ls -l ${tf} | awk '{ print $5 }'`
|
||||||
|
if [ $sz -gt $tsz ]
|
||||||
|
then
|
||||||
|
tsz=$sz
|
||||||
|
tstf="$tf"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
for feat in "-L" "-L -D" "-L -D -E" "-L -B5" "-L -D -E -B2" "-F" "-F -L"
|
for feat in "-L" "-L -D" "-L -D -E" "-L -B5" "-L -D -E -B2" "-F" "-F -L"
|
||||||
do
|
do
|
||||||
cmd="../../pcompress -c dummy -l4 -s1m $feat combined.dat"
|
cmd="../../pcompress -c dummy -l4 -s1m $feat $tstf"
|
||||||
echo "Running $cmd"
|
echo "Running $cmd"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Compression DID NOT ERROR where expected"
|
echo "FATAL: Compression DID NOT ERROR where expected"
|
||||||
|
rm -f ${tstf}.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
rm -f ${tstf}.pz
|
||||||
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
for feat in "-B8 -s2m -l1" "-B0 -s2m -l1" "-D -s10k -l1" "-D -F -s2m -l1" "-p -e -s2m -l1" "-s2m -l15"
|
for feat in "-B8 -s2m -l1" "-B0 -s2m -l1" "-D -s10k -l1" "-D -F -s2m -l1" "-p -e -s2m -l1" "-s2m -l15"
|
||||||
do
|
do
|
||||||
for algo in lzfx lz4 zlib bzip2 libbsc ppmd lzma
|
for algo in lzfx lz4 zlib bzip2 libbsc ppmd lzma
|
||||||
do
|
do
|
||||||
cmd="../../pcompress -c lzfx $feat combined.dat"
|
cmd="../../pcompress -c lzfx $feat $tstf"
|
||||||
echo "Running $cmd"
|
echo "Running $cmd"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Compression DID NOT ERROR where expected"
|
echo "FATAL: Compression DID NOT ERROR where expected"
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
rm -f ${tstf}.pz
|
||||||
|
break
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
for feat in "-S CRC64" "-S SKEIN256" "-S SKEIN512" "-S SHA256" "-S SHA512" "-S KECCAK256" "-S KECCAK512"
|
for feat in "-S CRC64" "-S SKEIN256" "-S SKEIN512" "-S SHA256" "-S SHA512" "-S KECCAK256" "-S KECCAK512"
|
||||||
do
|
do
|
||||||
rm -f combined.dat.1.pz
|
rm -f ${tstf}.*
|
||||||
rm -f combined.dat.pz
|
|
||||||
rm -f combined.dat.1
|
|
||||||
|
|
||||||
cmd="../../pcompress -c lzfx -l3 -s1m $feat combined.dat"
|
cmd="../../pcompress -c lzfx -l3 -s1m $feat ${tstf}"
|
||||||
echo "Running $cmd"
|
echo "Running $cmd"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Compression errored."
|
echo "FATAL: Compression errored."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
|
d=`dirname ${tstf}`
|
||||||
|
rm -f ${d}/.pc*
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Corrupting file header ..."
|
echo "Corrupting file header ..."
|
||||||
dd if=/dev/urandom conv=notrunc of=combined.dat.pz bs=4 seek=1 count=1
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=1 count=1
|
||||||
cmd="../../pcompress -d combined.dat.pz combined.dat.1"
|
cmd="../../pcompress -d ${tstf}.pz ${tstf}.1"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Decompression DID NOT ERROR where expected."
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
|
|
||||||
cmd="../../pcompress -c zlib -l3 -s1m $feat combined.dat"
|
cmd="../../pcompress -c zlib -l3 -s1m $feat ${tstf}"
|
||||||
echo "Running $cmd"
|
echo "Running $cmd"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Compression errored."
|
echo "FATAL: Compression errored."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp combined.dat.pz combined.dat.1.pz
|
cp ${tstf}.pz ${tstf}.1.pz
|
||||||
echo "Corrupting file ..."
|
echo "Corrupting file ..."
|
||||||
dd if=/dev/urandom conv=notrunc of=combined.dat.pz bs=4 seek=100 count=1
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=100 count=1
|
||||||
cmd="../../pcompress -d combined.dat.pz combined.dat.1"
|
cmd="../../pcompress -d ${tstf}.pz ${tstf}.1"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Decompression DID NOT ERROR where expected."
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
rm -f combined.dat.1.pz
|
rm -f ${tstf}.1.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
cp combined.dat.1.pz combined.dat.pz
|
cp ${tstf}.1.pz ${tstf}.pz
|
||||||
echo "Corrupting file ..."
|
echo "Corrupting file ..."
|
||||||
dd if=/dev/urandom conv=notrunc of=combined.dat.1.pz bs=4 seek=51 count=1
|
dd if=/dev/urandom conv=notrunc of=${tstf}.1.pz bs=4 seek=51 count=1
|
||||||
cmd="../../pcompress -d combined.dat.1.pz combined.dat.1"
|
cmd="../../pcompress -d ${tstf}.1.pz ${tstf}.1"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Decompression DID NOT ERROR where expected."
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
rm -f combined.dat.1.pz
|
rm -f ${tstf}.1.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f combined.dat.1 combined.dat.1.pz combined.dat.pz
|
rm -f ${tstf}.1 ${tstf}.1.pz ${tstf}.pz
|
||||||
echo "plainpass" > /tmp/pwf
|
echo "plainpass" > /tmp/pwf
|
||||||
cmd="../../pcompress -c zlib -l3 -s1m -e -w /tmp/pwf $feat combined.dat"
|
cmd="../../pcompress -c zlib -l3 -s1m -e -w /tmp/pwf $feat ${tstf}"
|
||||||
echo "Running $cmd"
|
echo "Running $cmd"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Compression errored."
|
echo "FATAL: Compression errored."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
pw=`cat /tmp/pwf`
|
pw=`cat /tmp/pwf`
|
||||||
if [ "$pw" = "plainpasswd" ]
|
if [ "$pw" = "plainpasswd" ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Password file was not zeroed"
|
echo "FATAL: Password file was not zeroed"
|
||||||
rm -f /tmp/pwf combined.dat.pz
|
rm -f /tmp/pwf ${tstf}.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp combined.dat.pz combined.dat.1.pz
|
cp ${tstf}.pz ${tstf}.1.pz
|
||||||
echo "Corrupting file ..."
|
echo "Corrupting file ..."
|
||||||
dd if=/dev/urandom conv=notrunc of=combined.dat.pz bs=4 seek=115 count=1
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=115 count=1
|
||||||
echo "plainpass" > /tmp/pwf
|
echo "plainpass" > /tmp/pwf
|
||||||
cmd="../../pcompress -d -w /tmp/pwf combined.dat.pz combined.dat.1"
|
cmd="../../pcompress -d -w /tmp/pwf ${tstf}.pz ${tstf}.1"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Decompression DID NOT ERROR where expected."
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
rm -f combined.dat.1.pz
|
rm -f ${tstf}.1.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp combined.dat.1.pz combined.dat.pz
|
cp ${tstf}.1.pz ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
echo "Corrupting file header ..."
|
echo "Corrupting file header ..."
|
||||||
dd if=/dev/urandom conv=notrunc of=combined.dat.pz bs=4 seek=10 count=1
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=10 count=1
|
||||||
echo "plainpass" > /tmp/pwf
|
echo "plainpass" > /tmp/pwf
|
||||||
cmd="../../pcompress -d -w /tmp/pwf combined.dat.pz combined.dat.1"
|
cmd="../../pcompress -d -w /tmp/pwf ${tstf}.pz ${tstf}.1"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "FATAL: Decompression DID NOT ERROR where expected."
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
rm -f combined.dat.1.pz
|
rm -f ${tstf}.1.pz
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f combined.dat.1.pz
|
rm -f ${tstf}.1.pz
|
||||||
rm -f combined.dat.pz
|
rm -f ${tstf}.pz
|
||||||
rm -f combined.dat.1
|
rm -f ${tstf}.1
|
||||||
rm -f /tmp/pwf
|
rm -f /tmp/pwf
|
||||||
|
|
||||||
echo "#################################################"
|
echo "#################################################"
|
||||||
|
|
Loading…
Reference in a new issue