From: "cron2 (Code Review)" Date: Mon, 16 Feb 2026 15:26:56 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., max@...2606... Message-ID: <793253adc802915b75e69966be605cae24117233-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="+xFVfR3MlNw="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Mbed TLS 3: Remove prediction resistance option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: MaxF Cc: flichtenheld , plaisthos , openvpn-devel --+xFVfR3MlNw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/15= 30?usp=3Demail ) Change subject: Mbed TLS 3: Remove prediction resistance option ...................................................................... Mbed TLS 3: Remove prediction resistance option The option --use-prediction-resistance causes the random number generator to be reseeded for every call. This is excessive. This commit removes that option. Github: closes OpenVPN/openvpn#964 Change-Id: I6298795f140c2c62252638f9e0cd6df19cb3d7ed Signed-off-by: Max Fillinger Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1530 Message-Id: <20260216151033.16585-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 658.html Signed-off-by: Gert Doering --- M doc/man-sections/generic-options.rst M doc/man-sections/unsupported-options.rst M src/openvpn/crypto_mbedtls_legacy.c M src/openvpn/crypto_mbedtls_legacy.h M src/openvpn/init.c M src/openvpn/options.c M src/openvpn/options.h M src/openvpn/syshead.h 8 files changed, 5 insertions(+), 69 deletions(-) diff --git a/doc/man-sections/generic-options.rst b/doc/man-sections/generi= c-options.rst index ed581b1..f46dfec 100644 --- a/doc/man-sections/generic-options.rst +++ b/doc/man-sections/generic-options.rst @@ -462,16 +462,6 @@ success/failure via :code:`auth_control_file` when using deferred auth method and pending authentication via :code:`auth_pending_file`. ---use-prediction-resistance - Enable prediction resistance on mbed TLS's RNG. - - Enabling prediction resistance causes the RNG to reseed in each call for - random. Reseeding this often can quickly deplete the kernel entropy - pool. - - If you need this option, please consider running a daemon that adds - entropy to the kernel pool. - --user user Change the user ID of the OpenVPN process to ``user`` after initialization, dropping privileges in the process. This option is diff --git a/doc/man-sections/unsupported-options.rst b/doc/man-sections/un= supported-options.rst index f1332f3..c273905 100644 --- a/doc/man-sections/unsupported-options.rst +++ b/doc/man-sections/unsupported-options.rst @@ -65,3 +65,8 @@ Removed in OpenVPN 2.7. OpenVPN will always use ovpn-dco as the default driver on Windows. It will fall back to tap-windows6 if options are used that are incompatible with ovpn-dco. + +--use-prediction-resistance + Removed in OpenVPN 2.8. This option caused the Mbed TLS 3 random number + generator to be reseeded on every call. It has been removed because this + is excessive. diff --git a/src/openvpn/crypto_mbedtls_legacy.c b/src/openvpn/crypto_mbedt= ls_legacy.c index a991349..b8e7d6a 100644 --- a/src/openvpn/crypto_mbedtls_legacy.c +++ b/src/openvpn/crypto_mbedtls_legacy.c @@ -366,16 +366,6 @@ return &cd_ctx; } -#ifdef ENABLE_PREDICTION_RESISTANCE -void -rand_ctx_enable_prediction_resistance(void) -{ - mbedtls_ctr_drbg_context *cd_ctx =3D rand_ctx_get(); - - mbedtls_ctr_drbg_set_prediction_resistance(cd_ctx, 1); -} -#endif /* ENABLE_PREDICTION_RESISTANCE */ - int rand_bytes(uint8_t *output, int len) { diff --git a/src/openvpn/crypto_mbedtls_legacy.h b/src/openvpn/crypto_mbedt= ls_legacy.h index af71037..1005057 100644 --- a/src/openvpn/crypto_mbedtls_legacy.h +++ b/src/openvpn/crypto_mbedtls_legacy.h @@ -89,14 +89,6 @@ */ mbedtls_ctr_drbg_context *rand_ctx_get(void); -#ifdef ENABLE_PREDICTION_RESISTANCE -/** - * Enable prediction resistance on the random number generator. - */ -void rand_ctx_enable_prediction_resistance(void); - -#endif - /** * Log the supplied mbed TLS error, prefixed by supplied prefix. * diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 70c0b5d..1391aa85 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2989,13 +2989,6 @@ packet_id_persist_load(&c->c1.pid_persist, c->options.packet_i= d_file); } } - -#ifdef ENABLE_PREDICTION_RESISTANCE - if (c->options.use_prediction_resistance) - { - rand_ctx_enable_prediction_resistance(); - } -#endif } diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 09a5d48..cdb02e9 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -565,10 +565,6 @@ " using file.\n" "--test-crypto : Run a self-test of crypto features enabled.\n" " For debugging only.\n" -#ifdef ENABLE_PREDICTION_RESISTANCE - "--use-prediction-resistance: Enable prediction resistance on the rand= om\n" - " number generator.\n" -#endif "\n" "TLS Key Negotiation Options:\n" "(These options are meaningful only for TLS-mode)\n" @@ -871,9 +867,6 @@ o->replay_window =3D DEFAULT_SEQ_BACKTRACK; o->replay_time =3D DEFAULT_TIME_BACKTRACK; o->key_direction =3D KEY_DIRECTION_BIDIRECTIONAL; -#ifdef ENABLE_PREDICTION_RESISTANCE - o->use_prediction_resistance =3D false; -#endif o->tls_timeout =3D 2; o->renegotiate_bytes =3D -1; o->renegotiate_seconds =3D 3600; @@ -1840,9 +1833,6 @@ SHOW_INT(replay_time); SHOW_STR(packet_id_file); SHOW_BOOL(test_crypto); -#ifdef ENABLE_PREDICTION_RESISTANCE - SHOW_BOOL(use_prediction_resistance); -#endif SHOW_BOOL(tls_server); SHOW_BOOL(tls_client); @@ -4475,13 +4465,6 @@ { buf_printf(&out, ",secret"); } - -#ifdef ENABLE_PREDICTION_RESISTANCE - if (o->use_prediction_resistance) - { - buf_printf(&out, ",use-prediction-resistance"); - } -#endif } /* @@ -8542,13 +8525,6 @@ options->providers.names[j] =3D p[j]; } } -#ifdef ENABLE_PREDICTION_RESISTANCE - else if (streq(p[0], "use-prediction-resistance") && !p[1]) - { - VERIFY_PERMISSION(OPT_P_GENERAL); - options->use_prediction_resistance =3D true; - } -#endif else if (streq(p[0], "show-tls") && !p[1]) { VERIFY_PERMISSION(OPT_P_GENERAL); diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 16cfdb5..cf9936b 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -584,9 +584,6 @@ int replay_time; const char *packet_id_file; bool test_crypto; -#ifdef ENABLE_PREDICTION_RESISTANCE - bool use_prediction_resistance; -#endif /* TLS (control channel) parms */ bool tls_server; diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index 067ee9d..1d6cdc2 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -474,13 +474,6 @@ #define PORT_SHARE 0 #endif -#ifdef ENABLE_CRYPTO_MBEDTLS -#include -#if MBEDTLS_VERSION_NUMBER < 0x04000000 -#define ENABLE_PREDICTION_RESISTANCE -#endif /* MBEDTLS_VERSION_NUMBER < 0x04000000 */ -#endif /* ENABLE_CRYPTO_MBEDTLS */ - /* * Do we support Unix domain sockets? */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1530?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6298795f140c2c62252638f9e0cd6df19cb3d7ed Gerrit-Change-Number: 1530 Gerrit-PatchSet: 3 Gerrit-Owner: MaxF Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --+xFVfR3MlNw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

