From nobody Tue Feb 10 06:43:35 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=1558061888; cv=none; d=zoho.com; s=zohoarc; b=fdtscRTBrs1JbnhYpV+wrG2Mk8W8XbHQx4BKf27dOth47W96h0h5J8y31Y5QmNYcpliCuloRxHTZqiKFap2SypGXjZFSMZGOFPWw14F2oQ4C9Hy7nsfgmH7w+wq63SpMz9WYVVo7htUHJI835DZq50sSuyaHq0LK0iuvDeMus7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558061888; 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=/VWGaUBQJcHRh8ZCol9Bt7n9p31zv9AWS8bL9WKxKYs=; b=l3U4O5a18k2iddG/2z7orDrslyG4SoBrXAGcoLGxNXjrCRmtyr6WUfeBCZAANmttsN0Y/3aH8Q9CwlVZI1fKENRSnJnFuolX12oUHHHui0qtG2f4fnXRF2JvLSaPpDnuXYZVfaVd9JoMUGGo5I2tbNvB7Yu0j4C+mO7yRczJR18= 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 1558061887960875.1858238527855; Thu, 16 May 2019 19:58:07 -0700 (PDT) Received: from localhost ([127.0.0.1]:40349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRT4K-0003At-Uf for importer@patchew.org; Thu, 16 May 2019 22:58:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRSnM-0006Cx-By for qemu-devel@nongnu.org; Thu, 16 May 2019 22:40:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRSnL-0002WQ-1j for qemu-devel@nongnu.org; Thu, 16 May 2019 22:40:28 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:44890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRSnG-0002BZ-PL for qemu-devel@nongnu.org; Thu, 16 May 2019 22:40:26 -0400 Received: by mail-pg1-x541.google.com with SMTP id z16so2503476pgv.11 for ; Thu, 16 May 2019 19:39:52 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id w6sm6984152pge.30.2019.05.16.19.39.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 19:39:50 -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=/VWGaUBQJcHRh8ZCol9Bt7n9p31zv9AWS8bL9WKxKYs=; b=I6DT1Oeg6MAL8iMt1FFcz4RercqdWySvvBan8w48H/yI1HpVufU0VqVbNGV6AOB1V5 MzNqKZjsU+aSbV9o3s+2/SioXZfAZjf8e+QkM1u+JVgCIZmDoMAmPhFakQox6HTxzv6E 8MJ2YT6SxPHFHZ7cggmdwe51qyNCO813TB6EXvqFWvk5Kt1Ds4RUiX96oVfd67xSRbQV MouSeo3ZBeOPSRFKPZwWClb3sigo867WQuaWgG7bP8/mpu8kiWqbu+0lRh1w4CX7Vrez 6uenrs5oiEnCaqpv8HVmWHh1Et3DCCu8utcGriVLZiNdOp3I+uHNDFANNxnImCvClkc4 xt4Q== 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=/VWGaUBQJcHRh8ZCol9Bt7n9p31zv9AWS8bL9WKxKYs=; b=Z1RiK3ld/zaZHMXZd3adubr+z8KqQ5po4+CIkp8+lXQuFW2XnuAP+fLZQm4nzoEo6c scr/lVD7mTlQy+A3nzXzsY/RNstzvOL1xS+9GM0OAvKW+R/qnMRN/AWkXUiwAOFldjoI 1AHl8zGA3DT2JJtzpNC6A0kcyZYXVs8IK3wtnCLKjUCjuXNWQ72GnQBV+ZMQlCid9Jvt hsxHjETpOD0HQ/RUePLW9cVN+5yizZ0QGwnrPz1Bt21dgDqzvzNGieHj2sGQwwGsmesf A1cx1zswYS3PiPS7mctKUZRhd4OS4XRsMMrsrVAYg5BF1+jQomNnNM4gfAdSrG4hmRPJ Tn3w== X-Gm-Message-State: APjAAAX9p8TY0LmMCh55MC7OcK/N0k1ShHCqj1TYs+tPlvjdWLA5DuFT H3Kep0KaYTFgYRnu8PIJd5cJ6sCNeno= X-Google-Smtp-Source: APXvYqx0CQOcuooD4zq3bRK75uuOXfr1VlJxsXcXgvE9UpzleqlCbmJZjNlj6fg8QZ9rSXojdpOVaA== X-Received: by 2002:a63:1820:: with SMTP id y32mr53537545pgl.287.1558060791054; Thu, 16 May 2019 19:39:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 16 May 2019 19:39:19 -0700 Message-Id: <20190517023924.1686-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190517023924.1686-1-richard.henderson@linaro.org> References: <20190517023924.1686-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::541 Subject: [Qemu-devel] [PATCH v8 20/25] 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: lvivier@redhat.com, berrange@redhat.com, armbru@redhat.com 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. 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