From nobody Tue Feb 10 13:17:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557451671; cv=none; d=zoho.com; s=zohoarc; b=eqvoofMi/5RwevT9MCyix9WK/J0n76cIFrjS8eVgP3ugNBuORd8gRX94YsJ43p7uCKfEs4fkqv8B13dW5EAK/WcauX0+VqY2rrUz95hYZELda5fSHhRIPA6PBhqN7AmEnWHtQud+tciZy8SUxANU6q+ZKWyEgHGAe9VEv/S/7RI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557451671; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SUOVHO6j5bto5JT3YOaz6mzG9aMKtYONtCxKiBQvOSY=; b=lftKmhrXVPtuLP1hY4L75Ng0kfdP8FDAL2Xzs0H6edAW9lL6vuQGwuF6bG8j7kRbFXKTjvQ2nOLtziHwgDK+17rXXEJ56325C4y8RVYL1d6wQTxHpYazXR8kJFV46UL1lg9Dkl8k/7JEiUMLKy2uNr86El5W4615e2O3nqGKaDg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557451671470973.5875566373282; Thu, 9 May 2019 18:27:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:35022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOuKC-0008Qh-CT for importer@patchew.org; Thu, 09 May 2019 21:27:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOuHv-0006Qy-PB for qemu-devel@nongnu.org; Thu, 09 May 2019 21:25:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOuHu-0001NM-M2 for qemu-devel@nongnu.org; Thu, 09 May 2019 21:25:27 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:35254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOuHu-0001Lu-Gc for qemu-devel@nongnu.org; Thu, 09 May 2019 21:25:26 -0400 Received: by mail-pf1-x443.google.com with SMTP id t87so2267050pfa.2 for ; Thu, 09 May 2019 18:25:26 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id n18sm8252700pfi.48.2019.05.09.18.25.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 18:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SUOVHO6j5bto5JT3YOaz6mzG9aMKtYONtCxKiBQvOSY=; b=yTX7Rz1f4JFetaDPpeaTvLwRQg8laV+kMLAqlXwDf0bBw6PkyU1VTCDgUB2b0MEvdm XMYAL4CyArzDQ/1T+F6rq759JmBPCFMztWbTgFTFLbb+w8yFhs0bRLi4RzW4Txe3DPlP m3H6rPfg5B7qUHH5h4oJXs36IquYPi9x0D2LJelsjuOgez9BQo92ing7uwoYuuZNO3WP nogDUipeKF9ESiFdtWRaBDuuhMmVG48NgS/+qqUINC45keVJnqniE+YSgP3wmZOqmGfH xOF5Ncjns3uStSx41NCJXuHxD7DORbEnOeh+TR9CXr0EVTCYYk7OBuyAGUpN7KUX0BN0 eNxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SUOVHO6j5bto5JT3YOaz6mzG9aMKtYONtCxKiBQvOSY=; b=umUVU4WhkyARYVmh/TZA7nHGaFu2N3DNNR46ji1a7AbiT1s2XaC/C99jDaBGyg66q/ ByWKCQb9ElJLahqIScJFp9/Nmp0gztSaWmohV5WBLSiG8ZsEiHoBXKkNlkiBZnC66qin zmSKfYa2j1dnjQlLL/tUzuFrBqbWQ4Q+3uZIYvffOjNIXCZbY4KmepdmOqu2X8Z/cHpX DL7V2em/1vnWVghVf8/K++G2rRQCZS7TUQlLecbO/PY3pZFoLnYpyCx98m15mUqzAfL2 AorFfINgPFcLIIrOmulK7FSrnPqHSfF1pvnE3xAl9h7XMmPzpu5lttwnY6YM6HxMCuYQ HZVg== X-Gm-Message-State: APjAAAVc9C+GASma998t6SrVp1H4eZBggatK1cSCFpQ6llRVacEH3rsU nJCIASQYE9E+HfLB13H9IHSDJeMUthc= X-Google-Smtp-Source: APXvYqxHupQo3fCLcxXUfn1e0KGg1E/lTa3IxUeleqrsjrhsghxPUvqxf8l+myByFhb0gZ0pBWAetQ== X-Received: by 2002:a63:8149:: with SMTP id t70mr10054715pgd.134.1557451524878; Thu, 09 May 2019 18:25:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 9 May 2019 18:24:54 -0700 Message-Id: <20190510012458.22706-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510012458.22706-1-richard.henderson@linaro.org> References: <20190510012458.22706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v5 20/24] hw/misc/exynos4210_rng: Use qemu_guest_getrandom X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mitsyanko , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The random number is intended for use by the guest. As such, we should honor the -seed argument for reproducibility. Cc: qemu-arm@nongnu.org Cc: Igor Mitsyanko Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- hw/misc/exynos4210_rng.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c index 4ecbebd2d7..0e70ffb404 100644 --- a/hw/misc/exynos4210_rng.c +++ b/hw/misc/exynos4210_rng.c @@ -18,10 +18,10 @@ */ =20 #include "qemu/osdep.h" -#include "crypto/random.h" #include "hw/sysbus.h" #include "qapi/error.h" #include "qemu/log.h" +#include "qemu/guest-random.h" =20 #define DEBUG_EXYNOS_RNG 0 =20 @@ -109,7 +109,6 @@ static void exynos4210_rng_set_seed(Exynos4210RngState = *s, unsigned int i, static void exynos4210_rng_run_engine(Exynos4210RngState *s) { Error *err =3D NULL; - int ret; =20 /* Seed set? */ if ((s->reg_status & EXYNOS4210_RNG_STATUS_SEED_SETTING_DONE) =3D=3D 0= ) { @@ -127,13 +126,11 @@ static void exynos4210_rng_run_engine(Exynos4210RngSt= ate *s) } =20 /* Get randoms */ - ret =3D qcrypto_random_bytes((uint8_t *)s->randr_value, - sizeof(s->randr_value), &err); - if (!ret) { + if (qemu_guest_getrandom(s->randr_value, sizeof(s->randr_value), &err)= ) { + error_report_err(err); + } else { /* Notify that PRNG is ready */ s->reg_status |=3D EXYNOS4210_RNG_STATUS_PRNG_DONE; - } else { - error_report_err(err); } =20 out: --=20 2.17.1