Mbed TLS 3: Remove prediction resistance option<=
br>
The option --use-prediction-resistance causes the random number
g= enerator to be reseeded for every call. This is excessive.

This comm= it removes that option.

Github: closes OpenVPN/openvpn#964

Ch= ange-Id: I6298795f140c2c62252638f9e0cd6df19cb3d7ed
Signed-off-by: Max Fi= llinger <maximilian.fillinger@...2918...>
Acked-by: Frank Lichtenh= eld <frank@...2641...>
Gerrit URL: https://gerrit.openvpn.net/c/op= envpn/+/1530
Message-Id: <20260216151033.16585-1-gert@...1296...><= br>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/ms= g35658.html
Signed-off-by: Gert Doering <gert@...1296...>
---M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-= options.rst
M src/openvpn/crypto_mbedtls_legacy.c
M src/openvpn/crypt= o_mbedtls_legacy.h
M src/openvpn/init.c
M src/openvpn/options.c
M = src/openvpn/options.h
M src/openvpn/syshead.h
8 files changed, 5 inse= rtions(+), 69 deletions(-)

diff --git a/doc/man-sections/generic-options.rst b/doc/man-sections/gen=
eric-options.rst
index ed581b1..f46dfec 100644
--- a/doc/man-sections/generic-options.rst
+++ b/doc/ma= n-sections/generic-options.rst
@@ -462,16 +462,6 @@<= br> success/failure via :code:`auth_control_file` when using defe= rred auth
method and pending authentication via :code:= `auth_pending_file`.

---use-prediction-re= sistance
- Enable pred= iction resistance on mbed TLS's RNG.
-
- = Enabling prediction resistance causes the RNG to reseed in each call for

- random. Reseeding this= often can quickly deplete the kernel entropy
- pool.
-
- If you ne= ed this option, please consider running a daemon that adds
- entropy to the kernel pool.-
--user user<= /span>
Change the user ID of the OpenVPN process to ``user`` af= ter
initialization, dropping privileges in the process. = This option is
diff --git a/doc/man-sections/unsupported-op= tions.rst b/doc/man-sections/unsupported-options.rst
index = f1332f3..c273905 100644
--- a/doc/man-sections/unsupported-= options.rst
+++ b/doc/man-sections/unsupported-options.rst<= /span>
@@ -65,3 +65,8 @@
Removed in OpenVPN 2.7= . OpenVPN will always use ovpn-dco as the default
driver= on Windows. It will fall back to tap-windows6 if options are used that are incompatible with ovpn-dco.
+
+--use-prediction-resistance
+ Removed in OpenVPN 2.8. This option caused the Mbed TLS = 3 random number
+ ge= nerator to be reseeded on every call. It has been removed because this
+ is excessive.diff --git a/src/openvpn/crypto_mbedtls_legacy.c b/src/openvpn/cryp= to_mbedtls_legacy.c
index a991349..b8e7d6a 100644--- a/src/openvpn/crypto_mbedtls_legacy.c
+++ b/src/= openvpn/crypto_mbedtls_legacy.c
@@ -366,16 +366,6 @@=
return &cd_ctx;
}

