This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit f8166a6341919109cd17ba388b1798beac1e1e03
Author: makejian <[email protected]>
AuthorDate: Tue Nov 10 17:56:37 2026 +0800

    crypto/mbedtls: use O_NONBLOCK for /dev/random in the entropy source
    
    The random numbers can be generated on another core and reach the
    application core through an rpmsg character device. Such a device needs
    to be opened without O_NONBLOCK, otherwise the open may block forever
    when the remote entropy service is not up yet; reads still return as
    soon as data is available.
    
    Signed-off-by: makejian <[email protected]>
---
 crypto/mbedtls/source/entropy_alt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/mbedtls/source/entropy_alt.c 
b/crypto/mbedtls/source/entropy_alt.c
index 08323e76c..365688242 100644
--- a/crypto/mbedtls/source/entropy_alt.c
+++ b/crypto/mbedtls/source/entropy_alt.c
@@ -44,7 +44,7 @@ int mbedtls_hardware_poll(FAR void *data,
   size_t read_len;
   *olen = 0;
 
-  fd = open("/dev/random", O_RDONLY, 0);
+  fd = open("/dev/random", O_RDONLY | O_NONBLOCK, 0);
   if (fd < 0)
     {
       return -errno;

Reply via email to