[PATCH v12 1/9] stdlib: Add arc4random, arc4random_buf, and arc4random_uniform (BZ #4417)

Florian Weimer fweimer@redhat.com
Fri Jul 22 12:35:11 GMT 2022


* Adhemerval Zanella:

> diff --git a/stdlib/chacha20.c b/stdlib/chacha20.c
> new file mode 100644
> index 0000000000..77e37655cd
> --- /dev/null
> +++ b/stdlib/chacha20.c
> @@ -0,0 +1,179 @@

> +static void
> +chacha20_crypt (uint32_t *state, uint8_t *dst, const uint8_t *src)
> +{
> +  size_t bytes = CHACHA20_BUFSIZE;
> +  while (bytes >= CHACHA20_BLOCK_SIZE)

That doesn't look right.  No bytes variable.

The chacha20_crypt functions should probably use arguments in the style
of

  uint8_t dst[static CHACHA20_BUFSIZE]

for compiler size checking.

Thanks,
Florian



More information about the Libc-alpha mailing list