clamav/libclamav/libclamav.map

330 lines
7.3 KiB
Text
Raw Normal View History

CLAMAV_PUBLIC {
global:
cl_cvdfree;
cl_cvdhead;
cl_cvdparse;
cl_cvdverify;
cl_debug;
cl_init;
cl_engine_new;
cl_engine_set_num;
cl_engine_get_num;
cl_engine_set_str;
cl_engine_get_str;
cl_engine_set_clcb_hash;
2011-08-22 15:22:55 +03:00
cl_engine_set_clcb_meta;
cl_engine_set_clcb_file_props;
cl_set_clcb_msg;
2010-06-22 15:41:19 +02:00
cl_engine_set_clcb_pre_scan;
cl_engine_set_clcb_post_scan;
cl_engine_set_clcb_virus_found;
2010-06-22 15:41:19 +02:00
cl_engine_set_clcb_sigload;
2011-06-15 12:37:51 +03:00
cl_engine_set_clcb_pre_cache;
cl_engine_settings_copy;
cl_engine_settings_apply;
cl_engine_settings_free;
cl_engine_compile;
cl_engine_addref;
cl_engine_free;
cl_load;
cl_retdbdir;
cl_retflevel;
cl_retver;
cl_scandesc;
cl_scandesc_callback;
cl_scanfile;
cl_scanfile_callback;
cl_statchkdir;
cl_statfree;
cl_statinidir;
cl_countsigs;
cl_strerror;
2011-06-14 22:35:03 +03:00
cl_fmap_open_handle;
cl_fmap_open_memory;
cl_scanmap_callback;
2011-06-17 23:20:01 +03:00
cl_fmap_close;
cl_always_gen_section_hash;
cl_engine_set_stats_set_cbdata;
cl_engine_set_clcb_stats_add_sample;
cl_engine_set_clcb_stats_remove_sample;
cl_engine_set_clcb_stats_decrement_count;
cl_engine_set_clcb_stats_submit;
cl_engine_set_clcb_stats_flush;
cl_engine_set_clcb_stats_get_num;
cl_engine_set_clcb_stats_get_size;
cl_engine_set_clcb_stats_get_hostid;
cl_hash_init;
cl_update_hash;
cl_finish_hash;
cl_hash_destroy;
cl_engine_stats_enable;
lsig_sub_matched;
cl_engine_set_clcb_engine_compile_progress;
cl_engine_set_clcb_engine_free_progress;
cl_engine_set_clcb_sigload_progress;
cl_cvdunpack;
cl_engine_set_clcb_file_inspection;
cl_cvdgetage;
cl_engine_set_clcb_vba;
FIPS-compliant CVD signing and verification Add X509 certificate chain based signing with PKCS7-PEM external signatures distributed alongside CVD's in a custom .cvd.sign format. This new signing and verification mechanism is primarily in support of FIPS compliance. Fixes: https://github.com/Cisco-Talos/clamav/issues/564 Add a Rust implementation for parsing, verifying, and unpacking CVD files. Now installs a 'certs' directory in the app config directory (e.g. <prefix>/etc/certs). The install location is configurable. The CMake option to configure the CVD certs directory is: `-D CVD_CERTS_DIRECTORY=PATH` New options to set an alternative CVD certs directory: - Commandline for freshclam, clamd, clamscan, and sigtool is: `--cvdcertsdir PATH` - Env variable for freshclam, clamd, clamscan, and sigtool is: `CVD_CERTS_DIR` - Config option for freshclam and clamd is: `CVDCertsDirectory PATH` Sigtool: - Add sign/verify commands. - Also verify CDIFF external digital signatures when applying CDIFFs. - Place commonly used commands at the top of --help string. - Fix up manpage. Freshclam: - Will try to download .sign files to verify CVDs and CDIFFs. - Fix an issue where making a CLD would only include the CFG file for daily and not if patching any other database. libclamav.so: - Bump version to 13:0:1 (aka 12.1.0). - Also remove libclamav.map versioning. Resolves: https://github.com/Cisco-Talos/clamav/issues/1304 - Add two new API's to the public clamav.h header: ```c extern cl_error_t cl_cvdverify_ex(const char *file, const char *certs_directory); extern cl_error_t cl_cvdunpack_ex(const char *file, const char *dir, bool dont_verify, const char *certs_directory); ``` The original `cl_cvdverify` and `cl_cvdunpack` are deprecated. - Add `cl_engine_field` enum option `CL_ENGINE_CVDCERTSDIR`. You may set this option with `cl_engine_set_str` and get it with `cl_engine_get_str`, to override the compiled in default CVD certs directory. libfreshclam.so: Bump version to 4:0:0 (aka 4.0.0). Add sigtool sign/verify tests and test certs. Make it so downloadFile doesn't throw a warning if the server doesn't have the .sign file. Replace use of md5-based FP signatures in the unit tests with sha256-based FP signatures because the md5 implementation used by Python may be disabled in FIPS mode. Fixes: https://github.com/Cisco-Talos/clamav/issues/1411 CMake: Add logic to enable the Rust openssl-sys / openssl-rs crates to build against the same OpenSSL library as is used for the C build. The Rust unit test application must also link directly with libcrypto and libssl. Fix some log messages with missing new lines. Fix missing environment variable notes in --help messages and manpages. Deconflict CONFDIR/DATADIR/CERTSDIR variable names that are defined in clamav-config.h.in for libclamav from variable that had the same name for use in clamav applications that use the optparser. The 'clamav-test' certs for the unit tests will live for 10 years. The 'clamav-beta.crt' public cert will only live for 120 days and will be replaced before the stable release with a production 'clamav.crt'.
2024-11-21 14:01:09 -05:00
cl_cvdunpack_ex;
cl_cvdverify_ex;
cl_scandesc_ex;
cl_scanmap_ex;
cl_scanfile_ex;
libclamav: scan-layer callback API functions Add the following scan callbacks: ```c cl_engine_set_scan_callback(engine, &pre_hash_callback, CL_SCAN_CALLBACK_PRE_HASH); cl_engine_set_scan_callback(engine, &pre_scan_callback, CL_SCAN_CALLBACK_PRE_SCAN); cl_engine_set_scan_callback(engine, &post_scan_callback, CL_SCAN_CALLBACK_POST_SCAN); cl_engine_set_scan_callback(engine, &alert_callback, CL_SCAN_CALLBACK_ALERT); cl_engine_set_scan_callback(engine, &file_type_callback, CL_SCAN_CALLBACK_FILE_TYPE); ``` Each callback may alter scan behavior using the following return codes: * CL_BREAK Scan aborted by callback (the rest of the scan is skipped). This does not mark the file as clean or infected, it just skips the rest of the scan. * CL_SUCCESS / CL_CLEAN File scan will continue. This is different than CL_VERIFIED because it does not affect prior or future alerts. Return CL_VERIFIED instead if you want to remove prior alerts for this layer and skip the rest of the scan for this layer. * CL_VIRUS This means you don't trust the file. A new alert will be added. For CL_SCAN_CALLBACK_ALERT: Means you agree with the alert (no extra alert needed). * CL_VERIFIED Layer explicitly trusted by the callback and previous alerts removed FOR THIS layer. You might want to do this if you trust the hash or verified a digital signature. The rest of the scan will be skipped FOR THIS layer. For contained files, this does NOT mean that the parent or adjacent layers are trusted. Each callback is given a pointer to the current scan layer from which they can get previous layers, can get the the layer's fmap, and then various attributes of the layer and of the fmap such as: - layer recursion level - layer object id - layer file type - layer attributes (was decerypted, normalized, embedded, or re-typed) - layer last alert - fmap name - fmap hash (md5, sha1, or sha2-256) - fmap data (pointer and size) - fmap file descriptor, if any (fd, offset, size) - fmap filepath, if any (filepath, offset, size) To make this possible, this commits introduced a handful of new APIs to query scan-layer details and fmap details: - `cl_error_t cl_fmap_set_name(cl_fmap_t *map, const char *name);` - `cl_error_t cl_fmap_get_name(cl_fmap_t *map, const char **name_out);` - `cl_error_t cl_fmap_set_path(cl_fmap_t *map, const char *path);` - `cl_error_t cl_fmap_get_path(cl_fmap_t *map, const char **path_out, size_t *offset_out, size_t *len_out);` - `cl_error_t cl_fmap_get_fd(const cl_fmap_t *map, int *fd_out, size_t *offset_out, size_t *len_out);` - `cl_error_t cl_fmap_get_size(const cl_fmap_t *map, size_t *size_out);` - `cl_error_t cl_fmap_set_hash(const cl_fmap_t *map, const char *hash_alg, char hash);` - `cl_error_t cl_fmap_have_hash(const cl_fmap_t *map, const char *hash_alg, bool *have_hash_out);` - `cl_error_t cl_fmap_will_need_hash_later(const cl_fmap_t *map, const char *hash_alg);` - `cl_error_t cl_fmap_get_hash(const cl_fmap_t *map, const char *hash_alg, const char **hash_out);` - `cl_error_t cl_fmap_get_data(const cl_fmap_t *map, size_t offset, size_t len, const uint8_t **data_out, size_t *data_len_out);` - `cl_error_t cl_scan_layer_get_fmap(cl_scan_layer_t *layer, cl_fmap_t **fmap_out);` - `cl_error_t cl_scan_layer_get_parent_layer(cl_scan_layer_t *layer, cl_scan_layer_t **parent_layer_out);` - `cl_error_t cl_scan_layer_get_type(cl_scan_layer_t *layer, const char **type_out);` - `cl_error_t cl_scan_layer_get_recursion_level(cl_scan_layer_t *layer, uint32_t *recursion_level_out);` - `cl_error_t cl_scan_layer_get_object_id(cl_scan_layer_t *layer, uint64_t *object_id_out);` - `cl_error_t cl_scan_layer_get_last_alert(cl_scan_layer_t *layer, const char **alert_name_out);` - `cl_error_t cl_scan_layer_get_attributes(cl_scan_layer_t *layer, uint32_t *attributes_out);` This commit deprecates but does not remove the existing scan callbacks: - `void cl_engine_set_clcb_pre_cache(struct cl_engine *engine, clcb_pre_cache callback);` - `void cl_engine_set_clcb_file_inspection(struct cl_engine *engine, clcb_file_inspection callback);` - `void cl_engine_set_clcb_pre_scan(struct cl_engine *engine, clcb_pre_scan callback);` - `void cl_engine_set_clcb_post_scan(struct cl_engine *engine, clcb_post_scan callback);` - `void cl_engine_set_clcb_virus_found(struct cl_engine *engine, clcb_virus_found callback);` - `void cl_engine_set_clcb_hash(struct cl_engine *engine, clcb_hash callback);` This commit also adds an interactive test program to demonstrate the callbacks. See: `examples/ex_scan_callbacks.c` CLAM-255 CLAM-2485 CLAM-2626
2025-06-22 14:37:03 -04:00
cl_fmap_set_name;
cl_fmap_get_name;
cl_fmap_set_path;
cl_fmap_get_path;
cl_fmap_get_fd;
cl_fmap_get_size;
cl_fmap_set_hash;
cl_fmap_have_hash;
cl_fmap_will_need_hash_later;
cl_fmap_get_hash;
cl_fmap_get_data;
cl_scan_layer_get_fmap;
cl_scan_layer_get_parent_layer;
cl_scan_layer_get_type;
cl_scan_layer_get_recursion_level;
cl_scan_layer_get_object_id;
cl_scan_layer_get_last_alert;
cl_scan_layer_get_attributes;
cl_engine_set_scan_callback;
FIPS-compliant CVD signing and verification Add X509 certificate chain based signing with PKCS7-PEM external signatures distributed alongside CVD's in a custom .cvd.sign format. This new signing and verification mechanism is primarily in support of FIPS compliance. Fixes: https://github.com/Cisco-Talos/clamav/issues/564 Add a Rust implementation for parsing, verifying, and unpacking CVD files. Now installs a 'certs' directory in the app config directory (e.g. <prefix>/etc/certs). The install location is configurable. The CMake option to configure the CVD certs directory is: `-D CVD_CERTS_DIRECTORY=PATH` New options to set an alternative CVD certs directory: - Commandline for freshclam, clamd, clamscan, and sigtool is: `--cvdcertsdir PATH` - Env variable for freshclam, clamd, clamscan, and sigtool is: `CVD_CERTS_DIR` - Config option for freshclam and clamd is: `CVDCertsDirectory PATH` Sigtool: - Add sign/verify commands. - Also verify CDIFF external digital signatures when applying CDIFFs. - Place commonly used commands at the top of --help string. - Fix up manpage. Freshclam: - Will try to download .sign files to verify CVDs and CDIFFs. - Fix an issue where making a CLD would only include the CFG file for daily and not if patching any other database. libclamav.so: - Bump version to 13:0:1 (aka 12.1.0). - Also remove libclamav.map versioning. Resolves: https://github.com/Cisco-Talos/clamav/issues/1304 - Add two new API's to the public clamav.h header: ```c extern cl_error_t cl_cvdverify_ex(const char *file, const char *certs_directory); extern cl_error_t cl_cvdunpack_ex(const char *file, const char *dir, bool dont_verify, const char *certs_directory); ``` The original `cl_cvdverify` and `cl_cvdunpack` are deprecated. - Add `cl_engine_field` enum option `CL_ENGINE_CVDCERTSDIR`. You may set this option with `cl_engine_set_str` and get it with `cl_engine_get_str`, to override the compiled in default CVD certs directory. libfreshclam.so: Bump version to 4:0:0 (aka 4.0.0). Add sigtool sign/verify tests and test certs. Make it so downloadFile doesn't throw a warning if the server doesn't have the .sign file. Replace use of md5-based FP signatures in the unit tests with sha256-based FP signatures because the md5 implementation used by Python may be disabled in FIPS mode. Fixes: https://github.com/Cisco-Talos/clamav/issues/1411 CMake: Add logic to enable the Rust openssl-sys / openssl-rs crates to build against the same OpenSSL library as is used for the C build. The Rust unit test application must also link directly with libcrypto and libssl. Fix some log messages with missing new lines. Fix missing environment variable notes in --help messages and manpages. Deconflict CONFDIR/DATADIR/CERTSDIR variable names that are defined in clamav-config.h.in for libclamav from variable that had the same name for use in clamav applications that use the optparser. The 'clamav-test' certs for the unit tests will live for 10 years. The 'clamav-beta.crt' public cert will only live for 120 days and will be replaced before the stable release with a production 'clamav.crt'.
2024-11-21 14:01:09 -05:00
};
CLAMAV_PRIVATE {
global:
cli_sigperf_print;
cli_sigperf_events_destroy;
cli_pcre_perf_print;
cli_pcre_perf_events_destroy;
cli_pcre_build;
cli_pcre_scanbuf;
cli_pcre_recaloff;
cli_pcre_freeoff;
2012-12-05 15:48:52 -08:00
2009-09-24 16:21:51 +02:00
cli_gettmpdir;
cli_strtok;
cli_strtokenize;
cli_ldbtokenize;
cli_strlcat;
cli_strlcpy;
cli_strntoul;
cli_regcomp;
cli_regexec;
cli_regfree;
cli_strrcpy;
cli_strbcasestr;
cli_isnumber;
cli_gentemp;
cli_gentempfd;
cli_rmdirs;
cli_chomp;
cli_rndnum;
cli_ole2_extract;
cli_errmsg;
cli_debug_flag;
cli_vba_readdir;
cli_vba_inflate;
cli_ppt_vba_read;
cli_wm_readdir;
cli_wm_decrypt_macro;
cli_free_vba_project;
cli_readn;
cli_str2hex;
cli_hashfile;
cli_hashstream;
text_normalize_init;
text_normalize_reset;
text_normalize_map;
2009-08-31 06:16:12 +02:00
html_normalise_map;
cli_utf16toascii;
cli_memstr;
cli_safer_strdup;
cli_max_calloc;
cli_max_malloc;
cli_max_realloc;
cli_safer_realloc;
cli_ctime;
tableCreate;
tableDestroy;
tableRemove;
tableFind;
tableIterate;
tableUpdate;
tableInsert;
cli_warnmsg;
cli_strtokbuf;
cli_js_init;
cli_js_process_buffer;
cli_js_parse_done;
cli_js_destroy;
cli_js_output;
cli_unescape;
cli_textbuffer_append_normalize;
cli_dconf_init;
cli_regex2suffix;
html_normalise_mem;
init_regex_list;
is_regex_ok;
regex_list_done;
regex_list_add_pattern;
cli_build_regex_list;
regex_list_match;
cli_hashset_destroy;
phishing_init;
phishing_done;
blobCreate;
blobAddData;
phishingScan;
blobDestroy;
load_regex_matcher;
html_tag_arg_free;
2008-07-28 19:22:15 +00:00
disasmbuf;
uniq_init;
uniq_free;
uniq_add;
uniq_get;
cli_hex2str;
cli_ac_init;
cli_ac_initdata;
cli_ac_buildtrie;
cli_ac_scanbuff;
cli_ac_freedata;
cli_ac_free;
cli_ac_chklsig;
cli_sigopts_handler;
cli_bm_init;
cli_bm_scanbuff;
cli_bm_free;
cli_initroots;
cli_scan_buff;
cli_scan_fmap;
cli_check_auth_header;
cli_genhash_pe;
html_screnc_decode;
mpool_create;
mpool_calloc;
mpool_destroy;
mpool_free;
mpool_getstats;
2009-01-27 10:57:54 +00:00
cli_versig;
cli_versig2;
cli_filecopy;
cli_ftw;
cli_unlink;
cli_writen;
cli_url_canon;
cli_strerror;
cli_ftname;
cli_ftcode;
decodeLine;
messageCreate;
messageDestroy;
base64Flush;
cli_unrar_open;
cli_unrar_peek_file_header;
cli_unrar_extract_file;
cli_unrar_skip_file;
cli_unrar_close;
have_rar;
have_clamjit;
2009-06-26 16:30:46 +03:00
cli_bytecode_load;
cli_bytecode_prepare2;
2009-06-26 16:30:46 +03:00
cli_bytecode_run;
cli_bytecode_destroy;
cli_bytecode_context_alloc;
cli_bytecode_context_destroy;
cli_bytecode_context_setfuncid;
cli_bytecode_context_setparam_int;
cli_bytecode_context_setparam_ptr;
2009-09-08 22:25:33 +03:00
cli_bytecode_context_setfile;
2009-07-08 12:45:06 +03:00
cli_bytecode_context_getresult_int;
cli_bytecode_init;
cli_bytecode_done;
2009-08-27 18:12:39 +03:00
cli_bytecode_debug;
cli_hex2ui;
fmap_new;
cli_bytecode_context_set_trace;
cli_bytecode_debug_printsrc;
2009-12-11 20:43:58 +02:00
cli_bytecode_printversion;
2010-01-22 16:50:16 +02:00
cli_bytecode_describe;
cli_bytetype_describe;
cli_bytevalue_describe;
cli_byteinst_describe;
cli_bytefunc_describe;
cli_printcxxver;
2010-07-29 13:11:52 +03:00
cli_detect_environment;
cli_disasm_one;
2011-06-17 22:20:31 +03:00
cli_utf16_to_utf8;
get_fpu_endian;
2014-02-08 00:31:12 -05:00
cl_initialize_crypto;
cl_cleanup_crypto;
cl_hash_data;
cl_hash_file_fd;
cl_hash_file_fp;
cl_hash_file_fd_ctx;
cl_sha256;
cl_sha1;
cl_verify_signature;
cl_verify_signature_x509_keyfile;
cl_verify_signature_x509;
cl_get_x509_from_mem;
cl_validate_certificate_chain_ts_dir;
cl_validate_certificate_chain;
cl_verify_signature_fd;
cl_verify_signature_fd_x509;
cl_verify_signature_fd_x509_keyfile;
cl_verify_signature_hash;
cl_verify_signature_hash_x509;
cl_verify_signature_hash_x509_keyfile;
cl_load_cert;
cl_ASN1_GetTimeT;
cl_load_crl;
2014-03-11 10:50:59 -04:00
cl_sign_data_keyfile;
2014-02-08 00:31:12 -05:00
cl_sign_data;
cl_sign_file_fd;
cl_sign_file_fp;
cl_get_pkey_file;
cl_base64_decode;
cl_base64_encode;
cli_sanitize_filepath;
cli_gentemp_with_prefix;
CMake: Add CTest support to match Autotools checks An ENABLE_TESTS CMake option is provided so that users can disable testing if they don't want it. Instructions for how to use this included in the INSTALL.cmake.md file. If you run `ctest`, each testcase will write out a log file to the <build>/unit_tests directory. As with Autotools' make check, the test files are from test/.split and unit_tests/.split files, but for CMake these are generated at build time instead of at test time. On Posix systems, sets the LD_LIBRARY_PATH so that ClamAV-compiled libraries can be loaded when running tests. On Windows systems, CTest will identify and collect all library dependencies and assemble a temporarily install under the build/unit_tests directory so that the libraries can be loaded when running tests. The same feature is used on Windows when using CMake to install to collect all DLL dependencies so that users don't have to install them manually afterwards. Each of the CTest tests are run using a custom wrapper around Python's unittest framework, which is also responsible for finding and inserting valgrind into the valgrind tests on Posix systems. Unlike with Autotools, the CMake CTest Valgrind-tests are enabled by default, if Valgrind can be found. There's no need to set VG=1. CTest's memcheck module is NOT supported, because we use Python to orchestrate our tests. Added a bunch of Windows compatibility changes to the unit tests. These were primarily changing / to PATHSEP and making adjustments to use Win32 C headers and ifdef out the POSIX ones which aren't available on Windows. Also disabled a bunch of tests on Win32 that don't work on Windows, notably the mmap ones and FD-passing (i.e. FILEDES) ones. Add JSON_C_HAVE_INTTYPES_H definition to clamav-config.h to eliminate warnings on Windows where json.h is included after inttypes.h because json-c's inttypes replacement relies on it. This is a it of a hack and may be removed if json-c fixes their inttypes header stuff in the future. Add preprocessor definitions on Windows to disable MSVC warnings about CRT secure and nonstandard functions. While there may be a better solution, this is needed to be able to see other more serious warnings. Add missing file comment block and copyright statement for clamsubmit.c. Also change json-c/json.h include filename to json.h in clamsubmit.c. The directory name is not required. Changed the hash table data integer type from long, which is poorly defined, to size_t -- which is capable of storing a pointer. Fixed a bunch of casts regarding this variable to eliminate warnings. Fixed two bugs causing utf8 encoding unit tests to fail on Windows: - The in_size variable should be the number of bytes, not the character count. This was was causing the SHIFT_JIS (japanese codepage) to UTF8 transcoding test to only transcode half the bytes. - It turns out that the MultiByteToWideChar() API can't transcode UTF16-BE to UTF16-LE. The solution is to just iterate over the buffer and flip the bytes on each uint16_t. This but was causing the UTF16-BE to UTF8 tests to fail. I also split up the utf8 transcoding tests into separate tests so I could see all of the failures instead of just the first one. Added a flags parameter to the unit test function to open testfiles because it turns out that on Windows if a file contains the \r\n it will replace it with just \n if you opened the file as a text file instead of as binary. However, if we open the CBC files as binary, then a bunch of bytecode tests fail. So I've changed the tests to open the CBC files in the bytecode tests as text files and open all other files as binary. Ported the feature tests from shell scripts to Python using a modified version of our QA test-framework, which is largely compatible and will allow us to migrate some QA tests into this repo. I'd like to add GitHub Actions pipelines in the future so that all public PR's get some testing before anyone has to manually review them. The clamd --log option was missing from the help string, though it definitely works. I've added it in this commit. It appears that clamd.c was never clang-format'd, so this commit also reformats clamd.c. Some of the check_clamd tests expected the path returned by clamd to match character for character with original path sent to clamd. However, as we now evaluate real paths before a scan, the path returned by clamd isn't going to match the relative (and possibly symlink-ridden) path passed to clamdscan. I fixed this test by changing the test to search for the basename: <signature> FOUND within the response instead of matching the exact path. Autotools: Link check_clamd with libclamav so we can use our utility functions in check_clamd.c.
2020-08-25 23:14:23 -07:00
cli_gentempfd_with_prefix;
cli_basename;
cli_realpath;
cli_codepage_to_utf8;
cli_get_filepath_from_filedesc;
2021-01-23 16:41:41 -08:00
fmap_duplicate;
free_duplicate_fmap;
cli_add_content_match_pattern;
cli_dbgmsg;
cli_dbgmsg_no_inline;
cli_get_debug_flag;
cli_get_last_virus_str;
cli_getdsig;
cli_infomsg_simple;
cli_set_debug_flag;
fmap_dump_to_file;
init_allow_list;
init_domain_list;
lsig_increment_subsig_match;
readdb_parse_ldb_subsignature;
fuzzy_hash_calculate_image;
ffierror_fmt;
cli_magic_scan_buff;
cli_checklimits;
cli_matchmeta;
FIPS-compliant CVD signing and verification Add X509 certificate chain based signing with PKCS7-PEM external signatures distributed alongside CVD's in a custom .cvd.sign format. This new signing and verification mechanism is primarily in support of FIPS compliance. Fixes: https://github.com/Cisco-Talos/clamav/issues/564 Add a Rust implementation for parsing, verifying, and unpacking CVD files. Now installs a 'certs' directory in the app config directory (e.g. <prefix>/etc/certs). The install location is configurable. The CMake option to configure the CVD certs directory is: `-D CVD_CERTS_DIRECTORY=PATH` New options to set an alternative CVD certs directory: - Commandline for freshclam, clamd, clamscan, and sigtool is: `--cvdcertsdir PATH` - Env variable for freshclam, clamd, clamscan, and sigtool is: `CVD_CERTS_DIR` - Config option for freshclam and clamd is: `CVDCertsDirectory PATH` Sigtool: - Add sign/verify commands. - Also verify CDIFF external digital signatures when applying CDIFFs. - Place commonly used commands at the top of --help string. - Fix up manpage. Freshclam: - Will try to download .sign files to verify CVDs and CDIFFs. - Fix an issue where making a CLD would only include the CFG file for daily and not if patching any other database. libclamav.so: - Bump version to 13:0:1 (aka 12.1.0). - Also remove libclamav.map versioning. Resolves: https://github.com/Cisco-Talos/clamav/issues/1304 - Add two new API's to the public clamav.h header: ```c extern cl_error_t cl_cvdverify_ex(const char *file, const char *certs_directory); extern cl_error_t cl_cvdunpack_ex(const char *file, const char *dir, bool dont_verify, const char *certs_directory); ``` The original `cl_cvdverify` and `cl_cvdunpack` are deprecated. - Add `cl_engine_field` enum option `CL_ENGINE_CVDCERTSDIR`. You may set this option with `cl_engine_set_str` and get it with `cl_engine_get_str`, to override the compiled in default CVD certs directory. libfreshclam.so: Bump version to 4:0:0 (aka 4.0.0). Add sigtool sign/verify tests and test certs. Make it so downloadFile doesn't throw a warning if the server doesn't have the .sign file. Replace use of md5-based FP signatures in the unit tests with sha256-based FP signatures because the md5 implementation used by Python may be disabled in FIPS mode. Fixes: https://github.com/Cisco-Talos/clamav/issues/1411 CMake: Add logic to enable the Rust openssl-sys / openssl-rs crates to build against the same OpenSSL library as is used for the C build. The Rust unit test application must also link directly with libcrypto and libssl. Fix some log messages with missing new lines. Fix missing environment variable notes in --help messages and manpages. Deconflict CONFDIR/DATADIR/CERTSDIR variable names that are defined in clamav-config.h.in for libclamav from variable that had the same name for use in clamav applications that use the optparser. The 'clamav-test' certs for the unit tests will live for 10 years. The 'clamav-beta.crt' public cert will only live for 120 days and will be replaced before the stable release with a production 'clamav.crt'.
2024-11-21 14:01:09 -05:00
cli_cvdunpack_and_verify;
FIPS & FIPS-like limits on hash algs for cryptographic uses ClamAV will not function when using a FIPS-enabled OpenSSL 3.x. This is because ClamAV uses MD5 and SHA1 algorithms for a variety of purposes including matching for malware detection, matching to prevent false positives on known-clean files, and for verification of MD5-based RSA digital signatures for determining CVD (signature database archive) authenticity. Interestingly, FIPS had been intentionally bypassed when creating hashes based whole buffers and whole files (by descriptor or `FILE`-pointer): https://github.com/Cisco-Talos/clamav/commit/78d4a9985a06a418dd1338c94ee5db461035d75b Note: this bypassed FIPS the 1.x way with: `EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);` It was NOT disabled when using `cl_hash_init()` / `cl_update_hash()` / `cl_finish_hash()`. That likely worked by coincidence in that the hash was already calculated most of the time. It certainly would have made use of those functions if the hash had not been calculated prior: https://github.com/Cisco-Talos/clamav/blob/78d4a9985a06a418dd1338c94ee5db461035d75b/libclamav/matcher.c#L743 Regardless, bypassing FIPS entirely is not the correct solution. The FIPS restrictions against using MD5 and SHA1 are valid, particularly when verifying CVD digital siganatures, but also I think when using a hash to determine if the file is known-clean (i.e. the "clean cache" and also MD5-based and SHA1-based FP signatures). This commit extends the work to bypass FIPS using the newer 3.x method: `md = EVP_MD_fetch(NULL, alg, "-fips");` It does this for the legacy `cl_hash*()` functions including `cl_hash_init()` / `cl_update_hash()` / `cl_finish_hash()`. It also introduces extended versions that allow the caller to choose if they want to bypass FIPS: - `cl_hash_data_ex()` - `cl_hash_init_ex()` - `cl_update_hash_ex()` - `cl_finish_hash_ex()` - `cl_hash_destroy_ex()` - `cl_hash_file_fd_ex()` See the `flags` parameter for each. Ironically, this commit does NOT use the new functions at this time. The rational is that ClamAV may need MD5, SHA1, and SHA-256 hashes of the same files both for determining if the file is malware, and for determining if the file is clean. So instead, this commit will do a checks when: 1. Creating a new ClamAV scanning engine. If FIPS-mode enabled, it will automatically toggle the "FIPS limits" engine option. When loading signatures, if the engine "FIPS limits" option is enabled, then MD5 and SHA1 FP signatures will be skipped. 2. Before verifying a CVD (e.g. also for loading, unpacking when verification enabled). If "FIPS limits" or FIPS-mode are enabled, then the legacy MD5-based RSA method is disabled. Note: This commit also refactors the interface for `cl_cvdverify_ex()` and `cl_cvdunpack_ex()` so they take a `flags` parameters, rather than a single `bool`. As these functions are new in this version, it does not break the ABI. The cache was already switched to use SHA2-256, so that's not a concern for checking FIPS-mode / FIPS limits options. This adds an option for `freshclam.conf` and `clamd.conf`: FIPSCryptoHashLimits yes And an equivalent command-line option for `clamscan` and `sigtool`: --fips-limits You may programmatically enable FIPS-limits for a ClamAV engine like this: ```C cl_engine_set_num(engine, CL_ENGINE_FIPS_LIMITS, 1); ``` CLAM-2792
2025-07-01 20:41:47 -04:00
cli_cvdverify;
__cli_strcasestr;
__cli_strndup;
__cli_strnlen;
__cli_strnstr;
local:
*;
};