Hugal31 / yara-rust

Rust bindings for VirusTotal/Yara
Apache License 2.0
76 stars 29 forks source link

OpenSSL will always be included, even if `module-hash` is not enabled #128

Open nbigaouette opened 1 year ago

nbigaouette commented 1 year ago

The module-hash cargo feature controls if the hash module in yara is compiled or not. That module exposes hashing functionality through OpenSSL.

For a project I do not need hashing functionality and I don't want to include OpenSSL, so I disable the yara-rusts module-hash cargo feature, but then building yara fails with the error:

error: could not find native static library `ssl`, perhaps an -L flag is missing?

After investigation, it seems that we need to also set the environment variable YARA_CRYPTO_LIB=disable so that yara-sys doesn't include it.

Could it be possible to automatically set YARA_CRYPTO_LIB=disable when the module-hash cargo feature is not enabled? That would require a build.rs for yara-rust with that logic.

ikrivosheev commented 1 year ago

@nbigaouette hello! Not only module-hash requires OpenSSL. For example some part of pe module also required OpenSSL.