From patchwork Mon May 6 17:33:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163435 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp266611ilm; Mon, 6 May 2019 10:48:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBI53vTfzIJQtuRtSbaw1U4Z+/T/Ko6NCRvZwWWqrz+mHI2Yis8YuJNkCZrAwfXYSd0W6I X-Received: by 2002:a7b:c010:: with SMTP id c16mr17639915wmb.82.1557164919014; Mon, 06 May 2019 10:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557164919; cv=none; d=google.com; s=arc-20160816; b=ob1Lze20kKhNGRdNHCiNSsJEIjUJGxAuecxqP7DSIsFVBFEvo2CsHt6RwNQE7uBTaA Gg4+k9CfmGQcpONji8U1FzvgWmbO8Tc7jq7uVxzGjuvuy7kRvzQm5tDPXEHsPwhNVNUE U8Yj4C5jZg2/4npOAFpVo1HbAjxOgDuAtCWlQYiS/sLcOBkXX7l1E70Mvwh7XDUI1ZBO 1fANYfjpF2f7H+CmBFSLiKYBVaStdDQZfYbLKXGlPHZa6nW9bge93PSYdl5s3Dy0GE+K A4FJEAhd8ZQ2zgom/LHvP1bSquWMEF9/D4eOfpZ6v3n4oh4EpMt0hbrIOmGPMgKRZbfq 79JQ== 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=N99BQlBfn/0a0vkPsRVGBD0Y+fTNw9UH381I+mLvorI=; b=dffRzJRSSB2l9e2ERxxkoqHW2sZlSIpXaNVB9VS/qsCI/zmL3CgwlBPR16IOkli5Hk w+9oysztnyv3aZ61QXIeoEGRjkVzmyyvFR6Ao0OpzYbHFxaoJu44a3m6rPPIlxGKzb2W 1NmVBZgkkaN6jG3yLHKxOW10Eu2j8zuE6sBsrlhrQrni2xmYufTQv+i4TNqUdAaQyPFi 00aPN8IjfZqdcG9P/wR2yWiBD1Ugp4ZvjqbUW9J1Qr/5O1hqpLoDmV84wqPd5OywSX+C pvsPs/he/O+ZdO+0YC/TE4BpcHbP0IhBnUYO/tNVwvbBh9HWh9DOtD4reCe76eCBV6Dl +5Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Dg5+08ul; 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 u11si7763919wrr.404.2019.05.06.10.48.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 06 May 2019 10:48:39 -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=Dg5+08ul; 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]:60088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNhjB-0005hg-UH for patch@linaro.org; Mon, 06 May 2019 13:48:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNhVO-0001Ez-07 for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNhVK-0001T4-Pe for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:20 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:37703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNhVK-0001Ry-Ia for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:18 -0400 Received: by mail-pl1-x641.google.com with SMTP id z8so6722983pln.4 for ; Mon, 06 May 2019 10:34:18 -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=N99BQlBfn/0a0vkPsRVGBD0Y+fTNw9UH381I+mLvorI=; b=Dg5+08ulJwFtevhdXETSihRnqYW53GxvjPzw9ZR3Qx6fNBXqDsUz+BEg2OG4QoUPe8 vkoX4Cs3zdwrbURmxP7Z5gDG9uvSpuYLcAl2mt1cL2BfZWIJDouEdvI3YxOExef4pqDP m5dU93hcjaSZu/r5Rq/WnMWTNMIyIDCMaIuzmiHaojzodxuIcuUpU7QSkftKg1DT8hcJ mNvgznnAm2labFfkUIS9R/KqaLXyETesGAqL8i2q5hn4GBphmnJHBn+SMNi+9FgWyjKF xqr9Jb/vVNb6XzFDBMUBx5vJA2Xli40KCjRhl+BZdwcIDuCapR5tZ76B1tHpCOrESQ/I 5vfw== 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=N99BQlBfn/0a0vkPsRVGBD0Y+fTNw9UH381I+mLvorI=; b=fK0tgBJuWWwyf2phhUO24LUVeIorSMZ7OJc491yH5Rle2HYkYqzTM+HE/+UeT3Z0gx J9tUWbFqhe0bmpImswdDt9jcq2xZEwnDeGajJJH7crgIrvGwVFe2SnfSX+WY5SM1p5YX AEf8iZw8ZklrjgQEc0UpzWtbOUv9JfQ0dkqCb8SXmepYaoe1MDElzYWxf0TYJOzwTMUL vcS2J6NP7GEb52l4JPLZeoeXSJRoVBZHPCe6SK6HFmEmCwsRjh+Fg2Jq44wUP+nKFyOC pG1SN5Hwy42FOEBaSKGlYoULVA+8UaWq1Oc6onUg1UFD+a/zFtqqKLMMTBNGH9qnsa2b NzAw== X-Gm-Message-State: APjAAAXdjyTU1cxZ+PIsDJNYI3Ffw0Oou3ue8oi+bNfABRTcBSiOdoy6 2OH+2ucw9Yoidcpap/rfMvj6LIvfpH4= X-Received: by 2002:a17:902:76c5:: with SMTP id j5mr34356896plt.337.1557164057250; Mon, 06 May 2019 10:34:17 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id k9sm2268839pfa.180.2019.05.06.10.34.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 10:34:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 6 May 2019 10:33:47 -0700 Message-Id: <20190506173353.32206-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190506173353.32206-1-richard.henderson@linaro.org> References: <20190506173353.32206-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::641 Subject: [Qemu-devel] [PATCH v4 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: Joel Stanley Signed-off-by: Richard Henderson --- hw/misc/nrf51_rng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Laurent Vivier 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);