Commit graph

9 commits

Author SHA1 Message Date
Maurice Lam
47b4facecf Rename bssl-ffi to bssl-sys
Test: TreeHugger
Change-Id: Ie8108ef5d5f8e6c8252409d1e9aceb76613dff9f
2023-12-18 23:28:21 +00:00
Andrew Walbran
c768733f76 Add safety comments to prng_seeder.
These will soon be required by a lint.

Bug: 290018030
Test: m rust
Change-Id: I93db8ce5285714c182a6dcdf9464e5ff4656dc36
2023-07-24 11:41:27 +01:00
Paul Crowley
17885691e7 Don't set /dev/hwrng to O_NONBLOCK
Reads on `tokio::fs::File` are expected to block, and are performed
inside a `spawn_blocking` call so that they don't block the reactor.

Bug: 268075535
Test: read from /dev/socket/prng_seeder 256 times
Change-Id: I009d1fb11b540412e705cc2be0ebc7e2f09d2c0c
2023-03-09 17:51:58 +00:00
Andrew Walbran
13335dea78 Add test to verify clap argument parser.
Bug: 260823636
Test: atest prng_seeder.test
Change-Id: I2e69fa662c9f96b367ae27f640b4687da22ca8ac
2023-01-10 14:09:54 +00:00
Jiyong Park
eefd351202 prng_seeder is a bootstrap process in microdroid
It is started very early before linker namespaces are configured, thus
making it a bootstrap process. Also, it is built with `prefer_rlib:
true` so that we don't spend time for dynamically linking the dylibs.

Bug: 263398430
Test: watch boottime benchmark
Change-Id: I5193d0d36958de5b6d6dfa8584212f82edb727bc
2022-12-22 18:38:54 +09:00
Paul Crowley
021cf557e6 If setup fails, hang forever
Without this init will repeatedly try to start this daemon,
causing logspam.

Also:
* wait until just before tokio conversion to set O_NONBLOCK
* ensure logging code reflects source example
* log at info and higher
* use contexts for better logging
* fall back to println to work around logging problems
* remove wrong copy-pasted comment in Android.bp

Bug: 249531229
Fixes: 249566340
Test: in permissive mode, rm /dev/hw_random before start
Change-Id: Ib70cbcb048f33dca789151622d98c6d56270fa37
2022-09-30 19:24:50 +00:00
Paul Crowley
0faf1f9fd9 Add OWNERS file
Test: N/A
Change-Id: I7fc63b385ea866ca13b04b4bccbc6e851340da49
2022-09-29 17:18:20 +00:00
Pete Bentley
812307d270 Add prng_seeder.rc to start PRNG seeder daemon from early init.
Bug: 243933553
Test: Manual - same as https://r.android.com/2215051
Change-Id: Ie195f05476ff5eee5e589d6f4a3f631c2802fa6a
2022-09-23 12:22:14 +01:00
Paul Crowley
9da969e58b Add prng_seeder utility
This binary seeds a FIPS-approved DRBG from /dev/hw_random and then
serves seeds to other processes on the system using a socket
(/dev/socket/prng_seeder) that is passed in by init.

Bug: 243933553
Test: Started under init and verified correct operation using strace
Change-Id: Id4461a402d1ac92180a54cc4b241a2720b94d8de
2022-09-16 23:46:36 +00:00