Re: [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation

Jason A. Donenfeld
2024-08-27T15:16:35Z

On Tue, Aug 27, 2024 at 11:02 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> On Tue, Aug 27, 2024 at 10:46:21AM +0200, Christophe Leroy wrote:
> > > +/**
> > > + * __arch_chacha20_blocks_nostack - Generate ChaCha20 stream without using the stack.
> > > + * @dst_bytes: Destination buffer to hold @nblocks * 64 bytes of output.
> > > + * @key: 32-byte input key.
> > > + * @counter: 8-byte counter, read on input and updated on return.
> > > + * @nblocks: Number of blocks to generate.
> > > + *
> > > + * Generates a given positive number of blocks of ChaCha20 output with nonce=0, and does not write
> > > + * to any stack or memory outside of the parameters passed to it, in order to mitigate stack data
> > > + * leaking into forked child processes.
> > > + */
> > > +extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks);
> >
> > For Jason: We all redefine this prototype, should we have it in a
> > central place, or do you expect some architecture to provide some static
> > inline for it ?
>
> Given the doc comment and such, that would be nice. But I didn't see a
> straight forward way of doing that when I tried before. If you want to
> try and send another fixup commit, that'd be welcomed.

I'll give it a shot.