mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-04-21 06:03:54 +00:00
Encrypt the md5 value as well to make the file unidentifiable.
This commit is contained in:
parent
bf1c1ababc
commit
f61632670e
3 changed files with 31 additions and 4 deletions
13
runzip.c
13
runzip.c
|
|
@ -347,6 +347,17 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp
|
|||
#endif
|
||||
if (unlikely(read_1g(control, fd_in, md5_stored, MD5_DIGEST_SIZE) != MD5_DIGEST_SIZE))
|
||||
fatal("Failed to read md5 data in runzip_fd\n");
|
||||
if (ENCRYPT) {
|
||||
/* Even the MD5 value is stored encrypted */
|
||||
uchar *dec_buf = malloc(MD5_DIGEST_SIZE);
|
||||
|
||||
if (unlikely(aes_crypt_cbc(&control->aes_ctx, AES_DECRYPT,
|
||||
MD5_DIGEST_SIZE, control->hash_iv, md5_stored, dec_buf)))
|
||||
failure("Failed to aes_crypt_cbc in runzip_fd\n");
|
||||
for (i = 0; i < MD5_DIGEST_SIZE; i++)
|
||||
md5_stored[i] = dec_buf[i];
|
||||
free(dec_buf);
|
||||
}
|
||||
for (i = 0; i < MD5_DIGEST_SIZE; i++)
|
||||
if (md5_stored[i] != md5_resblock[i]) {
|
||||
print_output("MD5 CHECK FAILED.\nStored:");
|
||||
|
|
@ -379,7 +390,7 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp
|
|||
fatal("Failed to fdopen fd_hist in runzip_fd\n");
|
||||
if (unlikely(md5_stream(md5_fstream, md5_resblock)))
|
||||
fatal("Failed to md5_stream in runzip_fd\n");
|
||||
/* We dont' close the file here as it's closed in main */
|
||||
/* We don't close the file here as it's closed in main */
|
||||
for (i = 0; i < MD5_DIGEST_SIZE; i++)
|
||||
if (md5_stored[i] != md5_resblock[i]) {
|
||||
print_output("MD5 CHECK FAILED.\nStored:");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue