From patchwork Fri May 10 01:24:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163805 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp1731262ilr; Thu, 9 May 2019 18:40:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4r7J3qA3Qn8CqE9SGMbceL0k0dk1KIL7J0aa/qCrn40ZwuS3gixOBm+utDo4qdO5X48WC X-Received: by 2002:a7b:c3da:: with SMTP id t26mr5183629wmj.40.1557452407371; Thu, 09 May 2019 18:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557452407; cv=none; d=google.com; s=arc-20160816; b=PRE6snzSH3eP4CcdkAZEVyBN3Are1uPlZLEAclw//J9ZVIL9EZZXH8YuBF497exyUv yP81n7e66UwKj4bsyM5DzASzELnXHrcwKs6mOlQUbUEulYd67rQUAN6tzb1CJGZupKeS 605+yi8TKRhMyRbpxUpN+UU/iw8srtOEKzZE4oCsVWkQUxvXgCSQdtODorZd1cMsbVTN QLFFTgkAuQdy3hGpnGUAoEJAdLOaS8wgR9E8V1B1K67JmBbvqopfS4aaAZDOqndlBhuE MMB+JVmhq0BTIEp1jY00RbUQIZv2/Rb04WhshKgbQtVL5oqMkIyFmavsRIJuweqBHsOT VIMQ== 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=iRt1ekpVqMBTFPlbEkwvccpMEH6z9s1kPn0wCee76Ys=; b=UlaxRIfL78pzLMZLJFL4lhQS+gXvm+8vm8TMQnpa1V/FqjkDtUQ5JrkZ+1+rTSBo5F OEBV9qpYVqG0e5fOanJAZ2telIHAv5TgTBW9yfayFpHvrs/kZxlhBiajNxApkfCvXHau AoSVAxI7vPx5kP9eYSvMrH8YwAxr1SvUHm4ZqHqm3/+5xXsFjSUNhEdYe0nNpjpxuLyD Q+Hfr92z5C+XND5lTq4dDzkm/lCLHNmotgxwhdhbRHrXnEPsz0oCB3xwl22Hr8GmSNIH ArLODQGQvGrdQaCE/fqs19qinU0erU4QEesZQ24gVWBJiwvxhlESYBKVOrN/ebP1/r3w OeAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xZKBvI5w; 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 j33si2657256wre.178.2019.05.09.18.40.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 09 May 2019 18:40:07 -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=xZKBvI5w; 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]:35201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOuW6-0002qn-Cx for patch@linaro.org; Thu, 09 May 2019 21:40:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOuHt-0006NW-2w for qemu-devel@nongnu.org; Thu, 09 May 2019 21:25:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOuHr-0001Io-Vm for qemu-devel@nongnu.org; Thu, 09 May 2019 21:25:25 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:33020) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOuHr-0001I3-QW for qemu-devel@nongnu.org; Thu, 09 May 2019 21:25:23 -0400 Received: by mail-pf1-x441.google.com with SMTP id z28so2271820pfk.0 for ; Thu, 09 May 2019 18:25:23 -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=iRt1ekpVqMBTFPlbEkwvccpMEH6z9s1kPn0wCee76Ys=; b=xZKBvI5wkHxN8vjZl6NblWPq5dSgQO4dYbU3Bgo5lChSGqLdi8PvGxQsaPmWTMXKUZ prPiD6tUxsooCy/3NbroKaReKsUjU2y7JhTaph/hTZnBk5B/kt0ISR0iUZ5ZAue0M1Dr UzJMuyWoGIW85R+sqeMwRFV+6tpYmwVzaBBLSuzYtJdqd+TMvxeQVCCDg5rI02Loah1S OtQFJQn1X4liUzI2pp8Zi6UEb2lfk41tWRuSOMA6MN5lizf+F2U0naiPVrRll/cIy9Rt A85xKvcWmrTsztX+lZDaTNeghRqz2kOcinMD+0uYVdfZ/UzOaT/dnwhuaY2INaqW/ItK 6hIw== 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=iRt1ekpVqMBTFPlbEkwvccpMEH6z9s1kPn0wCee76Ys=; b=COe5TcuM12Am6FNniBFTKa5oGAD9+wagS5mtdCjogD4A2IlG0Pbhtx9aOMTlwKKd6S EVss67lUjsgv1agny/1WmOD+4EHtQoULuB1ZioRPhjjhjERJjrVqefEPX8Tw4U2K96r8 fjqEVTe0l2LjDPQeHjgSxe4W72R7LTcLdo0FoaoAsN7lHT3CQNJ4nYV+3fOx4led+Fpn fUo7nCSsuoBxeEECzfJ5kmTOALm61oNQuD5Q3jZQhPg5GZhbh/WH43nylnNMhlcqBlcL kaX2CScou10h5mS8dVOGReAMacSG65/b33ug0ZumSvfUMBW7BAE9VBRm2ZiMAZr33oSC w2Ng== X-Gm-Message-State: APjAAAW+6w9tEuqos9ZnLHtLhWt32CCxtEUnDmoWPxa5pLlMgT4G7K0m b9ToSk0jZ2EPUYrbujpbT2GTuBdf9KM= X-Received: by 2002:a62:4281:: with SMTP id h1mr9882033pfd.162.1557451522632; Thu, 09 May 2019 18:25:22 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 18:25:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 9 May 2019 18:24:52 -0700 Message-Id: <20190510012458.22706-19-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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v5 18/24] 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: qemu-arm@nongnu.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. Cc: qemu-arm@nongnu.org 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);