Skip to content

Allow Bionic or other libc to use getrandom() syscall #745

@TaraHoleInIt

Description

@TaraHoleInIt

Suggested enhancement

Currently, it looks like getrandom() is only supported if you're using glibc or (minipix?).
Could this maybe be expanded to Bionic and or other C libraries?

I'm not really sure what the best way to handle this would be, or even if maybe I'm the only one who has or will experience this one issue.

Justification

I ran into a bug with an app I'm developing when run under Android wherein libcurl would hang during initialization.

As it turns out, my app gets stuck waiting on a call to read() from /dev/random and my embedded Android system doesn't seem to be very good at generating entropy on it's own.

After tracking down the path of libcurl->mbedtls->tf-psa-crypto, I noticed that tf-psa-crypto reads from /dev/random if getrandom() isn't available.
I did a quick hack to add __BIONIC__ to the "test for Linux getrandom() support" test and my app launched instantly.

Line in question:

#if ((defined(__linux__) && defined(__GLIBC__)) || defined(__midipix__))

Metadata

Metadata

Labels

component-platformPortability layer and build scriptsenhancementNew feature or requestsize-xsEstimated task size: extra small (a few hours at most)

Type

No type

Projects

Status

Incoming

Status

Scoped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions