Skip to content

Commit 880bd69

Browse files
Max Fillingercron2
authored andcommitted
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 #964 Change-Id: I6298795f140c2c62252638f9e0cd6df19cb3d7ed Signed-off-by: Max Fillinger <maximilian.fillinger@sentyron.com> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1530 Message-Id: <20260216151033.16585-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35658.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 70ab934 commit 880bd69

File tree

8 files changed

+5
-69
lines changed

8 files changed

+5
-69
lines changed

doc/man-sections/generic-options.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,6 @@ which mode OpenVPN is configured as.
462462
success/failure via :code:`auth_control_file` when using deferred auth
463463
method and pending authentication via :code:`auth_pending_file`.
464464

465-
--use-prediction-resistance
466-
Enable prediction resistance on mbed TLS's RNG.
467-
468-
Enabling prediction resistance causes the RNG to reseed in each call for
469-
random. Reseeding this often can quickly deplete the kernel entropy
470-
pool.
471-
472-
If you need this option, please consider running a daemon that adds
473-
entropy to the kernel pool.
474-
475465
--user user
476466
Change the user ID of the OpenVPN process to ``user`` after
477467
initialization, dropping privileges in the process. This option is

doc/man-sections/unsupported-options.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,8 @@ longer supported
6565
Removed in OpenVPN 2.7. OpenVPN will always use ovpn-dco as the default
6666
driver on Windows. It will fall back to tap-windows6 if options are used
6767
that are incompatible with ovpn-dco.
68+
69+
--use-prediction-resistance
70+
Removed in OpenVPN 2.8. This option caused the Mbed TLS 3 random number
71+
generator to be reseeded on every call. It has been removed because this
72+
is excessive.

src/openvpn/crypto_mbedtls_legacy.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -366,16 +366,6 @@ rand_ctx_get(void)
366366
return &cd_ctx;
367367
}
368368

369-
#ifdef ENABLE_PREDICTION_RESISTANCE
370-
void
371-
rand_ctx_enable_prediction_resistance(void)
372-
{
373-
mbedtls_ctr_drbg_context *cd_ctx = rand_ctx_get();
374-
375-
mbedtls_ctr_drbg_set_prediction_resistance(cd_ctx, 1);
376-
}
377-
#endif /* ENABLE_PREDICTION_RESISTANCE */
378-
379369
int
380370
rand_bytes(uint8_t *output, int len)
381371
{

src/openvpn/crypto_mbedtls_legacy.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ typedef mbedtls_operation_t crypto_operation_t;
8989
*/
9090
mbedtls_ctr_drbg_context *rand_ctx_get(void);
9191

92-
#ifdef ENABLE_PREDICTION_RESISTANCE
93-
/**
94-
* Enable prediction resistance on the random number generator.
95-
*/
96-
void rand_ctx_enable_prediction_resistance(void);
97-
98-
#endif
99-
10092
/**
10193
* Log the supplied mbed TLS error, prefixed by supplied prefix.
10294
*

src/openvpn/init.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,13 +2989,6 @@ init_crypto_pre(struct context *c, const unsigned int flags)
29892989
packet_id_persist_load(&c->c1.pid_persist, c->options.packet_id_file);
29902990
}
29912991
}
2992-
2993-
#ifdef ENABLE_PREDICTION_RESISTANCE
2994-
if (c->options.use_prediction_resistance)
2995-
{
2996-
rand_ctx_enable_prediction_resistance();
2997-
}
2998-
#endif
29992992
}
30002993

30012994

src/openvpn/options.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,6 @@ static const char usage_message[] =
565565
" using file.\n"
566566
"--test-crypto : Run a self-test of crypto features enabled.\n"
567567
" For debugging only.\n"
568-
#ifdef ENABLE_PREDICTION_RESISTANCE
569-
"--use-prediction-resistance: Enable prediction resistance on the random\n"
570-
" number generator.\n"
571-
#endif
572568
"\n"
573569
"TLS Key Negotiation Options:\n"
574570
"(These options are meaningful only for TLS-mode)\n"
@@ -871,9 +867,6 @@ init_options(struct options *o, const bool init_gc)
871867
o->replay_window = DEFAULT_SEQ_BACKTRACK;
872868
o->replay_time = DEFAULT_TIME_BACKTRACK;
873869
o->key_direction = KEY_DIRECTION_BIDIRECTIONAL;
874-
#ifdef ENABLE_PREDICTION_RESISTANCE
875-
o->use_prediction_resistance = false;
876-
#endif
877870
o->tls_timeout = 2;
878871
o->renegotiate_bytes = -1;
879872
o->renegotiate_seconds = 3600;
@@ -1840,9 +1833,6 @@ show_settings(const struct options *o)
18401833
SHOW_INT(replay_time);
18411834
SHOW_STR(packet_id_file);
18421835
SHOW_BOOL(test_crypto);
1843-
#ifdef ENABLE_PREDICTION_RESISTANCE
1844-
SHOW_BOOL(use_prediction_resistance);
1845-
#endif
18461836

18471837
SHOW_BOOL(tls_server);
18481838
SHOW_BOOL(tls_client);
@@ -4475,13 +4465,6 @@ options_string(const struct options *o, const struct frame *frame, struct tuntap
44754465
{
44764466
buf_printf(&out, ",secret");
44774467
}
4478-
4479-
#ifdef ENABLE_PREDICTION_RESISTANCE
4480-
if (o->use_prediction_resistance)
4481-
{
4482-
buf_printf(&out, ",use-prediction-resistance");
4483-
}
4484-
#endif
44854468
}
44864469

44874470
/*
@@ -8542,13 +8525,6 @@ add_option(struct options *options, char *p[], bool is_inline, const char *file,
85428525
options->providers.names[j] = p[j];
85438526
}
85448527
}
8545-
#ifdef ENABLE_PREDICTION_RESISTANCE
8546-
else if (streq(p[0], "use-prediction-resistance") && !p[1])
8547-
{
8548-
VERIFY_PERMISSION(OPT_P_GENERAL);
8549-
options->use_prediction_resistance = true;
8550-
}
8551-
#endif
85528528
else if (streq(p[0], "show-tls") && !p[1])
85538529
{
85548530
VERIFY_PERMISSION(OPT_P_GENERAL);

src/openvpn/options.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,6 @@ struct options
584584
int replay_time;
585585
const char *packet_id_file;
586586
bool test_crypto;
587-
#ifdef ENABLE_PREDICTION_RESISTANCE
588-
bool use_prediction_resistance;
589-
#endif
590587

591588
/* TLS (control channel) parms */
592589
bool tls_server;

src/openvpn/syshead.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,6 @@ socket_defined(const socket_descriptor_t sd)
474474
#define PORT_SHARE 0
475475
#endif
476476

477-
#ifdef ENABLE_CRYPTO_MBEDTLS
478-
#include <mbedtls/version.h>
479-
#if MBEDTLS_VERSION_NUMBER < 0x04000000
480-
#define ENABLE_PREDICTION_RESISTANCE
481-
#endif /* MBEDTLS_VERSION_NUMBER < 0x04000000 */
482-
#endif /* ENABLE_CRYPTO_MBEDTLS */
483-
484477
/*
485478
* Do we support Unix domain sockets?
486479
*/

0 commit comments

Comments
 (0)