clamav/libclamav/7z
Valerie Snyder aa7b7e9421
Swap clean cache from MD5 to SHA2-256
Change the clean-cache to use SHA2-256 instead of MD5.
Note that all references are changed to specify "SHA2-256" now instead
of "SHA256", for clarity. But there is no plan to add support for SHA3
algorithms at this time.

Significant code cleanup. E.g.:
- Implemented goto-done error handling.
- Used `uint8_t *` instead of `unsigned char *`.
- Use `bool` for boolean checks, rather than `int.
- Used `#defines` instead of magic numbers.
- Removed duplicate `#defines` for things like hash length.

Add new option to calculate and record additional hash types when the
"generate metadata JSON" feature is enabled:
- libclamav option: `CL_SCAN_GENERAL_STORE_EXTRA_HASHES`
- clamscan option: `--json-store-extra-hashes` (default off)
- clamd.conf option: `JsonStoreExtraHashes` (default 'no')

Renamed the sigtool option `--sha256` to `--sha2-256`.
The original option is still functional, but is deprecated.

For the "generate metadata JSON" feature, the file hash is now stored as
"sha2-256" instead of "FileMD5". If you enable the "extra hashes" option,
then it will also record "md5" and "sha1".

Deprecate and disable the internal "SHA collect" feature.
This option had been hidden behind C #ifdef checks for an option that
wasn't exposed through CMake, so it was basically unavailable anyways.

Changes to calculate file hashes when they're needed and no sooner.

For the FP feature in the matcher module, I have mimiced the
optimization in the FMAP scan routine which makes it so that it can
calculate multiple hashes in a single pass of the file.

The `HandlerType` feature stores a hash of the file in the scan ctx to
prevent retyping the exact same data more than once.
I removed that hash field and replaced it with an attribute flag that is
applied to the new recursion stack layer when retyping a file.
This also closes a minor bug that would prevent retyping a file with an
all-zero hash. :)

The work upgrading cache.c to support SHA2-256 sized hashes thanks to:
https://github.com/m-sola

CLAM-255
CLAM-1858
CLAM-1859
CLAM-1860
2025-08-14 21:23:30 -04:00
..
7z.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
7zAlloc.c Silence a bunch of compiler warnings in libclamav 2014-07-10 18:11:49 -04:00
7zAlloc.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
7zBuf.c UPgrade lzma SDK to version 9.20 2011-06-18 01:49:56 +02:00
7zBuf.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
7zBuf2.c Build on Win32 2014-02-11 17:11:37 -05:00
7zCrc.c Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
7zCrc.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
7zCrcOpt.c Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
7zDec.c bb#11514 - check packSizes prior to dereference 2016-03-10 16:08:04 -05:00
7zFile.c libclamav: remove unused function File_GetLength 2013-08-13 13:08:47 -04:00
7zFile.h libclamav: remove unused function File_GetLength 2013-08-13 13:08:47 -04:00
7zIn.c bb11514 - restoring 7z header recovery mode 2016-04-06 13:45:16 -04:00
7zStream.c Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
7zVersion.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Alloc.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
Bcj2.c UPgrade lzma SDK to version 9.20 2011-06-18 01:49:56 +02:00
Bcj2.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Bra.c Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Bra.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Bra86.c UPgrade lzma SDK to version 9.20 2011-06-18 01:49:56 +02:00
BraIA64.c Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
CpuArch.c Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
CpuArch.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
Delta.c Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
Delta.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
lzma.diff libclamav: remove unused function File_GetLength 2013-08-13 13:08:47 -04:00
Lzma2Dec.c Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Lzma2Dec.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
LzmaDec.c Silence a bunch of compiler warnings in libclamav 2014-07-10 18:11:49 -04:00
LzmaDec.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Ppmd.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Ppmd7.c Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
Ppmd7.h Merge branch 'fmapify' 2012-01-04 15:52:33 +02:00
Ppmd7Dec.c Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
RotateDefs.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
Types.h Apply fix to libclamav/7z/Types.h 2013-09-25 15:49:38 -04:00
Xz.c Swap clean cache from MD5 to SHA2-256 2025-08-14 21:23:30 -04:00
Xz.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
XzCrc64.c Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
XzCrc64.h Make consistent eol's and file modes in 7z. 2014-03-13 16:16:44 -04:00
XzDec.c Swap clean cache from MD5 to SHA2-256 2025-08-14 21:23:30 -04:00
XzIn.c Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00