From patchwork Wed May 22 18:42:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164864 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1231492ili; Wed, 22 May 2019 12:06:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzB8lhFlGcbwu82UjQRgWyXXXOeNbG/cyB7jPAyX5ckbKRUR73Bvzw7oP2EIDzb4fKjmVSZ X-Received: by 2002:a17:906:699:: with SMTP id u25mr35047687ejb.245.1558551970036; Wed, 22 May 2019 12:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558551970; cv=none; d=google.com; s=arc-20160816; b=g1Um7HyljGYjxccv9CacF+G2y51rlmr4lTFplA4/mjFOM7sgcLhJ8qJl7ZH2h2pzOR tNj5uYwgB6aX0+LqpICzU2w5kMLnCljo0GOwrzlyHDU0EuJ/mMK09yxPbYow0ao4cua9 cIeQ2Y84M7p8BG7yoF3sDfHx6ekt43DqohixBgmjoq2HaDrgteLmnbzYXczUoT1msIlb YQeDbNaisXKYNFW85Z/xPX+knkyWmBXlPxz7AWCb/eD751QaojbTGAU2N8oUcfBjzATx KH35YDMV3V55FZfQkf/5rL2NRKA/xAjSsJxAfSWCQmnnx5omBq5CL2EDjSLMpu3mLS1A OCSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=zHL5/dOLNq3cxnvhnBPOBazkJM0pmZq+fc+P6w38V4s=; b=G2XnbLNnHqv1qkzorRaIRLlrNjWns+FDNl5fucuNDkJMfh2TnN1mOpioEAO87hj5cF crz1ZX7NTjnzFbhSLzq5wVoYCsEIw2avRZrEo74qqRPxbqdJTEI6Mej5NJbiPiR93Jxv rsdf3O58+nEGjbPmhVLCjla/biIbFgzIYnr7n0nBJLxg/d7QrSTwOOAwWS3uP3bNRIew qnJRxtapkyphacQJ/Ul6LID3P9hHcIQhZLgsTLupVjApBZiwxh1lKh3LLtjwuOdUP/+P xa8KPW4m5cXfhmoadbE4LxrcBX/ZRiaP9VodXKUEqtKoDcaQrrs5BZQ57G5pAC6F2Jtw u+Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="I/RgZIqw"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w24si7555323ejf.95.2019.05.22.12.06.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 22 May 2019 12:06:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="I/RgZIqw"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:49792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTWYy-0001St-Ty for patch@linaro.org; Wed, 22 May 2019 15:06:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTWOo-0008Lh-9x for qemu-devel@nongnu.org; Wed, 22 May 2019 14:55:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTWCQ-0008Al-0d for qemu-devel@nongnu.org; Wed, 22 May 2019 14:42:52 -0400 Received: from mail-yw1-xc44.google.com ([2607:f8b0:4864:20::c44]:39304) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTWCO-00089d-8E for qemu-devel@nongnu.org; Wed, 22 May 2019 14:42:49 -0400 Received: by mail-yw1-xc44.google.com with SMTP id w21so1241570ywd.6 for ; Wed, 22 May 2019 11:42:48 -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; bh=zHL5/dOLNq3cxnvhnBPOBazkJM0pmZq+fc+P6w38V4s=; b=I/RgZIqw0PlT8WEjXXx/SNicpUQAAw/6516CBgMzR6eXFNR6Kf8kKEOfp8J/smmNnF NYg0VFjZqE7YnqcGyMrYeaQnIQQSZN2I3LKLyVTjSph6ojnD66TUsunKXwVF8FPcCcUf tvEjcIPRZ1kDI1WZXMFSb+v+lJ6HipC9sCtCrfKUT1nEJgrMjPhUuFpihrc3BnECxHFH f+JkEFKaF4AmwjWEw7LEaRZ6JCyWjlwPo8/QpZ993o1u8qpXE05I7p21HO02psxA9Ep0 Jz3OlFzAfnW2ITvFDk/sJTYDfgFPkJDc+nvrR+QciOjR5/6ahKWi20hdgF1n4Rrzfppr O+4Q== 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; bh=zHL5/dOLNq3cxnvhnBPOBazkJM0pmZq+fc+P6w38V4s=; b=lza19VRpnh448KKodFXzc+exvfJkW+GpNfYeBkFipADzI6qVelrePMJR/QYzyDeobk hqTMBV+miOUxzgYBUTuadnKXOJrnXbB5GyimQIoedtaklsmKDRYL/pV7gLK0GhS9OoN4 h1bOG1PNuEF/MxQveDrn67XBaxNGrT1DYsYfm9GWYQM6l4bTMMHVi21NE+6RzvTCDMz9 W5zKI4/XLAZ5m5vHzhh1pJM4AtVZXn9362JVHrpgMpNs2n4vrJceB4EUkhWgBywIQjqh w7D5PBkCea1BCRkVvNvhCnb7hLHpb/5VvMwp4dOGaW8CST39ShNtugIJtrMpCxMFRZ2O rcXw== X-Gm-Message-State: APjAAAV8777qDC/K8trMZ2pyFUEmhbed5n3dq8FoUNZH/pYc4ZncSYP4 5FIzGEu99L+LStESm0CvfwCdz9zQ21c= X-Received: by 2002:a81:b717:: with SMTP id v23mr42621851ywh.120.1558550567474; Wed, 22 May 2019 11:42:47 -0700 (PDT) Received: from localhost.localdomain ([71.46.56.17]) by smtp.gmail.com with ESMTPSA id 206sm1299445ywq.74.2019.05.22.11.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 11:42:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 22 May 2019 14:42:19 -0400 Message-Id: <20190522184226.17871-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522184226.17871-1-richard.henderson@linaro.org> References: <20190522184226.17871-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c44 Subject: [Qemu-devel] [PULL 18/25] hw/misc/nrf51_rng: Use qemu_guest_getrandom_nofail 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The random number is intended for use by the guest. As such, we should honor the -seed argument for reproducibility. Use the *_nofail routine instead of error_abort directly. Reviewed-by: Laurent Vivier Reviewed-by: Joel Stanley Signed-off-by: Richard Henderson --- hw/misc/nrf51_rng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/hw/misc/nrf51_rng.c b/hw/misc/nrf51_rng.c index d188f044f4..3400e90a9b 100644 --- a/hw/misc/nrf51_rng.c +++ b/hw/misc/nrf51_rng.c @@ -14,7 +14,7 @@ #include "qapi/error.h" #include "hw/arm/nrf51.h" #include "hw/misc/nrf51_rng.h" -#include "crypto/random.h" +#include "qemu/guest-random.h" static void update_irq(NRF51RNGState *s) { @@ -145,7 +145,7 @@ static void nrf51_rng_timer_expire(void *opaque) { NRF51RNGState *s = NRF51_RNG(opaque); - qcrypto_random_bytes(&s->value, 1, &error_abort); + qemu_guest_getrandom_nofail(&s->value, 1); s->event_valrdy = 1; qemu_set_irq(s->eep_valrdy, 1);