From patchwork Mon May 6 17:33:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163433 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp264099ilm; Mon, 6 May 2019 10:46:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJyXO1aBa7C761/ynN/dMXns4jr1hvdtmuU15kwjfjd7BNvYFQSR6lbu65sbjyAcLL6tbx X-Received: by 2002:a05:600c:2190:: with SMTP id e16mr6539047wme.113.1557164772377; Mon, 06 May 2019 10:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557164772; cv=none; d=google.com; s=arc-20160816; b=mUVMw3XSbnM4ZmCIPXb8wvLmopsavRE3ycD3Mc9Wj7zXT3LB9RMZSlKz3b5uigdlP2 sU9T1FZvv/vZ97eVSXudk4Syk5pp4Kh9b8TCHva2NZKJl2DVkPi8Q/+QXf63wu0x+sJ+ QorsJhtUFhC/jf38FuoS3QW0NWcwOPcMJ7yyhaY5vMJ6z3CYjaGbr3otEtOIH2JSx8ST NyK5mSGXW13nlSmU4LZt6TerEXupEfeCgRbMhgj+VWAoaLAaohojKQhAcrVKAf+3ZYGG pHcqmnUFqzbpzP5DdsCb4srRS5vlksHCcMqBBHhHRuLHYBAHlu/J7LOU1R18ZVD3mwCf UK3Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=HH/L9mt26ecHO3SVHPhMrOoX9weRmZOQf65hlibBofo=; b=z70I7BnLM/j+Nzw8Zvvq7U3fRrqGZpvYtlhDVHrhnRnm25tiJ0uBLxuRrit9fmor/r M9WcU/zYgUrjDmHOVsCs8Rc6KApNyw43xALt5AULxqe95tJ8ikin0NngOIQJYWkyCGsj XZc0lYwXDxWnHwgY+18HMV1P89schZ6VuckawK1gPgBlSTyLF+sONRcSewSLktKrSIMr FTv1/eq1os5S26W2VspX4EXnMt68nspxcKhAA3PpBgGPyLkH7hneQgZwjcqQ3Td4UHHV TYdaoC5VHQSU72TnlV35Fekgk11DODCxlfQ4lWTd+fGeyZd05TUHZbisG8bGeSWIvslc QW9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x3XXvdHg; 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 j10si1941416wrp.218.2019.05.06.10.46.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 06 May 2019 10:46: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=x3XXvdHg; 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]:60072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNhgp-0003Vr-AV for patch@linaro.org; Mon, 06 May 2019 13:46:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNhVK-0001Cy-Gr for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNhVI-0001R5-Mq for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:18 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:36747) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNhVG-0001OO-Ph for qemu-devel@nongnu.org; Mon, 06 May 2019 13:34:16 -0400 Received: by mail-pg1-x534.google.com with SMTP id 85so6797515pgc.3 for ; Mon, 06 May 2019 10:34:13 -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 :mime-version:content-transfer-encoding; bh=HH/L9mt26ecHO3SVHPhMrOoX9weRmZOQf65hlibBofo=; b=x3XXvdHgCk4PbDzhb99ICvZWxdjsdUNjfjS4HLi+oUzM+5m1Wz9OBa6cvk9mq117H8 n4Lv98wqzKAEFhQGhNysVaOKZvBNAUNaOeVlWh/i8IGVEeWHt8Bb8osvCTy1N7CNvDDF iyvVHwvNtbmDQYuIUelAsdxG9c29VvOM+jxeT9BMnzcGs3s8FS9YBdrsUYiEcdULAOl3 o+a+4MWmqoNJZP6zFrg/oMRanxDMEHQbdgTWpFI8XakuShJzyQ/p1dI9+YWfnlrcZwJk ud8eDaZn1Jse4HM5jRgYaVPiY5Mn8p2F2rPkukqMoubFksOSbHvxUwIHX+O6rCRLRM6K Dswg== 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:mime-version:content-transfer-encoding; bh=HH/L9mt26ecHO3SVHPhMrOoX9weRmZOQf65hlibBofo=; b=pPgtOxq2tQWn7osvtT466FflQtZPn1A7V+AEJZ+M1ziVyNxlOHbShZY3dReWz2GH59 F4KFMdrhhIxa4wcyL3hXHriuc6soqk8fBjC4dGZtLceWtcfgJBicgnnqbV0rDx9M1pqg e2GedNg6htA/0aFq4aE1Tl++W4qumE8PThBxuj/EkQtJYztQerXDoELBZCwX6DuPHmUc VGaRa13GuLfsj5/24IQ2XAjQ3Xh1YTDbe0gr5Q/8R1z+WxNCOJ9pg/pI3dGlj+eczm2k qN+hj/7k6EkbwLr06aYPnC7yfyuQL7lPlo743jlxHMEwPns1LnkqoyudSJLRWpMqkVjk BVWg== X-Gm-Message-State: APjAAAUmXb3ySMMM8ce75UJ+WlahHt8KUOPDVwQ4Dr+CfBpSnBskv/kg /Zl1R38RgAwOWEeze3p2hMOJs2bHFjU= X-Received: by 2002:a65:6496:: with SMTP id e22mr33710784pgv.249.1557164051833; Mon, 06 May 2019 10:34:11 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 10:34:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 6 May 2019 10:33:42 -0700 Message-Id: <20190506173353.32206-14-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> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::534 Subject: [Qemu-devel] [PATCH v4 13/24] 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" Cc: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Laurent Vivier diff --git a/linux-user/main.c b/linux-user/main.c index 7dfb202e5d..e05aebe4e1 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -39,6 +39,7 @@ #include "trace/control.h" #include "target_elf.h" #include "cpu_loop-common.h" +#include "crypto/init.h" char *exec_path; @@ -688,8 +689,18 @@ int main(int argc, char **argv, char **envp) if (seed_optarg == NULL) { seed_optarg = getenv("QEMU_RAND_SEED"); } - if (seed_optarg != NULL) { - qemu_guest_random_seed_main(seed_optarg, &error_fatal); + { + Error *err = NULL; + if (seed_optarg != NULL) { + qemu_guest_random_seed_main(seed_optarg, &err); + } else { + /* ??? Assumes qcrypto is only used by qemu_guest_getrandom. */ + qcrypto_init(&err); + } + if (err) { + error_reportf_err(err, "cannot initialize crypto: "); + exit(1); + } } target_environ = envlist_to_environ(envlist, NULL);