-#ifdef ENABLE_PREDICTION_= RESISTANCE
-void=
-rand_ctx_enable_prediction_r= esistance(void)
-{
- mbedtls_ctr_drbg_conte= xt *cd_ctx =3D rand_ctx_get();
-
- mbedtls_= ctr_drbg_set_prediction_resistance(cd_ctx, 1);
-}
-#endif /* ENABLE_PREDICTION_RESISTANCE */
-
int
rand_bytes(= uint8_t *output, int len)
{
diff --git a/s= rc/openvpn/crypto_mbedtls_legacy.h b/src/openvpn/crypto_mbedtls_legacy.h
index af71037..1005057 100644
--- a/src/openv= pn/crypto_mbedtls_legacy.h
+++ b/src/openvpn/crypto_mbedtls= _legacy.h
@@ -89,14 +89,6 @@
*/ mbedtls_ctr_drbg_context *rand_ctx_get(void);

-#ifdef ENABLE_PREDICTION_= RESISTANCE
-/**<= br>- * Enable prediction resistan= ce on the random number generator.
- */
-void = rand_ctx_enable_prediction_resistance(void);
-
-#endif
-
/**

* Log the supplied mbed TLS error, prefixed by s= upplied prefix.
*
diff --git a/src/openvp= n/init.c b/src/openvpn/init.c
index 70c0b5d..1391aa85 10064= 4
--- a/src/openvpn/init.c
+++ b/src/openvp= n/init.c
@@ -2989,13 +2989,6 @@
= packet_id_persist_load(&c->c1.pid_persist, c->options.packet_id= _file);
}
}
-
-#ifdef ENABLE_PREDICTION_RESISTANCE
- if (c->options.use_prediction_resistanc= e)
- {
- rand_ctx_enable_prediction_= resistance();

- }
-#endif
= }


diff --git a/src/open= vpn/options.c b/src/openvpn/options.c
index 09a5d48..cdb02e= 9 100644
--- a/src/openvpn/options.c
+++ b/= src/openvpn/options.c
@@ -565,10 +565,6 @@
= " using file.\n"
"= ;--test-crypto : Run a self-test of crypto features enabled.\n"
" For debugging only.\n"=
-#ifdef ENABLE_PREDICTION_RES= ISTANCE
- "--us= e-prediction-resistance: Enable prediction resistance on the random\n"=
- " = number generator.\n"
-#endif
"\n"
= "TLS Key Negotiation Options:\n"
= "(These options are meaningful only for TLS-mode)\n"
@@ -871,9 +867,6 @@

o->replay_window =3D DEFAUL= T_SEQ_BACKTRACK;
o->replay_time =3D DEFAULT_TIME_BA= CKTRACK;
o->key_direction =3D KEY_DIRECTION_BIDIREC= TIONAL;
-#ifdef ENABLE_= PREDICTION_RESISTANCE
-= o->use_prediction_resistance =3D false;
-#endif
o->tls_timeout =3D = 2;
o->renegotiate_bytes =3D -1;
= o->renegotiate_seconds =3D 3600;
@@ -1840,9 +1833,6 @@=
SHOW_INT(replay_time);
SHOW_STR(= packet_id_file);
SHOW_BOOL(test_crypto);
-#ifdef ENABLE_PREDICTION_RESISTANCE=

- SHOW_BOOL(use_pre= diction_resistance);
-#= endif

SHOW_BOOL(tls_server);<= br> SHOW_BOOL(tls_client);
@@ -4475,13 +4465,6 @@=
{
buf_printf(&ou= t, ",secret");
}
-
-#ifdef ENABLE_PREDICTION_RESISTANCE
- if (o->use_prediction_resistance)
- {
- buf_printf(&out, "= ,use-prediction-resistance");
- }
= -#endif
}

/*
@@ -8542,13 +8525,6 @@
options-&= gt;providers.names[j] =3D p[j];
}
= }
-#ifdef ENABLE_P= REDICTION_RESISTANCE
- = else if (streq(p[0], "use-prediction-resistance") && != p[1])
- {
= - VERIFY_PERMISSION(OPT_P_= GENERAL);
- opti= ons->use_prediction_resistance =3D true;
- }
-#endif
else if (streq(p[0], "show-tls"= ) && !p[1])
{
VERIFY_= PERMISSION(OPT_P_GENERAL);
diff --git a/src/openvpn/options= .h b/src/openvpn/options.h
index 16cfdb5..cf9936b 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn= /options.h
@@ -584,9 +584,6 @@
int rep= lay_time;
const char *packet_id_file;
= bool test_crypto;
= -#ifdef ENABLE_PREDICTION_RESISTANCE
- bool use_prediction_resistance;
-#endif

= /* TLS (control channel) parms */
bool tls_server;
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index 067ee9d..1d6cdc2 100644
--- a/src/openvp= n/syshead.h
+++ b/src/openvpn/syshead.h
@@ = -474,13 +474,6 @@
#define PORT_SHARE 0
#e= ndif

= -#ifdef ENABLE_CRYPTO_MBEDTLS
-#include <mbedtls/version.h>
-#if MBEDTLS_VERSION_NUMBER < 0x04000000
<= span style=3D"color: hsl(0, 100%, 40%);">-#define ENABLE_PREDICTION_RESISTA= NCE

-#endif /* MBEDTLS_= VERSION_NUMBER < 0x04000000 */
-#endif /* ENABLE_CRYPTO_MBEDTLS */
-
/*
* Do we sup= port Unix domain sockets?
*/

<= /pre>

To view, visit change 1530. To unsubscribe, or for help writing mail fi= lters, visit set= tings.

=
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6298795f140c2c62252638f9e0c= d6df19cb3d7ed
Gerrit-Change-Number: 1530
Gerrit-PatchSet: 3
Gerrit-Owner: MaxF <max@...2606...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --+xFVfR3MlNw=--