aboutsummaryrefslogtreecommitdiff
path: root/providers/implementations/kdfs/pkcs12kdf.c
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2026-04-07 22:35:35 +0000
committerEnji Cooper <ngie@FreeBSD.org>2026-04-07 22:35:35 +0000
commitab5fc4ac933ff67bc800e774dffce15e2a541e90 (patch)
tree41fac85d3f2f7d74be9bfce46b1a78ff9897165d /providers/implementations/kdfs/pkcs12kdf.c
parent808413da28df9fb93e1f304e6016b15e660f54c8 (diff)
Diffstat (limited to 'providers/implementations/kdfs/pkcs12kdf.c')
-rw-r--r--providers/implementations/kdfs/pkcs12kdf.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/providers/implementations/kdfs/pkcs12kdf.c b/providers/implementations/kdfs/pkcs12kdf.c
index fa4b808f4e11..397cd50ec6a8 100644
--- a/providers/implementations/kdfs/pkcs12kdf.c
+++ b/providers/implementations/kdfs/pkcs12kdf.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -266,6 +266,15 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[])
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_ITER)) != NULL)
if (!OSSL_PARAM_get_uint64(p, &ctx->iter))
return 0;
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+ /*
+ * If we're running the fuzzer, limit iteration count to
+ * 100 so we don't time out running the derivation for
+ * a really long time
+ */
+ if (getenv("OPENSSL_RUNNING_UNIT_TESTS") == NULL && p != NULL && ctx->iter > 100)
+ ctx->iter = 100;
+#endif
return 1;
}