Commit 7c9f789fc1 for openssl.org
commit 7c9f789fc1d6a95e0f2f6571260fea2c31e9013d
Author: Mrmaxmeier <Mrmaxmeier@gmail.com>
Date: Wed Oct 14 09:37:08 2026 +0200
fuzz: assert invariants in bignum fuzzers and fix with no-stdio
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Mon Oct 19 11:24:07 2026
Merged-from: https://github.com/openssl/openssl/pull/33160
diff --git a/fuzz/bignum.c b/fuzz/bignum.c
index 990efff930..15fb728e0a 100644
--- a/fuzz/bignum.c
+++ b/fuzz/bignum.c
@@ -83,6 +83,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
if (!BN_mod_exp_simple(b5, b1, b2, b3, ctx))
goto done;
+#ifndef OPENSSL_NO_STDIO
if (BN_cmp(b4, b5) != 0) {
BN_print_fp(stdout, b1);
putchar('\n');
@@ -95,6 +96,8 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
BN_print_fp(stdout, b5);
putchar('\n');
}
+#endif
+ OPENSSL_assert(BN_cmp(b4, b5) == 0);
done:
BN_free(b1);
diff --git a/fuzz/bndiv.c b/fuzz/bndiv.c
index 4a6732a775..f848c97747 100644
--- a/fuzz/bndiv.c
+++ b/fuzz/bndiv.c
@@ -109,6 +109,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
goto done;
success = success && BN_cmp(b5, b1) == 0;
+#ifndef OPENSSL_NO_STDIO
if (!success) {
BN_print_fp(stdout, b1);
putchar('\n');
@@ -128,6 +129,8 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
BN_cmp(b5, b1));
puts("----\n");
}
+#endif
+ OPENSSL_assert(success);
done:
ERR_clear_error();