From nobody Tue Nov 26 16:46:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=rodriguez.im ARC-Seal: i=1; a=rsa-sha256; t=1705704068; cv=none; d=zohomail.com; s=zohoarc; b=lJGdc5odxkJ8uglZAoa2uI6AhLIinTmosMpjMsRhRbLS4Q5wSmBXRNkEr/W9xX198ub5Bhf5hRg2YcpNVU1gQ+QvOqBFKlXTrF8HrDdkx7Qitr7D5CeenRiBoKCxvzp46ncrkufzoiWvxeqqa80uILMopCmFXw4O0amOMJOa/XM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705704068; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:Message-Id:Reply-To:To; bh=qMK/ck443NPgefUDvFscXSZM/Rq7JLfVBhMQHA4hX7A=; b=GTZE3Qtlpxo6dTfdSq6B0BqOFuRQDG/zYicap13QQTO6NvCO4IQf8jDbNgheL3I7EannS+lOpj55ItFJPAkbn9gZjW3FBptB2kCLDLw70CP6nOe799N7Hccm+lhZmbHcQZSqq0AmIzzw2/0ZHE+qsl4tSN8nGkETto9MT6O6JrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705704068489671.3010345590116; Fri, 19 Jan 2024 14:41:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQxXV-0001ov-At; Fri, 19 Jan 2024 17:40:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQvhr-0006E3-OM for qemu-devel@nongnu.org; Fri, 19 Jan 2024 15:43:16 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQvhq-0001FF-8J for qemu-devel@nongnu.org; Fri, 19 Jan 2024 15:43:15 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d3b84173feso2219845ad.1 for ; Fri, 19 Jan 2024 12:43:13 -0800 (PST) Received: from tumbleweedvm.. (181-162-59-228.baf.movistar.cl. [181.162.59.228]) by smtp.gmail.com with ESMTPSA id i1-20020a1709026ac100b001d538ee9ff3sm3398278plt.183.2024.01.19.12.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 12:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rodriguez.im; s=google; t=1705696992; x=1706301792; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qMK/ck443NPgefUDvFscXSZM/Rq7JLfVBhMQHA4hX7A=; b=gS9GIN8Y1VXi8H990wu3uj6qpp4iSXg0A+crQOfTKuJrZVmheqMdstrqdLYiUEx7jY 6GdJ3btL7EcMBr4SHocvy2hBhotDypWILfjwItyybKyIzzjyQE4jOUu76YRRPeH7OjkV zRIJ4UNNjXEUCnrNkhsCm0MeZ1X8FtqrKPxXA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705696992; x=1706301792; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qMK/ck443NPgefUDvFscXSZM/Rq7JLfVBhMQHA4hX7A=; b=CbPKyHvlxFc2mM5zHQ9DebZABxf9A7Fp9rBceG+dPT9BqMbYuamT7n6GUM/T9m8pIe 33vkowTQpimgTj5PQNhiDMJWP/OHrfTkbIloRGBo3YB/bDbtSM8sOG0W5suF1ca7dOD0 1YpRN7Qxyh5JRFGzetBTcC1GxwTOqQify31KouLR7W1H5R3iatMg9xmHG0C83KqPLiXB EiO3zWhKP4Gnc2a4bs5uVJp9eG5XoDU8Pz/guKGydIPGqDjueHpBDgdhdurxI++y1bFc 9HEMS+CeHvS1TC5i8RCgW/HZGAxZ/fNoYgOCbyOvomos3WI7F0oZJWND/cMfL+3pSsYh yp0A== X-Gm-Message-State: AOJu0YyevsfMc6h0Cwlnr7Q2FAKw8RTV63XaXIkv71q/R18+CUIwH3F2 /925ceqUY2lfWVZoqbl3WNtgDFAVCU3RpPjvtugvRKeUCerbt/nq9dtoWoH96RJq7EJhBgyrws8 = X-Google-Smtp-Source: AGHT+IFGddQpT5Im6muq0/7O3cZq7KKVTA9Iyw1BMMXbtGt9wNQVKh236dSOPmX8hl+SwXzaIDPQPg== X-Received: by 2002:a17:902:d34d:b0:1d5:f258:ad3 with SMTP id l13-20020a170902d34d00b001d5f2580ad3mr970483plk.0.1705696992296; Fri, 19 Jan 2024 12:43:12 -0800 (PST) From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= To: Cc: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-devel@nongnu.org (open list:All patches CC here) Subject: [PATCH] crypto/gcrypt: prefer kernel as direct source of entropy Date: Fri, 19 Jan 2024 17:39:40 -0300 Message-ID: <20240119203950.6434-1-cristian@rodriguez.im> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=cr@cristianrodriguez.net; helo=mail-pl1-x634.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 19 Jan 2024 17:40:38 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rodriguez.im) X-ZM-MESSAGEID: 1705704069355100001 gcrypt by default uses an userspace RNG, which cannot know when it is time to discard/invalidate its buffer (suspend, resume, vm forks, other corner cases) as a "when to discard" event is unavailable to userspace. Set GCRYCTL_SET_PREFERRED_RNG_TYPE to GCRY_RNG_TYPE_SYSTEM which must be done before the first call to gcry_check_version() Signed-off-by: Cristian Rodr=C3=ADguez --- crypto/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/init.c b/crypto/init.c index fb7f1bff10..0c3fe6a841 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -60,6 +60,7 @@ int qcrypto_init(Error **errp) #endif =20 #ifdef CONFIG_GCRYPT + gcry_control(GCRYCTL_SET_PREFERRED_RNG_TYPE, GCRY_RNG_TYPE_SYSTEM); if (!gcry_check_version(NULL)) { error_setg(errp, "Unable to initialize gcrypt"); return -1; --=20 2.43.0