Change the default from /dev/urandom to /dev/random

Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
Gilles Peskine
2026-02-27 20:37:28 +01:00
parent 409baa7b7b
commit 6f63121a00
3 changed files with 11 additions and 4 deletions
+7
View File
@@ -2,3 +2,10 @@ Features
* The device for reading entropy on platforms without a dedicated system
call can now be configured with MBEDTLS_PLATFORM_DEV_RANDOM or
mbedtls_platform_dev_random.
Security
* The default device for reading entropy on platforms without a dedicated
system call is now /dev/random instead of /dev/urandom. This is safer
on Linux in case the application runs early after the kernel boots,
but may block needlessly on Linux <= 5.6. Reported by supers1ngular
(BayLibre).
+3 -3
View File
@@ -4176,14 +4176,14 @@
* if it is used early after the kernel boots, especially on embedded
* devices without an interactive user.
*
* Thus you should change the value to `/dev/random` if your application
* Thus you should change the value to `/dev/urandom` if your application
* may be used on a device running Linux without a dedicated hardware
* entropy source early after boot.
* entropy source, and doesn't run early during or after boot.
*
* This is the default value of ::mbedtls_platform_dev_random, which
* can be changed at run time.
*/
//#define MBEDTLS_PLATFORM_DEV_RANDOM "/dev/urandom"
//#define MBEDTLS_PLATFORM_DEV_RANDOM "/dev/random"
/** \def MBEDTLS_CHECK_RETURN
*
+1 -1
View File
@@ -395,7 +395,7 @@ int mbedtls_platform_set_exit(void (*exit_func)(int status));
#endif
#if !defined(MBEDTLS_PLATFORM_DEV_RANDOM)
#define MBEDTLS_PLATFORM_DEV_RANDOM "/dev/urandom"
#define MBEDTLS_PLATFORM_DEV_RANDOM "/dev/random"
#endif
#if defined(MBEDTLS_PLATFORM_HAVE_DEV_RANDOM)