From patchwork Tue May 14 19:16:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164244 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3010856ili; Tue, 14 May 2019 12:29:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyI7iis234j+gVz71Gfo75BQIVHTCZUIMkQs3DLZkAn0MIMtMcX3xtmjfR+VQOu6/Q0uIti X-Received: by 2002:a17:906:3955:: with SMTP id g21mr28859809eje.61.1557862191292; Tue, 14 May 2019 12:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557862191; cv=none; d=google.com; s=arc-20160816; b=SYK83abq1g14kwiniUHMnEas2RH5UnsUf4JPyuu02PLXO6vAcNmX6uGa79ecg80WXM n0HoQbacED+bxOdT9jpZuIvfPR82C7S1PobqyFZ4qonNMkMMkJIJbVA6ISgBdruP/kjG abKATHOsPnqs+dR9cufBCYh5PCQyL84xixlRpnYG4XEZIwzgCwcRF6jAUg4uote23d9V PkRnBUnjtaqnpCyWLIadSJmWjrc3vDgHKP+ewyi9DbH9gG6UB/0Kbvx8qBttzqLX761d d8cPwdKsk7+xJRw/ecpny6kU3XASYktu++iNpnhz3jQSpX3WZVBPvdHiPsaLL/UKbQoV Jqrw== 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=Img1ouF1TSpTJAsrzXlg2NkLKH6mTpQQKC51Or1JiKbc+At1THHkqe0FV7uMrWe2CE StNldh64v4MsCMeMin07m2jXE3a1qsUO1n6Zt4qqg5Rp8Y3couviIhhb7U43FIoOp7HT 5N/WohC/dea8omAh13OOeK07tyW+WtsZhQ9k9rAau9CnJzc17o1LYtHIjQ7DfICTTSRS eUW3qQqYHrorg94YNhPkIRQXN9gK08oKxSieHiapof3uPlHLIkHfiQrf/b6cBz2gQ9YT X3rkp7r8oVizun24/vLTFBeYoL+dYRWs1se+H2baKgx2Zg46eKyj2kWuDNvE1MXcCWaj LYEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M6gR4U3L; 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 o14si2852149ejz.221.2019.05.14.12.29.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 14 May 2019 12:29:51 -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=M6gR4U3L; 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]:53084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQd7W-0004uq-5w for patch@linaro.org; Tue, 14 May 2019 15:29:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQcvR-0002d7-I8 for qemu-devel@nongnu.org; Tue, 14 May 2019 15:17:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQcvP-00072z-Mp for qemu-devel@nongnu.org; Tue, 14 May 2019 15:17:21 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:40109) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQcvP-00071g-As for qemu-devel@nongnu.org; Tue, 14 May 2019 15:17:19 -0400 Received: by mail-pf1-x442.google.com with SMTP id u17so592pfn.7 for ; Tue, 14 May 2019 12:17:19 -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=M6gR4U3L/bgTDtPmpFWXLWvD77Vm4fCPpE7DYCo4iDjA4pftInBaJ9WEh2MI/25bku ERxLzyDm4lvi0GcKiUPCXMLQnc+msFjEVCLWSy5RW5QFa7f8SmPHpzEUeBHBp96Ls3tw gUr43liDbX5lUAucADct9Mv8bF/+cpbzcrFyfVbRkwo1AtWMbwjdeARv0kXoZCPErki5 /oINr0aj5sBZumLjuLXKv87Fc8gD+C5ouLDi11xpglqafsqkL11OvjaiQFU4EYYbSy5X uSHJWUrk7SVDgs23zT153m9/kEZKys0Hot+jZ2EoK3BqYtliP4dq8Wy3XadpqiZD7M8n MEvw== 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=kZnUhRbssnc2IfNq2pqtYy/fMePsYFoinetWZwMcU72xmRIBUvcwLjYn1SK05xpFGv UPjxTrWzeWqHk+Gc5hjR11JcckEa5dxEcMKc2WEglIU/rravrLkWS5d5+D9Rt1twwmLe Y1mxWynUCLClno3E5aggmZmiwEEwMTGwFhstiRmtqEI5nADJ9l8pAgqh8SmpzCYkgZir 0yPkjVbtJRsFfT97iCLLulh79k4JtqsOQxgcXRramzQupL17KYLIY1kxVPD4I0kesPI3 pXFpAJzPMRHj+4UCeXeunHpvIfmQMxcDLvcCuHKOoVKM8AcGBy/NuPO19r9GZXbVNzqm Bx3A== X-Gm-Message-State: APjAAAVxqQWBjj/Y7wY7FaiK94GXq0FC+HCacD7kCua+4XFgt7FLjzvW oUL+ZNQ6wB6GP5ixUHmfz5Ukznd8xRU= X-Received: by 2002:a63:541d:: with SMTP id i29mr39416547pgb.174.1557861438129; Tue, 14 May 2019 12:17:18 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id o6sm18682982pfa.88.2019.05.14.12.17.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 12:17:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 12:16:46 -0700 Message-Id: <20190514191653.31488-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190514191653.31488-1-richard.henderson@linaro.org> References: <20190514191653.31488-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::442 Subject: [Qemu-devel] [PATCH v7 17/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: lvivier@redhat.com, berrange@redhat.com, armbru@redhat.com 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);