Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-05-01 Thread Denys Vlasenko
On Sun, May 1, 2022 at 10:05 AM tito wrote: > > On Fri, 29 Apr 2022 18:16:41 +0200 > Denys Vlasenko wrote: > > > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > > > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > > > Can we replace all [s]size_t's with

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-05-01 Thread tito
On Fri, 29 Apr 2022 18:16:41 +0200 Denys Vlasenko wrote: > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > > Can we replace all [s]size_t's with ints/unsigneds? We do not expect > > > random pools anywhere near 4

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-30 Thread Jason A. Donenfeld
Hi Denys, On Sat, Apr 30, 2022 at 4:09 AM Denys Vlasenko wrote: > > On Fri, Apr 29, 2022 at 6:57 PM Jason A. Donenfeld wrote: > > On Fri, Apr 29, 2022 at 6:04 PM Denys Vlasenko > > wrote: > > > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld > > > wrote: > > > > On Wed, Apr 27, 2022 at

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-30 Thread Jason A. Donenfeld
Hi Bernhard, On Sat, Apr 30, 2022 at 1:42 AM Bernhard Reutner-Fischer wrote: > The tool sounds like it should fit in about 1k if we're forced to ioctl > and cannot simply use the shell. We'd all be better off to remove that > unnecessary ioctl bloat from the kernel and userspace. It does not

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Denys Vlasenko
On Fri, Apr 29, 2022 at 6:57 PM Jason A. Donenfeld wrote: > On Fri, Apr 29, 2022 at 6:04 PM Denys Vlasenko > wrote: > > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > > > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > > > if ((unlink(filename) < 0 ||

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Bernhard Reutner-Fischer
On Fri, 29 Apr 2022 18:35:54 +0200 Denys Vlasenko wrote: > Even partial removal of these complicated error paths > cuts down the size by ~10% It's one of those situations where all you would really want is spend 100b in the kernel to "credit" seed. Be it via /sys or the first bit of the write

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Steffen Nurpmeso
Denys Vlasenko wrote in : ... |Even partial removal of these complicated error paths |cuts down the size by ~10% A bit off topic but i personally am still thinking, really, that people would rather be reenabled to do what they did for long. ports/core/rc/rc ^e3afe2298e (Johannes Winkelmann

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Jason A. Donenfeld
On Fri, Apr 29, 2022 at 6:36 PM Denys Vlasenko wrote: > Even partial removal of these complicated error paths > cuts down the size by ~10% You know if you just cut out all of the actual code but made it still print the same status messages, you could cut out like 90% of the size... It turns out,

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Jason A. Donenfeld
Hi Denys, On Fri, Apr 29, 2022 at 6:04 PM Denys Vlasenko wrote: > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > > if ((unlink(filename) < 0 || fsync(dfd) < 0) && seed_len) { > > >

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Denys Vlasenko
On Fri, Apr 29, 2022 at 6:04 PM Denys Vlasenko wrote: > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > > if ((unlink(filename) < 0 || fsync(dfd) < 0) && seed_len) { > > >

RE: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread David Laight
From: Denys Vlasenko > Sent: 29 April 2022 17:17 > > On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > > Can we replace all [s]size_t's with ints/unsigneds? We do not expect > > > random pools anywhere near 4

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Denys Vlasenko
On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > Can we replace all [s]size_t's with ints/unsigneds? We do not expect > > random pools anywhere near 4 gigabytes... > > Probably that's fine. Is the advantage to tossing

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Denys Vlasenko
On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > > if ((unlink(filename) < 0 || fsync(dfd) < 0) && seed_len) { > > bb_perror_msg("can't%s seed", " remove"); > > return -1; > >

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-29 Thread Jason A. Donenfeld
On Wed, Apr 27, 2022 at 6:55 PM Jason A. Donenfeld wrote: > 3) Limit the poolsize to 256 bytes (by changing the MAX_SEED_LEN enum >value to 256 instead of 512). I implemented this, and > > if (dfd < 0 || flock(dfd, LOCK_EX) < 0) > > bb_perror_msg_and_die("can't %s

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-27 Thread Jason A. Donenfeld
Hi Denys, Nice to hear from you. On Wed, Apr 27, 2022 at 06:15:50PM +0200, Denys Vlasenko wrote: > In read_new_seed(), if getrandom(GRND_NONBLOCK) reads > less than len bytes: > the code reads GRND_INSECURE... overwriting possibly > up to len-1 useful, and probably more securely random bytes? >

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-27 Thread Denys Vlasenko
Good day Jason, On Wed, Apr 20, 2022 at 6:29 PM Jason A. Donenfeld wrote: > Hi Bernhard, > > On Wed, Apr 20, 2022 at 3:55 PM Bernhard Reutner-Fischer > wrote: > > I've applied this v9 now, thanks for the patch and thanks a lot for your > > patience! > > Excellent! Thank you. Feel free to CC me

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-21 Thread Ron Yorston
Jason A. Donenfeld wrote: >Oh interesting. I wonder what's different about your >config/compiler... I guess that means we can change the menuconfig >entry to say (1.8k) instead. My understanding is that the applet sizes reported in config are to be generated by running the make_single_applets.sh

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-20 Thread Jason A. Donenfeld
Hi Bernhard, On Wed, Apr 20, 2022 at 3:55 PM Bernhard Reutner-Fischer wrote: > I've applied this v9 now, thanks for the patch and thanks a lot for your > patience! Excellent! Thank you. Feel free to CC me on other things you have planned there -- happy to review. > > (add/remove: 4/0

Re: [PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-20 Thread Bernhard Reutner-Fischer
Hi Jason! On Tue, 19 Apr 2022 12:50:05 +0200 "Jason A. Donenfeld" wrote: > The RNG can't actually be seeded from a shell script, due to the > reliance on ioctls and the fact that entropy written into the > unprivileged /dev/urandom device is not immediately mixed in, making > subsequent seed

[PATCH v9] seedrng: import SeedRNG utility for kernel RNG seed files

2022-04-19 Thread Jason A. Donenfeld
The RNG can't actually be seeded from a shell script, due to the reliance on ioctls and the fact that entropy written into the unprivileged /dev/urandom device is not immediately mixed in, making subsequent seed reads dangerous. For this reason, the seedrng project provides a basic "C script"