]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix unit tests when run under fuzz builds
authorNeil Horman <nhorman@openssl.org>
Wed, 18 Feb 2026 19:35:22 +0000 (14:35 -0500)
committerNorbert Pocs <norbertp@openssl.org>
Thu, 19 Feb 2026 08:49:54 +0000 (09:49 +0100)
commit619a0fe71825e1f9c4fb7d3a67f8b6a227386e36
tree5048e55bb93be13da86b5a39cb0069e47f6af07a
parent9102fb8fa5e99980c2828132228738fdb482eace
Fix unit tests when run under fuzz builds

PR https://github.com/openssl/openssl/pull/30045

Fixed an oss-fuzz failure that occured because we feed random data into
the pkcs12 kdf, which sometimes results in a huge iteration count, that
leads to timeouts in oss-fuzz.

The fix was to simply limit the number of iterations that we go through
during derivation.  This breaks the kdf of course, but it doesn't really
matter during fuzzing, because we don't expect random input data to
produce reasonable results, so no harm, no foul.

except.

We also, in our CI, build our fuzzer tests and run them through our
regular CI unit tests, during which we both provide valid data, and
expect valid results, and pr 30045 breaks that expectation.

The conventional wisdom is to simply skip unit tests that break under
these sorts of conditions (we do this for things like
70-test_quic_record.t already).

however, the tests that broke here are 25_test_x509, 30_test_evp,
80_test_pkcs12, and 90_test_store_cases.  It seems like we would want to
keep testing those unless we absolutely have to skip them.

So instead, lets indicate that we are running the unit tests with an
environment variable, and check that variable when we have an
UNSAFE_FOR_PRODUCTION build, skiping the iteration clamp in pkcs12kdf if
it is.  This allows us to continue running these unit tests, while still
getting the oss-fuzz runs to pass.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Feb 19 08:49:56 2026
(Merged from https://github.com/openssl/openssl/pull/30070)
doc/man7/openssl-env.pod
providers/implementations/kdfs/pkcs12kdf.c
util/wrap.pl.in