[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 11/14] linux-user: Use qemu_getrandom for AT_
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH v2 11/14] linux-user: Use qemu_getrandom for AT_RANDOM |
Date: |
Thu, 14 Mar 2019 22:51:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 |
On 3/14/19 5:55 AM, Richard Henderson wrote:
> Use a better interface for random numbers than rand * 16.
>
> Cc: Laurent Vivier <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> linux-user/elfload.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index c1a26021f8..f33bf4fb85 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -7,6 +7,7 @@
> #include "qemu.h"
> #include "disas/disas.h"
> #include "qemu/path.h"
> +#include "qemu/random.h"
>
> #ifdef _ARCH_PPC64
> #undef ARCH_DLINFO
> @@ -1883,12 +1884,9 @@ static abi_ulong create_elf_tables(abi_ulong p, int
> argc, int envc,
> }
>
> /*
> - * Generate 16 random bytes for userspace PRNG seeding (not
> - * cryptically secure but it's not the aim of QEMU).> + * Generate
> 16 random bytes for userspace PRNG seeding.
> */
> - for (i = 0; i < 16; i++) {
> - k_rand_bytes[i] = rand();
> - }
> + qemu_getrandom(k_rand_bytes, sizeof(k_rand_bytes), false);
> if (STACK_GROWS_DOWN) {
> sp -= 16;
> u_rand_bytes = sp;
>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
- Re: [Qemu-devel] [PATCH v2 08/14] util: Add qemu_getrandom and support functions, (continued)
Re: [Qemu-devel] [PATCH v2 08/14] util: Add qemu_getrandom and support functions, Eric Blake, 2019/03/14
[Qemu-devel] [PATCH v2 12/14] linux-user/aarch64: Use qemu_getrandom for arm_init_pauth_key, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 06/14] crypto: Change the qcrypto_random_bytes buffer type to void*, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 11/14] linux-user: Use qemu_getrandom for AT_RANDOM, Richard Henderson, 2019/03/14
- Re: [Qemu-devel] [PATCH v2 11/14] linux-user: Use qemu_getrandom for AT_RANDOM,
Philippe Mathieu-Daudé <=
[Qemu-devel] [PATCH v2 13/14] linux-user: Remove srand call, Richard Henderson, 2019/03/14
[Qemu-devel] [PATCH v2 14/14] target/arm: Implement ARMv8.5-RNG, Richard Henderson, 2019/03/14