From patchwork Thu Mar 14 04:55:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160283 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15071875jad; Wed, 13 Mar 2019 21:56:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzR3EtQbAEMelg7XzlZ/FPoU0kisXA1gM+UP2RLGvnA65zaMAOxLrCumvbgUc4Qk9mV72fs X-Received: by 2002:a81:27d5:: with SMTP id n204mr36718371ywn.495.1552539372387; Wed, 13 Mar 2019 21:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552539372; cv=none; d=google.com; s=arc-20160816; b=02XmnE/qnJBU1b5qLmCS/GUXzc79nGvXVOpdYbefXctOtNM3U1JXrVIyrVeznq4CRp Ev9sLexz7487AM4s4CgUYCWa6m/VxsBrTpKszHOx4LMKax3CuB6RNoTGdPWO+CLQbDfi 5ZGrBCKuKY+286/lJQwh00oxxeDFhH1x3BDSRva2RVH6yAtR10lXZk0BNab+bvzrncY5 8GtC2crvaNHgNhJdoHM8riMJ8ucZeaWI7xsyDYf03AcU9NsKXIvV2OcXC1HELyabpxjW R2RSVi6D5MdQo81n5c8vElbghpZZI1xlL8zR4dlHIbkXBztKbtyVeKmy/H7zxZWRAuEv 0TuQ== 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=uKRTrj7re9FbweA0AMluPgstQhCPOuLpPcbNF1yhnjs=; b=AT1owMGX919SnrJmLuV3QyYia+GfG0yhP3lyqcrVybMUsu9yRL+DF7CICngTqwxsa2 JQELBbAS8WVOfeEBP/xRj15PVmaFf4oPwVklhbP0pOE5Q46nGxXUWervMNdDvSj4RuWM M/FgX8AvPO8woBY2EWlYLMqtoPb3D83IxTCqUf2Mgb7m91WcXFupx8Edlt7e8TD0jgKV CVYMCMkH33hj/pxkNSNuj+r5uMW++cE2kg9vvyvaOdbWxYxdOHLjZO3BsZtYjWEPzj2c aOZsE0vNkd/W0h29oAEsl8UhOtFENKV+rJMj5cWOi+H+lHF2MQAylC3NPSjS1vfmXtbT UYww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kPQEdaey; 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 i3si8011027ybb.306.2019.03.13.21.56.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 13 Mar 2019 21:56:12 -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=kPQEdaey; 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]:56849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4IPb-0004Zh-Qs for patch@linaro.org; Thu, 14 Mar 2019 00:56:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4IP8-0004Xy-TE for qemu-devel@nongnu.org; Thu, 14 Mar 2019 00:55:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4IP7-0007QG-Vr for qemu-devel@nongnu.org; Thu, 14 Mar 2019 00:55:42 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:44666) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h4IP7-0007Pm-P2 for qemu-devel@nongnu.org; Thu, 14 Mar 2019 00:55:41 -0400 Received: by mail-pf1-x42a.google.com with SMTP id a3so2989284pff.11 for ; Wed, 13 Mar 2019 21:55:41 -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=uKRTrj7re9FbweA0AMluPgstQhCPOuLpPcbNF1yhnjs=; b=kPQEdaeyrSqiNfbRxn5VfepzkyUJd/QvhzcxHsKiFJ0q7pySPJaRBweYa8MYKFQ8xe N12ydlM9dMXAfunuIF1I1gIeLx4eAr+Yr4Y5woXzHYDymUfEM+oeWzr1duEMPyaP7Xmt OrLruxC8PoX5mst3+mFhqOOK3YlRxU3RLsCMVSRM4gp27Wwpn+qSKsl7uYcfe3Zn5yJL SWnlrMZdSqOy5nsJPpWrN6nktJRblRRok28Z8MIIgdQfCE20RtKjD8JrZ75FbDIMRgVh tucZ9d+/4xs2d5/iRElKWzNbriX5OGrWu6FjlYyyNu0vvyntWglIdhfDyfuUZnh4X8oN QnAA== 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=uKRTrj7re9FbweA0AMluPgstQhCPOuLpPcbNF1yhnjs=; b=H2tBmzPsJf07EMxiMIDezwJZs3TbCuP9ZP9r+3EuzDmF/84QVeYVeOfWN6kw8Tp+on 127k66vBNs/WPM5oI0NJTPQaaqIKQUbh94zbu0aDsP3pGd3EnI5UZFlhyYAFd7JhD+pr /ri/vRtikDc/Gjy5nAK3g4IiM2dY1m3/tRUJ4exCNvN6x9hoL8RNSGfdur9I3pYTN5Gl pBlOHxBS8oM/u1wsOig04kGnpnFP3ezXaYxcgZumSEuK4OMmtTqckNcheId4MY7bXkdR 3cYrv7LlqWoOj3ZpbDwHCff3AENs8i7mEKl84NAkYoRvLuqs/C+9cmr66KJ3vAqJX0KW /9qw== X-Gm-Message-State: APjAAAV8GXHRYeuIG0isCw4ON2HKIxjOV83S9WabIpdAeg9jV4rjQTFy 2jRYMRGm/u7VhCC2hWT0Pj1NxIo063M= X-Received: by 2002:a62:5249:: with SMTP id g70mr47305454pfb.115.1552539340534; Wed, 13 Mar 2019 21:55:40 -0700 (PDT) Received: from localhost.localdomain (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id d9sm16185027pgq.6.2019.03.13.21.55.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 21:55:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 21:55:22 -0700 Message-Id: <20190314045526.13342-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190314045526.13342-1-richard.henderson@linaro.org> References: <20190314045526.13342-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::42a Subject: [Qemu-devel] [PATCH v2 10/14] linux-user: Call qcrypto_init if not using -seed 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: Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is required before using qcrypto_random_bytes by way of qemu_getrandom. Cc: Laurent Vivier Signed-off-by: Richard Henderson --- linux-user/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.17.1 diff --git a/linux-user/main.c b/linux-user/main.c index 9682e81610..192bf759b8 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -38,6 +38,7 @@ #include "trace/control.h" #include "target_elf.h" #include "cpu_loop-common.h" +#include "crypto/init.h" char *exec_path; @@ -688,6 +689,13 @@ int main(int argc, char **argv, char **envp) } if (seed_optarg != NULL) { qemu_seedrandom_main(seed_optarg, &error_fatal); + } else { + /* ??? This assumes qcrypto is only used by qemu_getrandom. */ + Error *err = NULL; + if (qcrypto_init(&err) < 0) { + error_reportf_err(err, "cannot initialize crypto: "); + exit(1); + } } target_environ = envlist_to_environ(envlist, NULL);